/* =============================================
   MODERN UI STYLES
   ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Public Sans', sans-serif;
    background: #f5f5f5;
    color: #1a2433;
}

/* =============================================
   AUTH LAYOUT – CSS GRID
   ============================================= */
.auth-layout {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 1fr;
}

.auth-hero {
    display: none !important;
}

@media (min-width: 1024px) {
    .auth-layout {
        grid-template-columns: 0.72fr 1.28fr;
    }

    .auth-hero {
        display: block !important;
    }
}

/* =============================================
   HERO PANEL (left side)
   ============================================= */
.auth-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #102a4c 0%, #1a4a7c 100%);
}

.auth-hero-zoom {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(1px);
    animation: heroZoom 18s ease-in-out infinite alternate;
}

@keyframes heroZoom {
    from {
        transform: scale(1.05);
    }

    to {
        transform: scale(1.14);
    }
}

.auth-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(16, 42, 76, 0.16) 0%,
            rgba(16, 42, 76, 0.32) 40%,
            rgba(9, 25, 47, 0.86) 100%);
}

.auth-hero-blend {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(10, 15, 25, 0) 70%, #ffffff 100%);
}

.auth-hero-brand {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    padding: 24px 48px;
}

.auth-hero-logo {
    height: 42px;
    width: auto;
    object-fit: contain;
    background: #ffffff;
    padding: 6px 12px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.auth-hero-content {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 44px 48px 48px;
    color: #ffffff;
    max-width: 600px;
}

.auth-hero-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 12px 0 14px;
    color: #ffffff;
}

.auth-hero-kicker {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7fc0ff;
}

.auth-hero-title span {
    color: #7fc0ff;
}

.auth-hero-subtitle {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
    max-width: 420px;
    margin: 0;
}

.auth-hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(6px);
    font-size: 13px;
    font-weight: 500;
    color: #dbeaff;
}

.auth-hero-tag i {
    font-size: 13px;
}

.auth-hero-stats {
    display: flex;
    gap: 28px;
    margin: 30px 0 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.auth-hero-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-hero-stat dt {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    line-height: 1.1;
}

.auth-hero-stat dd {
    margin: 0;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.68);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.auth-hero-more {
    margin: 18px 0 0;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.58);
}

.auth-hero-points {
    list-style: none;
    margin: 24px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-hero-points li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 12.5px;
    font-weight: 500;
    color: #dbeaff;
}

.auth-hero-points li i {
    color: #7fc0ff;
    font-size: 12px;
}

/* =============================================
   FORM SIDE (right side)
   ============================================= */
.auth-form-side {
    position: relative;
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: #ffffff;
    transition: background-color 0.3s ease;
}

.auth-slide-in {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    animation: auth-slide-in 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes auth-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =============================================
   LOGIN CARD - No border styles for success/error
   ============================================= */
.login-card {
    width: 100%;
    padding: clamp(24px, 3vw, 36px);
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e8eef5;
    box-shadow: 0 24px 70px -30px rgba(5, 20, 50, 0.45);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.login-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 80px -32px rgba(5, 20, 50, 0.55);
}

.login-card.default {
    border-color: #e8eef5;
}

/* Removed border styles for success/error - only subtle shadow change */
.login-card.success {
    border-color: #e8eef5;
    box-shadow: 0 24px 70px -30px rgba(56, 161, 105, 0.15);
}

.login-card.success .auth-card-title {
    color: #276749;
}

.login-card.error {
    border-color: #e8eef5;
    box-shadow: 0 24px 70px -30px rgba(229, 62, 62, 0.12);
}

.login-card.error .auth-card-title {
    color: #c53030;
}

.login-card.loading {
    border-color: #e8eef5;
    box-shadow: 0 24px 70px -30px rgba(26, 74, 124, 0.12);
}

/* =============================================
   PROGRESS BAR
   ============================================= */
.auth-progress-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e9ecef;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    display: block;
}

.auth-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #1a4a7c, #2d6ba8);
    width: 0%;
    transition: width 0.5s ease;
}

.auth-progress-bar.success {
    background: linear-gradient(90deg, #38a169, #68d391);
}

.auth-progress-bar.error {
    background: linear-gradient(90deg, #e53e3e, #fc8181);
}

/* =============================================
   LOGO
   ============================================= */
.auth-card-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 16px 12px 16px;
    margin: calc(-1 * clamp(24px, 3vw, 36px)) calc(-1 * clamp(24px, 3vw, 36px)) 12px calc(-1 * clamp(24px, 3vw, 36px));
    background: transparent;
    border-radius: 16px 16px 0 0;
}

.auth-card-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(9, 30, 66, 0.16));
}

