/* AIAS Sign-In System — Premium Dark Mode CSS */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

:root {
    --bg-primary: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-input-focus: #fcfcfc;
    --accent-primary: #c5a059;
    --accent-gradient: #c5a059;
    --accent-gradient-hover: #b89146;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-muted: #888888;
    --border-color: #eaeaea;
    --border-focus: #c5a059;
    --error-color: #ef4444;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --card-width: 440px;
    --card-padding: 40px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-xs: 6px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --shadow-card: none;
    --shadow-button: 0 4px 15px rgba(197, 160, 89, 0.2);
}

html.dark-theme, html:not(.light-theme) {
    /* Dynamic theme */
}

@media (prefers-color-scheme: dark) {
    :root:not(.light-theme) {
        --bg-primary: #0A0A0A;
        --bg-card: #141414;
        --bg-input: #1a1a1a;
        --bg-input-focus: #2a2a2a;
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
        --text-muted: #646464;
        --border-color: #333333;
        --border-focus: #555555;
    }
}
:root.dark-theme {
        --bg-primary: #0a0a0a;
        --bg-card: #141414;
        --bg-input: #1a1a1a;
        --bg-input-focus: #242424;
        --text-primary: #ffffff;
        --text-secondary: #a0a0a0;
        --text-muted: #777777;
        --border-color: #333333;
    }

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.auth-background { display: none; }

.auth-container {
    position: relative; z-index: 1; display: flex; align-items: center;
    justify-content: center; min-height: 100vh; padding: 40px 20px;
}
.auth-card {
    width: var(--card-width); max-width: 100%; background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--card-padding); position: relative; overflow: hidden;
    animation: cardEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-header { text-align: center; margin-bottom: 36px; }
.auth-logo {
    width: 56px; height: 56px; background: var(--accent-gradient); border-radius: 16px;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 20px;
    font-size: 24px; font-weight: 800; color: white;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3); position: relative;
}
.auth-logo::after {
    content: ''; position: absolute; inset: -2px; border-radius: 18px;
    background: var(--accent-gradient); z-index: -1; opacity: 0.4; filter: blur(8px);
}
.auth-title { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 8px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.auth-form { display: flex; flex-direction: column; gap: 20px; }
.input-group { position: relative; }
.input-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 8px; }
.input-wrapper { position: relative; display: flex; align-items: center; }
.input-wrapper .input-icon { position: absolute; left: 16px; font-size: 16px; color: var(--text-muted); transition: color var(--transition-normal); pointer-events: none; z-index: 2; }
.input-wrapper input {
    width: 100%; padding: 14px 16px 14px 46px; background: var(--bg-input);
    border: 1px solid var(--border-color); border-radius: var(--border-radius-sm);
    color: var(--text-primary); font-family: inherit; font-size: 15px; outline: none;
    transition: all var(--transition-normal);
}
.input-wrapper input:focus { background: var(--bg-input-focus); border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); }
.input-wrapper input:focus ~ .input-icon { color: var(--accent-primary); }
.input-wrapper input::placeholder { color: var(--text-muted); }

.password-toggle {
    position: absolute; right: 14px; background: none; border: none;
    color: var(--text-muted); cursor: pointer; padding: 4px; font-size: 16px;
    transition: color var(--transition-fast); z-index: 2;
}
.password-toggle:hover { color: var(--text-secondary); }

.btn-primary {
    width: 100%; padding: 15px; background: var(--accent-gradient); border: none;
    border-radius: var(--border-radius-sm); color: white; font-family: inherit;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all var(--transition-normal);
    box-shadow: var(--shadow-button); position: relative; overflow: hidden;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-gradient-hover); box-shadow: 0 6px 30px rgba(102, 126, 234, 0.45); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary .spinner { display: none; width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto; }
.btn-primary.loading .btn-text { display: none; }
.btn-primary.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn-google {
    width: 100%; padding: 13px; background: var(--bg-primary);
    border: 1px solid var(--border-color); border-radius: var(--border-radius-sm);
    color: var(--text-primary); font-family: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: all var(--transition-normal);
}
.btn-google:hover { background: var(--bg-input); transform: translateY(-1px); border-color: #d1d1d1; }
.btn-google svg { width: 18px; height: 18px; }

.divider { display: flex; align-items: center; gap: 16px; margin: 4px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }
.divider span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500; }

