/* ==========================================================================
   Airtable-Inspired Design System for Upkeep Helpdesk Auth Pages
   Tokens & specs derived directly from DESIGN.md
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;475;500;600&display=swap');

:root {
    /* Brand & Accent Tokens */
    --at-primary: #181d26;
    --at-primary-active: #0d1218;
    --at-ink: #181d26;
    --at-body: #333840;
    --at-muted: #6b7280;
    --at-muted-subtle: #8a94a6;
    --at-hairline: #dddddd;
    --at-border-strong: #9297a0;

    /* Surfaces */
    --at-canvas: #ffffff;
    --at-surface-soft: #f8fafc;
    --at-surface-strong: #e0e2e6;
    --at-surface-dark: #181d26;
    --at-surface-dark-elevated: #1d1f25;

    /* Signature Colors (Brand Voltage) */
    --at-sig-coral: #aa2d00;
    --at-sig-coral-dark: #8c2500;
    --at-sig-forest: #0a2e0e;
    --at-sig-forest-dark: #071f09;
    --at-sig-cream: #f5e9d4;
    --at-sig-peach: #fcab79;
    --at-sig-mint: #a8d8c4;
    --at-sig-yellow: #f4d35e;
    --at-sig-mustard: #d9a441;

    /* Semantic */
    --at-link: #1b61c9;
    --at-link-active: #1a3866;
    --at-info: #254fad;
    --at-info-border: #458fff;
    --at-success: #006400;
    --at-success-border: #39bf45;
    --at-danger: #b91c1c;
    --at-danger-border: #f87171;

    /* Typography */
    --at-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

    /* Border Radii */
    --at-radius-xs: 2px;
    --at-radius-sm: 6px;
    --at-radius-md: 10px;
    --at-radius-lg: 12px;
    --at-radius-pill: 9999px;
    --at-radius-full: 9999px;

    /* Spacing */
    --at-spacing-xs: 8px;
    --at-spacing-sm: 12px;
    --at-spacing-md: 16px;
    --at-spacing-lg: 24px;
    --at-spacing-xl: 32px;
    --at-spacing-xxl: 48px;
}

/* Base Reset & Page Wrapper */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: var(--at-font);
    background-color: var(--at-surface-soft);
    color: var(--at-body);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fullscreen Auth Shell */
.at-auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.at-auth-container {
    width: 100%;
    max-width: 1080px;
    min-height: 640px;
    background: var(--at-canvas);
    border-radius: var(--at-radius-lg);
    border: 1px solid var(--at-hairline);
    box-shadow: 0 4px 24px rgba(24, 29, 38, 0.06), 0 1px 3px rgba(24, 29, 38, 0.04);
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}

/* ==========================================================================
   LEFT SIDE: Editorial Signature Brand Panel
   ========================================================================== */
.at-brand-panel {
    padding: var(--at-spacing-xxl);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    color: #ffffff;
    transition: background-color 0.3s ease;
}

/* Color Themes */
.at-brand-panel.theme-coral {
    background-color: var(--at-sig-coral);
}
.at-brand-panel.theme-dark {
    background-color: var(--at-surface-dark);
}
.at-brand-panel.theme-forest {
    background-color: var(--at-sig-forest);
}

.at-brand-top {
    position: relative;
    z-index: 2;
}

.at-brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--at-radius-pill);
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: #ffffff;
    margin-bottom: 28px;
    text-transform: uppercase;
}

.at-brand-pill i {
    font-size: 14px;
}

.at-brand-title {
    font-size: 32px;
    font-weight: 475;
    line-height: 1.2;
    margin: 0 0 16px 0;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.at-brand-subtitle {
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 32px 0;
    color: rgba(255, 255, 255, 0.88);
    font-weight: 400;
}

/* Demo Fragment Grid Cards (Airtable-style multi-card cluster) */
.at-fragment-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.at-fragment-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--at-radius-md);
    padding: 16px;
    color: var(--at-ink);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.at-fragment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.16);
}

.at-fragment-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--at-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.at-fragment-icon.c-mint {
    background-color: var(--at-sig-mint);
    color: #0b3d2c;
}

.at-fragment-icon.c-peach {
    background-color: var(--at-sig-peach);
    color: #6d2402;
}

.at-fragment-icon.c-cream {
    background-color: var(--at-sig-cream);
    color: #4f3b14;
}

.at-fragment-icon.c-yellow {
    background-color: var(--at-sig-yellow);
    color: #5c4404;
}

.at-fragment-info {
    flex: 1;
    min-width: 0;
}

.at-fragment-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--at-ink);
    margin-bottom: 2px;
}