/* =============================================
   CARD HEADER
   ============================================= */
.auth-card-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;
    margin: 0 0 18px;
}

.auth-card-title {
    margin: 0;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: #1a2433;
    transition: color 0.3s ease;
}

.auth-welcome {
    font-size: 20px;
}

.auth-card-subtitle {
    font-size: 12px;
    line-height: 1.4;
    max-width: 320px;
    color: #6b7a90;
    margin: 0;
}

/* =============================================
   TOAST - Below heading
   ============================================= */
.auth-toast-wrapper {
    margin-bottom: 12px;
}

.auth-toast {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    padding: 0 16px;
    transition: opacity 0.35s ease, max-height 0.35s ease, padding 0.35s ease, visibility 0.35s;
    margin-bottom: 0;
    border-radius: 8px;
}

.auth-toast.is-visible {
    opacity: 1;
    visibility: visible;
    max-height: 60px;
    padding: 10px 16px;
    margin-bottom: 12px;
}

.auth-toast--error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.auth-toast--error i {
    color: #ef4444;
    font-size: 16px;
}

.auth-toast--success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.auth-toast--success i {
    color: #22c55e;
    font-size: 16px;
}

.server-error-inline {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}

.server-error-inline i {
    color: #ef4444;
    font-size: 16px;
}

/* =============================================
   FORM FIELDS
   ============================================= */
.auth-form-row {
    display: flex;
    gap: 14px;
    margin-bottom: 0;
}

.auth-form-row .auth-field {
    flex: 1;
    min-width: 0;
}

@media (max-width: 540px) {
    .auth-form-row {
        flex-direction: column;
        gap: 0;
    }
}

.auth-field {
    position: relative;
    margin-bottom: 14px;
}

.auth-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-field label i {
    margin-right: 4px;
    color: #6b7a90;
    font-size: 11px;
}

.auth-field input[type="text"],
.auth-field input[type="password"],
.auth-field select {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
    font-family: inherit;
    color: #1a2433;
    background: #fbfcfe;
    border: 1.5px solid #dde6ef;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.auth-field input:focus,
.auth-field select:focus {
    border-color: #1a4a7c;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(26, 74, 124, 0.08);
}

.auth-field input.success {
    border-color: #38a169;
    box-shadow: 0 0 0 4px rgba(56, 161, 105, 0.08);
}

.auth-field input.error,
.auth-field select.error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.06);
}

.auth-field .field-icon {
    position: absolute;
    right: 10px;
    bottom: 10px;
    font-size: 14px;
    z-index: 2;
    display: none;
}

.auth-field .field-icon#check-icon {
    color: #38a169;
}

.auth-field .field-icon#error-icon {
    color: #e53e3e;
}

/* Password toggle */
.auth-field .toggle-password {
    position: absolute;
    right: 10px;
    bottom: 8px;
    cursor: pointer;
    background: transparent;
    border: none;
    color: #a0aec0;
    font-size: 15px;
    z-index: 3;
    padding: 2px;
    transition: color 0.2s;
}

.auth-field .toggle-password:hover {
    color: #1a4a7c;
}

/* =============================================
   ROLE SELECTION - With spacing
   ============================================= */
#roleDiv {
    display: none;
    margin-bottom: 14px;
}

#roleDiv label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#roleDiv label i {
    margin-right: 4px;
    color: #6b7a90;
    font-size: 11px;
}

#roleDiv select {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
    font-family: inherit;
    color: #1a2433;
    background: #fbfcfe;
    border: 1.5px solid #dde6ef;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#roleDiv select:focus {
    border-color: #1a4a7c;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(26, 74, 124, 0.08);
}

/* =============================================
   STATION / SHIFT ROW - With spacing
   ============================================= */
#stationShiftRow {
    display: none;
    gap: 14px;
    margin-bottom: 14px;
}

#stationShiftRow .auth-field {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

#stationDiv,
#shiftDiv {
    display: none;
}

#stationDiv label,
#shiftDiv label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#stationDiv label i,
#shiftDiv label i {
    margin-right: 4px;
    color: #6b7a90;
    font-size: 11px;
}

#stationDiv select,
#shiftDiv select {
    width: 100%;
    height: 38px;
    padding: 0 14px;
    font-size: 13px;
    font-family: inherit;
    color: #1a2433;
    background: #fbfcfe;
    border: 1.5px solid #dde6ef;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