.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
    padding: 14px 20px; border-radius: var(--border-radius-xs); font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px; min-width: 300px; max-width: 440px;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1); backdrop-filter: blur(20px); border: 1px solid;
}
.toast.error { background: rgba(255,71,87,0.1); color: var(--error-color); border-color: rgba(255,71,87,0.2); }
.toast.success { background: rgba(46,213,115,0.1); color: var(--success-color); border-color: rgba(46,213,115,0.2); }
.toast.warning { background: rgba(255,165,2,0.1); color: var(--warning-color); border-color: rgba(255,165,2,0.2); }
.toast.info { background: rgba(52,152,219,0.1); color: var(--info-color); border-color: rgba(52,152,219,0.2); }
.toast-exit { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

.otp-container { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.otp-input {
    width: 54px; height: 64px; text-align: center;
    font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 600;
    color: var(--text-primary); background: var(--bg-input);
    border: 1.5px solid var(--border-color); border-radius: var(--border-radius-xs);
    outline: none; transition: all var(--transition-normal);
}
.otp-input:focus { border-color: var(--accent-primary); background: var(--bg-input-focus); box-shadow: 0 0 0 3px rgba(102,126,234,0.15); transform: scale(1.05); }
.otp-input.filled { border-color: var(--accent-primary); background: rgba(102,126,234,0.08); }
.otp-input.error { border-color: var(--error-color); animation: shake 0.4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-6px)} 40%{transform:translateX(6px)} 60%{transform:translateX(-4px)} 80%{transform:translateX(4px)} }

