/* ==========================================================================
   ORESS Authentication Base Styles
   Minimal Modern Design System
   ========================================================================== */

/* ==========================================================================
   CSS Custom Properties (Variables)

   Never name one after a Tailwind 4 theme variable a utility reads
   (--font-sans, --font-display, --radius-sm/md/lg/xl, --color-*, --spacing
   ...). Tailwind's utilities read those at run time (`rounded-lg` is
   `border-radius: var(--radius-lg)`), and this unlayered :root beats its
   layered theme, so every such class on these pages would change size or
   font. Hence the --auth- prefix on the ones that clashed (SEC-SUPPLY-25).
   ========================================================================== */
:root {
    /* Primary Color Palette: the brand (BRAND-01), the theme's primary-600,
       -700, -500, -50 and -100. Deep blue reads at 4.0:1 on white. */
    --primary: #2387ba;
    --primary-dark: #20719c;
    --primary-light: #33b8f3;
    --primary-50: #f5fbff;
    --primary-100: #e2f4ff;

    /* Accent Colors: the theme's accent-500, -600 and -400 (cyan), so the
       submit button runs deep blue to cyan like the navbar's sign-up button. */
    --accent: #00a9c7;
    --accent-dark: #0094ae;
    --accent-light: #00bddd;

    /* Neutral Colors */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;

    /* Glass Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --backdrop-blur: blur(20px);

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Typography */
    --auth-font-sans: 'Titillium Web', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --auth-font-display: var(--auth-font-sans);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Border Radius */
    --auth-radius-sm: 6px;
    --radius: 8px;
    --auth-radius-md: 12px;
    --auth-radius-lg: 16px;
    --auth-radius-xl: 24px;
    --radius-full: 9999px;
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

/* No background here (UI-10): the page colour is base.html's, the same flat grey
   as every other page. A `background` on this selector would paint over it. */
body {
    font-family: var(--auth-font-sans);
    min-height: 100vh;
    color: var(--gray-800);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--auth-font-display);
    font-weight: 600;
    line-height: 1.3;
    color: var(--gray-900);
}

/* ==========================================================================
   Shared Alert Styles
   ========================================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-radius: var(--auth-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert i {
    font-size: 1rem;
    flex-shrink: 0;
}

/* Inline action inside an alert (e.g. the resend-verification CTA on login). */
.alert .resend-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.alert .resend-link:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ==========================================================================
   Shared Form Styles
   ========================================================================== */
.error-message {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 500;
    margin-top: 0.375rem;
    padding-left: 0.25rem;
    animation: slideIn 0.2s ease-out;
}

.error-message i {
    font-size: 0.75rem;
}

.field-error {
    border-color: var(--danger) !important;
}

