/* KADIC Programme Secretariat — auth pages (login & request access) */

:root {
    --kadic-teal-950: #0f3339;
    --kadic-teal-900: #184c5a;
    --kadic-teal-800: #185060;
    --kadic-teal-700: #236477;
    --kadic-teal-600: #1c6a84;
    --kadic-green-600: #12845a;
    --kadic-surface: #f4f7f6;
    --kadic-border: #dde8e3;
    --kadic-border-strong: #c8d9d1;
    --kadic-text: #1e293b;
    --kadic-muted: #64748b;
    --kadic-radius: 12px;
    --kadic-radius-lg: 16px;
    --kadic-shadow: 0 1px 2px rgba(15, 51, 57, 0.04), 0 8px 24px rgba(15, 51, 57, 0.06);
    --auth-topbar-h: 64px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.auth-page {
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--kadic-text);
    background: var(--kadic-surface);
    -webkit-font-smoothing: antialiased;
}

.auth-shell {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    isolation: isolate;
}

/* —— Background —— */
.auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.auth-backdrop__photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 35%;
    transform: scale(1.02);
}

.auth-backdrop__shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0, 0, 0, 0.28) 0%, rgba(15, 51, 57, 0.18) 42%, rgba(0, 0, 0, 0.34) 100%);
}

/* —— Top bar —— */
.auth-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--auth-topbar-h);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(221, 232, 227, 0.85);
    box-shadow: 0 1px 3px rgba(15, 51, 57, 0.04);
}

.auth-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1120px;
    height: 100%;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.auth-topbar__brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.auth-topbar__lockup {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    min-width: 0;
}

.auth-topbar__logo-link {
    display: flex;
    align-items: center;
    line-height: 0;
    text-decoration: none;
}

.auth-topbar__logo-link:hover {
    opacity: 0.92;
}

.auth-topbar__moa {
    display: block;
    height: 54px;
    width: auto;
}

.auth-topbar__kadic {
    display: block;
    height: 40px;
    width: auto;
    max-width: min(220px, 38vw);
}

.auth-topbar__rule {
    width: 1px;
    height: 38px;
    flex: none;
    background: var(--kadic-border);
}

.auth-topbar__rule--flag {
    width: 4px;
    height: 48px;
    border-radius: 2px;
    background: linear-gradient(
        180deg,
        #000 0%,
        #000 26%,
        #fff 26%,
        #fff 30%,
        #bb1e2d 30%,
        #bb1e2d 52%,
        #fff 52%,
        #fff 56%,
        #006600 56%,
        #006600 100%
    );
    box-shadow: 0 0 0 1px rgba(13, 27, 19, 0.08);
}

.auth-topbar__brand:hover .auth-topbar__name {
    color: var(--kadic-teal-700);
}

.auth-topbar__logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    flex-shrink: 0;
}

.auth-topbar__titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.auth-topbar__name {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--kadic-teal-900);
    letter-spacing: 0.01em;
    transition: color 0.15s ease;
}

.auth-topbar__sub {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kadic-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-topbar__nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-shrink: 0;
}

.auth-topbar__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4375rem;
    padding: 0.25rem 0;
    color: var(--kadic-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.auth-topbar__link:hover {
    color: var(--kadic-teal-800);
}

.auth-topbar__link.is-active {
    color: var(--kadic-teal-900);
    font-weight: 600;
    border-bottom-color: var(--kadic-teal-600);
}

.auth-topbar__link i {
    width: 1rem;
    font-size: 0.8125rem;
    text-align: center;
    color: var(--kadic-teal-700);
    opacity: 0.9;
}

.auth-topbar__link.is-active i {
    opacity: 1;
}

/* —— Main content —— */
.auth-panel {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem 3rem;
}

.auth-panel--scroll {
    align-items: flex-start;
    padding-top: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    border-radius: var(--kadic-radius-lg);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        var(--kadic-shadow),
        0 0 0 1px rgba(221, 232, 227, 0.5);
}

.auth-card--wide {
    max-width: 560px;
}

.auth-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.75rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: #eef6f2;
    color: var(--kadic-teal-800);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-card-badge i {
    font-size: 0.625rem;
    opacity: 0.85;
}

.auth-card-head {
    margin-bottom: 1.5rem;
}

.auth-card-head h2 {
    margin: 0 0 0.375rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kadic-teal-900);
    letter-spacing: -0.02em;
}

.auth-card-head p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--kadic-muted);
    line-height: 1.55;
}

/* —— Form controls —— */
.auth-card .form-label,
.auth-form-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}

.auth-form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--kadic-border);
}

.auth-form-section:last-of-type {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.auth-form-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--kadic-teal-700);
}

.auth-form-section-title i {
    font-size: 0.6875rem;
    opacity: 0.8;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.8125rem;
    pointer-events: none;
}