.otp-timer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.otp-timer .time { color: var(--accent-primary); font-weight: 600; font-family: 'JetBrains Mono', monospace; }
.otp-timer .time.expiring { color: var(--error-color); animation: pulse 1s ease infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.resend-link { text-align: center; margin-top: 12px; }
.resend-link button { background: none; border: none; color: var(--accent-primary); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: underline; transition: color var(--transition-fast); }
.resend-link button:hover { color: #7b93ff; }
.resend-link button:disabled { color: var(--text-muted); cursor: not-allowed; text-decoration: none; }

.auth-footer { text-align: center; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border-color); }
.auth-footer p { font-size: 14px; color: var(--text-secondary); }
.auth-footer a { color: var(--accent-primary); text-decoration: none; font-weight: 500; transition: color var(--transition-fast); }
.auth-footer a:hover { color: #7b93ff; text-decoration: underline; }

.forgot-password-link { text-align: right; margin-top: -12px; margin-bottom: -8px; }
.forgot-password-link a { font-size: 13px; color: var(--accent-primary); text-decoration: none; font-weight: 500; transition: color var(--transition-fast); }
.forgot-password-link a:hover { color: #7b93ff; text-decoration: underline; }

.password-strength { margin-top: 8px; }
.strength-bar { height: 4px; border-radius: 2px; background: var(--bg-input); overflow: hidden; margin-bottom: 6px; }
.strength-fill { height: 100%; border-radius: 2px; transition: width var(--transition-normal), background var(--transition-normal); width: 0; }
.strength-fill.weak { width: 25%; background: var(--error-color); }
.strength-fill.fair { width: 50%; background: var(--warning-color); }
.strength-fill.good { width: 75%; background: #f39c12; }
.strength-fill.strong { width: 100%; background: var(--success-color); }
.strength-text { font-size: 12px; font-weight: 500; }
.strength-text.weak { color: var(--error-color); }
.strength-text.fair { color: var(--warning-color); }
.strength-text.good { color: #f39c12; }
.strength-text.strong { color: var(--success-color); }

.field-error { font-size: 12px; color: var(--error-color); margin-top: 6px; display: none; animation: fadeIn 0.2s ease; }
.field-error.visible { display: block; }

.dashboard-container { text-align: center; padding: 60px 20px; }
.dashboard-avatar { width: 80px; height: 80px; background: var(--accent-gradient); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; font-size: 32px; font-weight: 700; color: white; }
.dashboard-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.dashboard-email { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }
.btn-signout { display: inline-flex; align-items: center; gap: 8px; padding: 12px 28px; background: rgba(255,71,87,0.1); border: 1px solid rgba(255,71,87,0.2); border-radius: var(--border-radius-xs); color: var(--error-color); font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; transition: all var(--transition-normal); }
.btn-signout:hover { background: rgba(255,71,87,0.18); transform: translateY(-1px); }

.back-button { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--text-secondary); font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer; padding: 0; margin-bottom: 20px; transition: color var(--transition-fast); }
.back-button:hover { color: var(--text-primary); }

@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }

@media (max-width: 480px) {
    :root { --card-padding: 28px; --card-width: 100%; }
    .auth-container { padding: 20px 16px; align-items: flex-start; padding-top: 60px; }
    .auth-title { font-size: 22px; }
    .otp-input { width: 46px; height: 56px; font-size: 20px; }
    .otp-container { gap: 6px; }
    .toast { min-width: unset; max-width: calc(100vw - 48px); }
}

/* ==========================================================
   Split Layout specific for Auth Pages
========================================================== */
.split-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Left Side: Information & Marketing */
.split-info {
    flex: 1;
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    position: relative;
    z-index: 2;
}

.info-content {
    max-width: 540px;
    width: 100%;
}

.info-eyebrow {
    font-family: 'Inter', sans-serif;
    color: #c5a059;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.info-eyebrow::before {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background-color: #c5a059;
}

.info-heading {
    font-family: 'Playfair Display', serif;
    color: var(--text-primary);
    font-size: 56px;
    line-height: 1.1;
    font-weight: 500;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

.info-subtext {
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 48px;
}

.info-features {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 48px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 16px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: default;
}

.feature-item:hover {
    transform: translateX(10px);
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(197, 160, 89, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c5a059;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.feature-item:hover .feature-icon {
    background: #c5a059;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(197, 160, 89, 0.35);
    transform: scale(1.1);
}

.feature-icon svg {
    width: 22px;
    height: 22px;
}

.info-footer {
    padding-top: 32px;
    border-top: 1px solid var(--border-color);
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    color: var(--text-primary);
    font-style: italic;
    opacity: 0.8;
}

/* Right Side: Auth Form Container */
.split-auth {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (max-width: 1024px) {
    .split-layout {
        max-width: 100%;
        padding: 0 20px;
    }
    .split-info {
        padding: 40px;
    }
    .info-heading {
        font-size: 42px;
    }
}

@media (max-width: 900px) {
    .split-info {
        display: none;
    }
    .split-layout {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    .split-auth {
        width: 100%;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Animations for text rotation */
@keyframes rubberBand {
  from {
    transform: scale3d(1, 1, 1);
  }
  30% {
    transform: scale3d(1.25, 0.75, 1);
  }
  40% {
    transform: scale3d(0.75, 1.25, 1);
  }
  50% {
    transform: scale3d(1.15, 0.85, 1);
  }
  65% {
    transform: scale3d(0.95, 1.05, 1);
  }
  75% {
    transform: scale3d(1.05, 0.95, 1);
  }
  to {
    transform: scale3d(1, 1, 1);
  }
}
.animate__rubberBand {
  animation: rubberBand 1s both;
}

/* Floating Close / Escape Button */
.close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
    text-decoration: none;
    overflow: hidden;
}
.close-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(197, 160, 89, 0.15), transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.close-btn:hover {
    background: var(--border-color);
    color: var(--accent-primary);
    transform: scale(1.12);
    border-color: rgba(197, 160, 89, 0.4);
    box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.08), 0 6px 20px rgba(0, 0, 0, 0.1);
}
.close-btn:hover::before {
    opacity: 1;
    transform: scale(1.6);
}
.close-btn svg {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
}
.close-btn:hover svg {
    transform: rotate(90deg);
}
.close-btn:active {
    transform: scale(0.92);
    transition: transform 0.08s ease;
}
