/* ApplyUni Custom Admin CSS */

:root {
    --primary-color: #e92026;
    --primary-hover: #c41920;
    --secondary-color: #030d4a;
    --header-bg: #030d4a;
    --header-text: #ffffff;
    --link-color: #e92026;
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-radius: 8px;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-family);
    color: var(--text-color);
}

/* Header customization */
#header {
    background: var(--header-bg) !important;
    color: var(--header-text) !important;
    padding: 15px 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#header a.section:link,
#header a.section:visited {
    color: var(--header-text);
}

#branding h1 {
    color: var(--header-text);
    font-weight: 600;
}

#branding img {
    height: 40px;
    width: auto;
    margin-right: 15px;
    vertical-align: middle;
}

div.breadcrumbs {
    background: var(--card-bg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 15px 40px;
    border-bottom: 1px solid #eee;
    color: #666;
}

/* Modules / Dashboard */
.dashboard .module table caption {
    background: var(--secondary-color);
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: left;
    padding: 12px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.module {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: none !important;
    margin-bottom: 30px;

    a:link,
    a:visited {
        color: var(--link-color);
        text-decoration: none;
        transition: color 0.2s;
    }

    a:hover {
        color: var(--primary-hover);
    }

    .button,
    input[type=submit],
    input[type=button],
    .submit-row input,
    a.button {
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 4px;
        /* Slightly rounded buttons */
        padding: 10px 20px;
        font-weight: 500;
        transition: all 0.3s ease;
        text-transform: uppercase;
        font-size: 0.8rem;
        letter-spacing: 0.5px;
    }

    .button:hover,
    input[type=submit]:hover,
    input[type=button]:hover,
    .submit-row input:hover,
    a.button:hover {
        background: var(--primary-hover);
        transform: translateY(-1px);
        box-shadow: 0 2px 5px rgba(233, 32, 38, 0.3);
    }

    .button.default,
    input[type=submit].default,
    .submit-row input.default {
        background: var(--primary-color);
    }

    /* Form rows */
    .form-row {
        border-bottom: 1px solid #f0f0f0;
        padding: 15px 10px;
    }

    .form-row:last-child {
        border-bottom: none;
    }

    /* Sidebar filter */
    #changelist-filter {
        background: var(--card-bg);
        border-radius: var(--border-radius);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        border: none;
    }

    #changelist-filter h2 {
        background: var(--secondary-color);
        color: white;
        padding: 10px;
        border-radius: var(--border-radius) var(--border-radius) 0 0;
    }
}

    /* Login Page Redesign - Clean & Modern */
    html,
    body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    body.login {
        background-color: #f5f7fa;
        min-height: 100vh;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Make the wrapping container fill the screen and center its content */
    .login #container {
        flex: 1;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* Ensure content block doesn't block centering */
    .login #content {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        width: 100% !important;
        flex: 1;
        margin: 0 !important;
        padding: 0 !important;
    }

    .login-wrapper {
        width: 100%;
        max-width: 500px;
        /* Increased from 400px */
        padding: 20px;
        margin: auto;
        /* Fallback centering */
    }

    .login-box {
        background: #ffffff;
        padding: 40px;
        border-radius: 12px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
        text-align: center;
    }

    .login-header {
        margin-bottom: 30px;
        display: flex;
        justify-content: center;
    }

    .login-header img {
        height: 50px;
        width: auto;
        filter: none !important;
    }

    /* Form Styles */
    .login .form-group {
        margin-bottom: 20px;
        text-align: left;
    }

    .login label {
        display: block;
        margin-bottom: 8px;
        color: #374151;
        font-size: 0.9rem;
        font-weight: 500;
    }

    .login input[type="text"],
    .login input[type="password"] {
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font-size: 0.95rem;
        transition: border-color 0.2s, box-shadow 0.2s;
        box-sizing: border-box;
        /* Critical for alignment */
    }

    .login input[type="text"]:focus,
    .login input[type="password"]:focus {
        border-color: #e92026;
        box-shadow: 0 0 0 3px rgba(233, 32, 38, 0.1);
        outline: none;
    }

    .login .submit-row {
        margin-top: 24px;
    }

    .login input[type="submit"] {
        width: 100%;
        background-color: #e92026;
        color: white;
        padding: 12px;
        border-radius: 6px;
        font-weight: 600;
        font-size: 1rem;
        border: none;
        cursor: pointer;
        transition: background-color 0.2s;
    }

    .login input[type="submit"]:hover {
        background-color: #c41920;
    }

    .login .password-reset {
        margin-top: 16px;
        font-size: 0.85rem;
    }

    .login .password-reset a {
        color: #6b7280;
    }

    .login .password-reset a:hover {
        color: #e92026;
    }

    .login .errornote {
        background-color: #fef2f2;
        color: #991b1b;
        padding: 12px;
        border-radius: 6px;
        font-size: 0.875rem;
        margin-bottom: 20px;
        text-align: left;
        border: 1px solid #fee2e2;
    }

    /* Modernize the object tools */
    .object-tools a {
        background: var(--secondary-color);
        border-radius: 20px;
    }

    .object-tools a:hover {
        background: var(--primary-color);
    }

    /* Inputs */
    input[type=text],
    input[type=password],
    input[type=email],
    input[type=url],
    input[type=number],
    textarea,
    select,
    .vTextField {
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px;
        transition: border-color 0.3s;
    }

    input:focus,
    textarea:focus,
    select:focus {
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 2px rgba(233, 32, 38, 0.1);
    }

    /* Fix truncated text in inline formset inputs/selects */
    .inline-group select,
    .inline-group input[type="text"],
    .inline-group input[type="number"] {
        padding: 8px 10px;
        line-height: 1.5;
        height: auto;
    }

    /* Improve visibility of all form fields globally in admin */
    select, 
    input[type="text"], 
    input[type="number"], 
    input[type="email"], 
    input[type="url"], 
    input[type="password"] {
        min-height: 40px !important;
        font-size: 14px !important;
        padding: 8px 12px !important;
        box-sizing: border-box;
    }

    /* Fix select boxes being too narrow in tables */
    .tabular .form-row td select {
        min-width: 250px; /* Make dropdowns wider */
        max-width: 400px;
    }
    
    /* Ensure rows have breathing room */
    .tabular tr.form-row td {
        padding: 10px 5px;
        vertical-align: middle;
    }

    /* Hide the 'original' column text in tabular inlines (duplicate string representation) */
    .tabular tr.form-row td.original {
        padding: 0 !important;
        width: 0 !important;
        border: none !important;
        overflow: hidden;
        white-space: nowrap;
    }
    .tabular tr.form-row td.original p {
        display: none !important;
    }