

/* ---------- Design tokens ---------- */
:root {
    /* Brand */
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #6366f1;
    --accent: #8b5cf6;

    /* Surfaces (light) */
    --bg: #f8fafc;
    --surface: #ffffff;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-strong: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(15, 23, 42, 0.08);
    --card-shadow: rgba(15, 23, 42, 0.12);

    --text: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --hover: rgba(79, 70, 229, 0.06);

    /* Status */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Scale */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.dark-mode {
    --bg: #0f172a;
    --surface: #131c31;
    --glass: rgba(19, 28, 49, 0.72);
    --glass-strong: rgba(24, 34, 58, 0.92);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-shadow: rgba(0, 0, 0, 0.55);

    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #1e293b;
    --hover: rgba(139, 92, 246, 0.1);
}

/* ---------- Reset ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.35s ease, color 0.35s ease;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Ambient background mesh (subtle, not flashy) ---------- */
.bg-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.mesh-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.16;
}

.dark-mode .mesh-blob {
    opacity: 0.22;
}

.mesh-blob.b1 {
    width: 520px;
    height: 520px;
    top: -180px;
    left: -160px;
    background: var(--primary);
    animation: driftSlow 22s ease-in-out infinite;
}

.mesh-blob.b2 {
    width: 460px;
    height: 460px;
    bottom: -160px;
    right: -140px;
    background: var(--accent);
    animation: driftSlow 26s ease-in-out infinite reverse;
}

.mesh-blob.b3 {
    width: 360px;
    height: 360px;
    top: 40%;
    left: 46%;
    background: var(--secondary);
    opacity: 0.1;
    animation: driftSlow 30s ease-in-out infinite;
}

@keyframes driftSlow {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(40px, -30px); }
}

.mesh-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--glass-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.35;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
}

/* ---------- Shell (split screen) ---------- */
.auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 50% 50%;
    min-height: 100vh;
}

/* ---------- Left: illustration panel ---------- */
.auth-illustration {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) 60px;
    background: linear-gradient(160deg, var(--primary) 0%, var(--secondary) 55%, var(--accent) 130%);
    overflow: hidden;
}

.dark-mode .auth-illustration {
    background: linear-gradient(160deg, #211d55 0%, #1f2a52 55%, #2c2154 130%);
}

.illustration-content {
    position: relative;
    z-index: 1;
    max-width: 480px;
    width: 100%;
    color: #ffffff;
    animation: fadeSlideUp 0.7s var(--ease);
}

.brand-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.brand-logo-small {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px;
}

.brand-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.hero-illustration {
    width: 100%;
    height: auto;
    margin-bottom: var(--space-6);
    overflow: visible;
}

.illus-board-bg {
    fill: rgba(255, 255, 255, 0.08);
    stroke: rgba(255, 255, 255, 0.16);
}

.illus-col-bg {
    fill: rgba(255, 255, 255, 0.07);
}

.illus-card {
    fill: rgba(255, 255, 255, 0.92);
}

.illus-card-a { fill: #ffffff; }
.illus-card-b { fill: #c7d2fe; }
.illus-card-c { fill: #ddd6fe; }

.illus-chip-bg {
    fill: rgba(255, 255, 255, 0.95);
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.25));
}

.illus-chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.illus-chart-dot {
    fill: var(--accent);
}

.illus-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.5);
    stroke-width: 5;
}

.illus-ring-fg {
    fill: none;
    stroke: #ffffff;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 163;
    stroke-dashoffset: 55;
    transform-origin: 70px 30px;
    transform: rotate(-90deg);
}

.illus-avatar-1 { fill: #4f46e5; }
.illus-avatar-2 { fill: #8b5cf6; }
.illus-avatar-3 { fill: #6366f1; }

.illus-float {
    animation: floatChip 6s ease-in-out infinite;
}

.illus-chip-ring { animation-delay: 0.4s; }
.illus-chip-avatars { animation-delay: 0.9s; }

@keyframes floatChip {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.illustration-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-2);
}

.illustration-subtitle {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
    margin-bottom: var(--space-6);
    max-width: 420px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}

.feature-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    backdrop-filter: blur(6px);
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.feature-card i {
    font-size: 14px;
    width: 18px;
    text-align: center;
    opacity: 0.95;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Right: auth panel ---------- */
.auth-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) 40px;
    background: var(--bg);
}

.theme-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
    color: var(--text);
    z-index: 10;
}

.theme-toggle:hover {
    box-shadow: 0 6px 16px var(--card-shadow);
    transform: translateY(-1px);
}

.theme-toggle i {
    font-size: 16px;
}

/* ---------- Card ---------- */
.login-container {
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 60px var(--card-shadow);
    width: 100%;
    max-width: 450px;
    padding: 44px;
    position: relative;
    animation: fadeSlideUp 0.6s var(--ease);
}

/* ---------- Header ---------- */
.login-header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.company-logo {
    width: 100px;
    height: auto;
    margin-bottom: var(--space-3);
}

.login-header h1 {
    color: var(--text);
    font-size: 23px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-header h1 i {
    color: var(--primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ---------- Form / floating-label inputs ---------- */
.form-group {
    margin-bottom: var(--space-4);
}

.input-wrap {
    position: relative;
}

.input-wrap input {
    width: 100%;
    padding: 20px 15px 8px 42px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14.5px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.input-wrap.password-field input {
    padding-right: 44px;
}

.input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.input-wrap .input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
    transition: color 0.25s ease;
    pointer-events: none;
}

.input-wrap input:focus ~ .input-icon {
    color: var(--primary);
}

.input-wrap label {
    position: absolute;
    left: 42px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: all 0.2s ease;
    background: transparent;
}

.input-wrap input:focus ~ label,
.input-wrap input:not(:placeholder-shown) ~ label {
    top: 11px;
    left: 42px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--primary);
    transform: translateY(0);
}

.password-toggle-icon {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 15px;
    transition: color 0.25s ease;
}

.password-toggle-icon:hover {
    color: var(--primary);
}

/* Hide native browser password reveal/autofill icons */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none;
}

input::-webkit-credentials-auto-fill-button,
input::-webkit-strong-password-auto-fill-button {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
    position: absolute;
    right: 0;
}

/* ---------- Buttons ---------- */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--space-6);
}

.form-actions button,
.btn {
    flex: 1;
    padding: 13px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.25s ease, opacity 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.4);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Ripple */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleAnim {
    to { transform: scale(3); opacity: 0; }
}

/* ---------- Alerts ---------- */
.alert {
    max-height: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.alert.show {
    padding: 12px 15px;
    max-height: 100px;
    margin-bottom: var(--space-4);
    opacity: 1;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.22);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.24);
}

/* ---------- Loading ---------- */
.loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-top: var(--space-3);
}

.loading.show {
    display: flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2.5px solid rgba(79, 70, 229, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- Security strip (footer of card) ---------- */
.security-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--glass-border);
}

.security-strip span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.security-strip i {
    color: var(--success);
    font-size: 11px;
}

.auth-footer {
    margin-top: var(--space-6);
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
    .auth-shell {
        grid-template-columns: 50% 50%;
    }

    .feature-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-illustration {
        display: none;
    }

    .auth-panel {
        padding: 48px 24px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 28px 20px;
        border-radius: var(--radius-lg);
    }

    .theme-toggle {
        top: 16px;
        right: 16px;
    }
}