.field-error:focus-within {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
.loading-icon {
    display: none;
}

.btn-loading .loading-icon {
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0.7;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Shared Auth Page Layout
   ========================================================================== */

/* Main Container */
.auth-wrapper {
    min-height: 100vh;
    min-height: 100dvh; /* mobile browser chrome — keeps the card truly centred */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Auth Card */
.auth-card {
    width: 100%;
    max-width: 420px;
    position: relative; /* .auth-home is placed against it */
    background: #ffffff;
    border-radius: var(--auth-radius-xl);
    /* The hairline is a shadow, not a border: a border would make every card
       2px taller, and the sign-up page must not grow (UI-10). */
    box-shadow: 0 0 0 1px var(--gray-200), var(--shadow-xl);
    overflow: hidden;
    animation: cardEnter 0.5s ease-out;
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================================================
   Card Header
   ========================================================================== */
.auth-header {
    padding: 2.5rem 2rem 2rem;
    text-align: center;
}

.auth-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--auth-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

/* The brand mark on login and signup (BRAND-01); forgot-password keeps an
   icon on its own amber tile (forgot-password.css). */
.auth-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.auth-logo i {
    font-size: 1.5rem;
    color: white;
}

.auth-title {
    font-family: var(--auth-font-display);
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 0.375rem;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: var(--gray-500);
    font-size: 0.9rem;
    margin: 0;
}

/* ==========================================================================
   Card Body
   ========================================================================== */
.auth-body {
    padding: 0.5rem 2rem 2rem;
}

/* ==========================================================================
   Form Fields
   ========================================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--gray-400);
    font-size: 0.9375rem;
    pointer-events: none;
    transition: color var(--transition-base);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--auth-radius-md);
    outline: none;
    transition: all var(--transition-base);
}

.form-input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

.form-input:hover {
    border-color: var(--gray-300);
    background: white;
}

.form-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(35, 135, 186, 0.1);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

/* Select styling */
select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
    padding-right: 2.5rem;
}

/* Field hint */
.field-hint {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
    padding-left: 0.125rem;
}

/* ==========================================================================
   Checkbox Styles
   ========================================================================== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-600);
    user-select: none;
}

.checkbox-input {
    width: 1.125rem;
    height: 1.125rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--auth-radius-sm);
    background: white;
    cursor: pointer;
    appearance: none;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-input:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-input:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-input:focus {
    box-shadow: 0 0 0 3px rgba(35, 135, 186, 0.15);
}

.checkbox-label a {
    /* Same WCAG AA issue + fix as .auth-footer a (Phase 6.2). */
    color: #1a4c68;
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */
.btn-submit {
    width: 100%;
    padding: 0.9375rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: white;
    background: #20719c;
    border: none;
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-submit:hover {
    background: #1d5d7f;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(32, 113, 156, 0.3);
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Divider
   ========================================================================== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.75rem 0;
    color: var(--gray-400);
    font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.auth-divider span {
    padding: 0 1rem;
}

/* ==========================================================================
   Card Footer
   ========================================================================== */
.auth-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
}

.auth-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gray-600);
}

.auth-footer a {
    /* The brand's light blues fail WCAG AA on the gray-50 footer (Phase 6.2
       axe found it with the old sky blue). The theme's primary-900 #1a4c68
       lands at ~8.8:1, passing both AA and AAA. Hover goes a touch darker so
       the focus state remains visibly distinct. */
    color: #1a4c68;
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-footer a:hover {
    color: #11415a;
    text-decoration: underline;
}

/* ==========================================================================
   The way back (UI-10)

   These pages have no site navbar. On a wide screen a bar is fixed over the
   top corners: the logo (to Home) on the left, three links on the right.
   `position: fixed` keeps it out of the flow, so it adds no height and a
   page that fitted the screen without a scrollbar still does. Only its
   links take clicks; the strip between them belongs to the page.

   Under 1024px the bar would meet the sign-up card (580px wide) when the
   page scrolls, so it goes, and each card shows `.auth-home`: a small link
   inside the header's own padding, which adds no height either.
   ========================================================================== */
.auth-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.5rem;
    pointer-events: none;
}

.auth-nav a {
    pointer-events: auto;
    text-decoration: none;
}

.auth-nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--gray-800);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.auth-nav__brand img {
    height: 2.5rem;
    width: auto;
}

.auth-nav__links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
}

.auth-nav__links a {
    padding: 0.375rem 0;
    color: var(--gray-600);
    transition: color var(--transition-fast);
}

.auth-nav__links a:hover {
    color: #20719c;
}

.auth-home {
    display: none;
}

@media (max-width: 1023px) {
    .auth-nav {
        display: none;
    }

    .auth-home {
        position: absolute;
        top: 0.625rem;
        left: 0.75rem;
        z-index: 1;
        display: inline-flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.25rem 0.5rem;
        border-radius: var(--auth-radius-sm);
        color: var(--gray-500);
        font-size: 0.8125rem;
        font-weight: 600;
        text-decoration: none;
    }

    .auth-home:hover {
        color: #20719c;
    }

    .auth-home i {
        font-size: 0.6875rem;
    }
}

/* ==========================================================================
   Responsive Design - Base
   ========================================================================== */
@media (max-width: 480px) {
    /* Stay vertically centred: the wrapper is min-height, so a card taller
       than the viewport simply grows it and the page scrolls — nothing clips. */
    .auth-wrapper {
        padding: 1rem;
    }

    .auth-card {
        border-radius: var(--auth-radius-lg);
    }

    .auth-header {
        padding: 2rem 1.5rem 1.5rem;
    }

    .auth-logo {
        width: 48px;
        height: 48px;
    }

    .auth-logo i {
        font-size: 1.25rem;
    }

    .auth-title {
        font-size: 1.375rem;
    }

    .auth-body {
        padding: 0.5rem 1.5rem 1.5rem;
    }

    .auth-footer {
        padding: 1.25rem 1.5rem;
    }
}