.auth-card .form-control,
.auth-card .form-select {
    border-radius: var(--kadic-radius);
    border: 1px solid var(--kadic-border-strong);
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    background: #fafbfb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-card .auth-input-wrap .form-control {
    padding-left: 2.375rem;
}

.auth-card .form-control:focus,
.auth-card .form-select:focus {
    border-color: var(--kadic-teal-600);
    box-shadow: 0 0 0 3px rgba(28, 106, 132, 0.12);
    background: #fff;
}

.auth-card textarea.form-control {
    min-height: 88px;
    resize: vertical;
}

.auth-card .form-control::placeholder {
    color: #94a3b8;
}

/* —— Module selection —— */
.auth-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.auth-module-option {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.auth-module-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.auth-module-option span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--kadic-radius);
    border: 1px solid var(--kadic-border-strong);
    background: #fafbfb;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.auth-module-option span::before {
    content: "";
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--kadic-border-strong);
    background: #fff;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.auth-module-option input:focus-visible + span {
    outline: 2px solid var(--kadic-teal-600);
    outline-offset: 2px;
}

.auth-module-option input:checked + span {
    border-color: var(--kadic-teal-600);
    background: #f0f7f4;
    color: var(--kadic-teal-900);
}

.auth-module-option input:checked + span::before {
    border-color: var(--kadic-teal-600);
    background: var(--kadic-teal-600);
    box-shadow: inset 0 0 0 2px #fff;
}

.auth-module-option:hover span {
    border-color: #b8cfc4;
    background: #fff;
}

/* —— Buttons —— */
.btn-kadic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: var(--kadic-teal-900);
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--kadic-radius);
    padding: 0.6875rem 1.125rem;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn-kadic:hover,
.btn-kadic:focus {
    background: var(--kadic-teal-800);
    color: #fff;
}

.btn-kadic:active {
    transform: translateY(1px);
}

.btn-kadic-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: #fff;
    border: 1px solid var(--kadic-border-strong);
    color: #475569;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--kadic-radius);
    padding: 0.6875rem 1.125rem;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-kadic-outline:hover {
    border-color: var(--kadic-teal-600);
    color: var(--kadic-teal-800);
    background: #f8fbfa;
}

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 1.5rem;
}

.auth-actions .btn-kadic,
.auth-actions .btn-kadic-outline {
    flex: 1 1 auto;
    min-width: 140px;
}

/* —— Alerts —— */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    margin-bottom: 1.25rem;
    border-radius: var(--kadic-radius);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.auth-alert i {
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.auth-alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.auth-alert--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* —— Success state —— */
.auth-success {
    text-align: center;
    padding: 0.5rem 0 0.25rem;
}

.auth-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: #ecfdf5;
    color: var(--kadic-green-600);
    font-size: 1.5rem;
}

.auth-success h2 {
    margin: 0 0 0.5rem;
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--kadic-teal-900);
}

.auth-success p {
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    color: var(--kadic-muted);
    line-height: 1.55;
}

/* —— Footer links —— */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem;
    color: #94a3b8;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--kadic-border);
}

.auth-links {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--kadic-muted);
}

.auth-links a {
    color: var(--kadic-teal-700);
    text-decoration: none;
    font-weight: 600;
}

.auth-links a:hover {
    color: var(--kadic-teal-900);
    text-decoration: underline;
}

.auth-links p {
    margin: 0.375rem 0 0;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--kadic-muted);
    text-decoration: none;
}

.auth-back-link:hover {
    color: var(--kadic-teal-800);
}

/* —— Page footer —— */
.auth-foot {
    position: relative;
    z-index: 1;
    padding: 1rem 1.5rem 1.25rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--kadic-muted);
    border-top: 1px solid rgba(221, 232, 227, 0.85);
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-foot img {
    height: 22px;
    width: auto;
    vertical-align: middle;
    margin-right: 0.5rem;
    opacity: 0.85;
}

/* —— Responsive —— */
@media (max-width: 640px) {
    .auth-topbar__inner {
        padding: 0 1rem;
    }

    .auth-topbar__moa {
        height: 40px;
    }

    .auth-topbar__kadic {
        height: 32px;
        max-width: min(180px, 48vw);
    }

    .auth-topbar__rule--flag {
        width: 3px;
        height: 36px;
    }

    .auth-topbar__nav {
        gap: 0.75rem;
    }

    .auth-topbar__link {
        font-size: 0.8125rem;
    }

    .auth-topbar__link span {
        display: none;
    }

    .auth-topbar__link i {
        font-size: 0.9375rem;
    }

    .auth-panel,
    .auth-panel--scroll {
        padding: 1.5rem 1rem 2rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .auth-module-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .auth-module-grid {
        grid-template-columns: 1fr;
    }

    .auth-actions {
        flex-direction: column;
    }

    .auth-actions .btn-kadic,
    .auth-actions .btn-kadic-outline {
        width: 100%;
    }
}