#stationDiv select:focus,
#shiftDiv select:focus {
    border-color: #1a4a7c;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(26, 74, 124, 0.08);
}

/* =============================================
   CAPTCHA
   ============================================= */
.auth-captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-captcha-row .auth-captcha-preview {
    margin-bottom: 0;
    flex-shrink: 0;
}

.auth-captcha-row #captcha {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.auth-captcha-preview {
    display: flex;
    align-items: center;
    gap: 0px;
    margin-bottom: 8px;
}

.auth-captcha-frame {
    flex: 0;
    display: flex;
    align-items: center;
}

.auth-captcha-frame img {
    height: 34px;
    display: block;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.auth-captcha-refresh {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #6b7a90;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-captcha-refresh:hover {
    color: #1a4a7c;
}

/* =============================================
   BUTTON
   ============================================= */
.auth-btn-login {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #1a4a7c 0%, #2d6ba8 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.3px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 10px 24px -10px rgba(10, 40, 80, 0.5);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.auth-btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
    transform: translateX(-100%);
    transition: transform 0.55s ease;
}

.auth-btn-login:hover:not(:disabled)::before {
    transform: translateX(100%);
}

.auth-btn-login:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px -10px rgba(10, 40, 80, 0.6);
}

.auth-btn-login .btn-arrow {
    transition: transform 0.28s ease;
    font-size: 14px;
}

.auth-btn-login:hover:not(:disabled) .btn-arrow {
    transform: translateX(6px);
}

.auth-btn-login:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* =============================================
   REMEMBER ME + FORGOT PASSWORD
   ============================================= */
.auth-remember-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.auth-remember-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #4a5a73;
    user-select: none;
}

.auth-remember-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-remember-check .box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid #c9d4e0;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s ease;
    color: #ffffff;
    font-size: 12px;
    flex-shrink: 0;
}

.auth-remember-check input:checked+.box {
    background: #1a4a7c;
    border-color: #1a4a7c;
}

.auth-remember-check .box .bx {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.18s ease;
}

.auth-remember-check input:checked+.box .bx {
    opacity: 1;
    transform: scale(1);
}

.auth-forgot-link {
    font-size: 12px;
    font-weight: 500;
    color: #1a4a7c;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-forgot-link:hover {
    text-decoration: underline;
    color: #2d6ba8;
}

/* =============================================
   FOOTER
   ============================================= */
.auth-card-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e8eef5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #8a97a8;
}

.auth-card-footer i {
    color: #1a4a7c;
    font-size: 11px;
    margin-right: 6px;
}

.auth-contact-link {
    text-align: center;
    margin: 16px 0 0;
    font-size: 12px;
    color: #6b7a90;
}

.auth-contact-link a {
    color: #1a4a7c;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.auth-contact-link a:hover {
    text-decoration: underline;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1024px) {
    .auth-hero {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .login-card {
        padding: 24px 20px;
    }

    .auth-slide-in {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .login-card {
        padding: 20px 16px;
        border-radius: 14px;
    }

    .auth-card-brand {
        margin: -20px -16px 10px -16px;
        padding: 16px 12px;
        border-radius: 14px 14px 0 0;
    }

    .auth-card-logo {
        height: 44px;
    }

    .auth-welcome {
        font-size: 18px;
    }

    .auth-card-subtitle {
        font-size: 11px;
    }

    .auth-field input[type="text"],
    .auth-field input[type="password"],
    .auth-field select,
    #roleDiv select,
    #stationDiv select,
    #shiftDiv select {
        height: 34px;
        font-size: 12px;
        padding: 0 12px;
    }

    .auth-btn-login {
        height: 36px;
        font-size: 13px;
    }

    .auth-form-row {
        gap: 10px;
    }

    #stationShiftRow {
        gap: 10px;
    }

    #roleDiv {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .auth-form-row {
        flex-direction: column;
        gap: 0;
    }

    #stationShiftRow {
        flex-direction: column;
        gap: 0;
    }

    #stationShiftRow .auth-field {
        margin-bottom: 14px;
    }

    #stationShiftRow .auth-field:last-child {
        margin-bottom: 0;
    }

    .auth-captcha-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .auth-captcha-row .auth-captcha-preview {
        align-self: flex-start;
    }

    .auth-captcha-row #captcha {
        width: 100%;
    }
}