.at-fragment-desc {
    font-size: 12px;
    color: var(--at-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.at-brand-footer {
    position: relative;
    z-index: 2;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.at-brand-footer span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Subtle background geometry decoration (editorial pattern) */
.at-brand-panel::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: -60px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

/* ==========================================================================
   RIGHT SIDE: Editorial Form Canvas
   ========================================================================== */
.at-form-panel {
    background: var(--at-canvas);
    padding: var(--at-spacing-xxl);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.at-form-header {
    margin-bottom: 28px;
}

.at-logo-wrapper {
    display: inline-flex;
    align-items: center;
    margin-bottom: 28px;
    text-decoration: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.at-logo-wrapper:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.at-logo-img {
    height: 44px;
    max-width: 260px;
    width: auto;
    object-fit: contain;
    display: block;
}

/* Contrast enhancement for monochrome white brand logos on light canvas */
.at-logo-img.is-white-logo {
    filter: brightness(0.12);
}

[data-bs-theme="dark"] .at-logo-img.is-white-logo {
    filter: none;
}

.at-form-title {
    font-size: 24px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--at-ink);
    margin: 0 0 8px 0;
    letter-spacing: -0.01em;
}

.at-form-subtitle {
    font-size: 14px;
    line-height: 1.45;
    color: var(--at-muted);
    margin: 0;
    font-weight: 400;
}

/* Form Groups & Inputs */
.at-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.at-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.at-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--at-ink);
}

.at-input-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

.at-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--at-muted-subtle);
    font-size: 17px;
    pointer-events: none;
    z-index: 2;
    transition: color 0.15s ease;
}

.at-input {
    width: 100%;
    height: 44px;
    padding: 10px 14px 10px 42px;
    background: var(--at-canvas);
    border: 1px solid var(--at-hairline);
    border-radius: var(--at-radius-sm);
    font-family: var(--at-font);
    font-size: 14px;
    color: var(--at-ink);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.at-input::placeholder {
    color: var(--at-muted-subtle);
    font-weight: 400;
}

.at-input:focus {
    border-color: var(--at-info-border);
    box-shadow: 0 0 0 3px rgba(69, 143, 255, 0.18);
}

.at-input-wrapper:focus-within .at-input-icon {
    color: var(--at-info);
}

/* Password Toggle Icon Button */
.at-btn-toggle-pw {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    height: 32px;
    width: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--at-radius-sm);
    color: var(--at-muted);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
    z-index: 2;
}

.at-btn-toggle-pw:hover {
    background-color: var(--at-surface-soft);
    color: var(--at-ink);
}

.at-input.has-toggle {
    padding-right: 42px;
}

/* Secondary Actions / Links */
.at-form-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: -4px;
}

.at-link {
    color: var(--at-link);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.15s ease;
}

.at-link:hover,
.at-link:active {
    color: var(--at-link-active);
    text-decoration: underline;
}

/* Primary CTA Button (Airtable Signature Pill/Soft-Corner) */
.at-btn-primary {
    width: 100%;
    height: 48px;
    background-color: var(--at-primary);
    color: #ffffff;
    border: 1px solid var(--at-primary);
    border-radius: var(--at-radius-lg);
    font-family: var(--at-font);
    font-size: 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
    box-shadow: 0 1px 2px rgba(24, 29, 38, 0.12);
    margin-top: 10px;
    text-decoration: none;
}

.at-btn-primary:hover {
    background-color: var(--at-primary-active);
    border-color: var(--at-primary-active);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(24, 29, 38, 0.20);
}

.at-btn-primary:active {
    transform: scale(0.99);
}

.at-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

/* Auxiliary Footers */
.at-form-footer {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--at-hairline);
    text-align: center;
    font-size: 12.5px;
    color: var(--at-muted);
}

.at-form-footer a {
    color: var(--at-muted);
    text-decoration: none;
}

.at-form-footer a:hover {
    color: var(--at-ink);
    text-decoration: underline;
}

/* Form Helper Texts & Live Validation */
.at-hint {
    font-size: 12px;
    color: var(--at-muted);
    margin-top: 2px;
}

.at-hint.text-success {
    color: var(--at-success) !important;
    font-weight: 500;
}

.at-hint.text-danger {
    color: var(--at-danger) !important;
    font-weight: 500;
}

/* Toast Banners (Clean Editorial Alert Banners) */
.at-toast-banner {
    padding: 12px 16px;
    border-radius: var(--at-radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

.at-toast-banner.toast-success {
    background-color: #eaf6ec;
    border: 1px solid var(--at-success-border);
    color: var(--at-success);
}

.at-toast-banner.toast-danger {
    background-color: #fef2f2;
    border: 1px solid var(--at-danger-border);
    color: var(--at-danger);
}

.at-toast-banner.toast-warning {
    background-color: #fffbeb;
    border: 1px solid var(--at-sig-yellow);
    color: #92400e;
}

/* ==========================================================================
   RESPONSIVE BEHAVIOR (Per DESIGN.md Responsive Spec)
   ========================================================================== */
@media (max-width: 960px) {
    .at-auth-wrapper {
        padding: 16px;
    }

    .at-auth-container {
        grid-template-columns: 1fr;
        max-width: 520px;
        min-height: auto;
    }

    .at-brand-panel {
        padding: 32px 24px;
    }

    .at-brand-title {
        font-size: 24px;
    }

    .at-brand-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .at-fragment-grid {
        display: none; /* Hide dense demo cards on mobile for vertical efficiency */
    }

    .at-brand-footer {
        display: none;
    }

    .at-form-panel {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .at-auth-wrapper {
        padding: 8px;
    }

    .at-auth-container {
        border-radius: var(--at-radius-md);
    }

    .at-brand-panel {
        padding: 24px 20px;
    }

    .at-form-panel {
        padding: 24px 20px;
    }

    .at-form-title {
        font-size: 20px;
    }
}
