/* login.css - Extracted from login.html for maintainability */

:root {
    --landing-bg: #f9fafb;
    --landing-surface: #ffffff;
    --landing-surface-hover: #f0f0f0;
    --landing-border: #e5e7eb;
    --landing-text: #1f2937;
    --landing-text-muted: #6b7280;
    --landing-accent: #3b82f6;
    --landing-accent-hover: #2563eb;
    --landing-accent-glow: rgba(59, 130, 246, 0.15);
    --landing-gc-accent: #8b5cf6;
    --landing-gc-accent-hover: #7c3aed;
    --landing-gc-glow: rgba(139, 92, 246, 0.15);
}

/* Light mode overrides for login page */
body.light-mode {
    --landing-bg: #ffffff;
    --landing-surface: #fafafa;
    --landing-surface-hover: #f0f0f0;
    --landing-border: #d9d9d9;
    --landing-text: #000000;
    --landing-text-muted: #595959;
}
body.light-mode .portal-card h3,
body.light-mode .login-panel-header h3 { color: #000; }
body.light-mode .portal-card:hover { border-color: #bfbfbf; }
body.light-mode .back-link:hover { color: #000; }
body.light-mode body::before { background: none; }

* { box-sizing: border-box; }

body {
    background: var(--landing-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--landing-text);
    overflow-x: hidden;
}

/* Subtle background mesh */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 15%, rgba(255, 80, 30, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.landing-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 920px;
}

/* ── 3D Banner Container ── */
.banner-scene {
    perspective: 1200px;
    text-align: center;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease forwards;
    position: relative;
    overflow: visible;
}

/* ── Moving Background Elements ── */
.banner-backdrop {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 720px;
    height: 400px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

/* Skyline silhouettes - rising buildings */
.skyline {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 360px;
    height: 120px;
    opacity: 0.06;
    filter: blur(1px);
}

.building {
    position: absolute;
    bottom: 0;
    background: linear-gradient(to top, rgba(255, 100, 50, 0.6), rgba(255, 100, 50, 0.1));
    border-radius: 2px 2px 0 0;
    animation: buildingRise 8s ease-in-out infinite;
}

.building:nth-child(1) { left: 5%; width: 18px; height: 55px; animation-delay: 0s; }
.building:nth-child(2) { left: 15%; width: 24px; height: 80px; animation-delay: -1.5s; }
.building:nth-child(3) { left: 27%; width: 16px; height: 65px; animation-delay: -3s; }
.building:nth-child(4) { left: 38%; width: 30px; height: 95px; animation-delay: -0.8s; }
.building:nth-child(5) { left: 52%; width: 20px; height: 70px; animation-delay: -4.5s; }
.building:nth-child(6) { left: 64%; width: 26px; height: 85px; animation-delay: -2.2s; }
.building:nth-child(7) { left: 76%; width: 14px; height: 50px; animation-delay: -5.5s; }
.building:nth-child(8) { left: 87%; width: 22px; height: 75px; animation-delay: -3.8s; }

.building::after {
    content: '';
    position: absolute;
    top: 8px; left: 3px; right: 3px; bottom: 8px;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255, 200, 100, 0.15) 0px,
        rgba(255, 200, 100, 0.15) 2px,
        transparent 2px,
        transparent 6px
    );
}

@keyframes buildingRise {
    0%, 100% { transform: translateY(8px); opacity: 0.5; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* Moving chain links */
.chain-group {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.chain-link {
    position: absolute;
    width: 6px;
    height: 14px;
    border: 2px solid rgba(255, 140, 50, 0.15);
    border-radius: 3px;
    animation: chainDrop 6s linear infinite;
}

.chain-link:nth-child(1) { left: 8%; animation-delay: 0s; animation-duration: 7s; }
.chain-link:nth-child(2) { left: 22%; animation-delay: -2s; animation-duration: 5.5s; }
.chain-link:nth-child(3) { left: 78%; animation-delay: -4s; animation-duration: 6.5s; }
.chain-link:nth-child(4) { left: 92%; animation-delay: -1s; animation-duration: 8s; }

@keyframes chainDrop {
    0% { top: -10%; opacity: 0; transform: rotate(0deg); }
    10% { opacity: 0.6; }
    90% { opacity: 0.6; }
    100% { top: 110%; opacity: 0; transform: rotate(20deg); }
}

/* ── Pulsing Glow ── */
.banner-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 500px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 80, 30, 0.2) 0%,
        rgba(255, 120, 50, 0.1) 30%,
        rgba(255, 60, 20, 0.05) 50%,
        transparent 70%
    );
    animation: glowPulse 4s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
    will-change: transform, opacity;
}

.banner-glow-secondary {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 600px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(255, 160, 60, 0.08) 0%,
        rgba(255, 100, 30, 0.04) 40%,
        transparent 65%
    );
    animation: glowPulse 4s ease-in-out 2s infinite;
    z-index: 1;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes glowPulse {
    0%, 100% { transform: translate(-50%, -55%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -55%) scale(1.15); opacity: 1; }
}

/* ── 3D Logo Container ── */
.logo-3d-wrapper {
    position: relative;
    display: inline-block;
    z-index: 2;
    will-change: transform;
    animation: logoFloat 6s ease-in-out infinite;
    transform-style: preserve-3d;
}

.logo-3d-inner {
    transform-style: preserve-3d;
    animation: logoTilt 12s ease-in-out infinite;
    will-change: transform;
}

.banner-video {
    width: 100%;
    max-width: 720px;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 16px;
    object-fit: cover;
    filter: drop-shadow(0 8px 32px rgba(255, 80, 30, 0.3))
            drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
    transition: filter 0.3s ease;
    will-change: filter;
}

.logo-3d-wrapper:hover .banner-video {
    filter: drop-shadow(0 12px 40px rgba(255, 80, 30, 0.45))
            drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

/* Reflection effect beneath logo */
.logo-reflection {
    width: 400px;
    height: 60px;
    margin: 0 auto;
    background: linear-gradient(to bottom, rgba(255, 100, 40, 0.08), transparent);
    border-radius: 50%;
    filter: blur(12px);
    animation: reflectionPulse 6s ease-in-out infinite;
    will-change: opacity, transform;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    25% { transform: translateY(-8px); }
    50% { transform: translateY(-4px); }
    75% { transform: translateY(-10px); }
}

@keyframes logoTilt {
    0%, 100% { transform: rotateY(-2deg) rotateX(1deg); }
    25% { transform: rotateY(3deg) rotateX(-1deg); }
    50% { transform: rotateY(-1deg) rotateX(2deg); }
    75% { transform: rotateY(2deg) rotateX(-2deg); }
}

@keyframes reflectionPulse {
    0%, 100% { opacity: 0.5; transform: scaleX(0.9); }
    50% { opacity: 0.8; transform: scaleX(1.1); }
}

/* ── Spark / Particle Effects ── */
.sparks-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    overflow: visible;
}

.spark {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #ff8c32;
    box-shadow: 0 0 6px 1px rgba(255, 140, 50, 0.6),
                0 0 12px 2px rgba(255, 80, 30, 0.3);
    animation: sparkFloat 3s ease-in-out infinite;
    will-change: transform, opacity;
}

.spark:nth-child(1) {
    top: 15%; left: 18%;
    animation-delay: 0s;
    animation-duration: 3.2s;
}
.spark:nth-child(2) {
    top: 25%; left: 80%;
    width: 2px; height: 2px;
    animation-delay: -0.8s;
    animation-duration: 2.8s;
}
.spark:nth-child(3) {
    top: 60%; left: 12%;
    width: 4px; height: 4px;
    animation-delay: -1.6s;
    animation-duration: 3.5s;
    background: #ffaa44;
}
.spark:nth-child(4) {
    top: 70%; left: 85%;
    animation-delay: -2.4s;
    animation-duration: 2.5s;
}
.spark:nth-child(5) {
    top: 10%; left: 50%;
    width: 2px; height: 2px;
    animation-delay: -0.5s;
    animation-duration: 4s;
    background: #ffcc66;
}
.spark:nth-child(6) {
    top: 45%; left: 5%;
    width: 2px; height: 2px;
    animation-delay: -3s;
    animation-duration: 3s;
}
.spark:nth-child(7) {
    top: 50%; left: 95%;
    animation-delay: -1.2s;
    animation-duration: 3.8s;
    background: #ff6622;
}
.spark:nth-child(8) {
    top: 80%; left: 40%;
    width: 2px; height: 2px;
    animation-delay: -2s;
    animation-duration: 2.6s;
}
.spark:nth-child(9) {
    top: 35%; left: 30%;
    width: 3px; height: 3px;
    animation-delay: -0.3s;
    animation-duration: 3.3s;
    background: #ffaa44;
}
.spark:nth-child(10) {
    top: 55%; left: 70%;
    width: 2px; height: 2px;
    animation-delay: -1.8s;
    animation-duration: 4.2s;
}
.spark:nth-child(11) {
    top: 20%; left: 62%;
    width: 4px; height: 4px;
    animation-delay: -2.8s;
    animation-duration: 3.6s;
    background: #ff6622;
}
.spark:nth-child(12) {
    top: 75%; left: 25%;
    animation-delay: -0.9s;
    animation-duration: 2.9s;
}

/* Spark trail variant */
.spark-trail {
    position: absolute;
    width: 2px;
    height: 16px;
    border-radius: 1px;
    background: linear-gradient(to bottom, rgba(255, 140, 50, 0.8), transparent);
    animation: sparkTrailFall 2.5s linear infinite;
    will-change: transform, opacity;
}

.spark-trail:nth-child(13) { left: 15%; animation-delay: 0s; animation-duration: 3s; }
.spark-trail:nth-child(14) { left: 35%; animation-delay: -1.2s; animation-duration: 2.2s; }
.spark-trail:nth-child(15) { left: 65%; animation-delay: -0.6s; animation-duration: 2.8s; }
.spark-trail:nth-child(16) { left: 85%; animation-delay: -2s; animation-duration: 2.5s; }

@keyframes sparkFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(6px, -12px) scale(1.3);
        opacity: 1;
    }
    50% {
        transform: translate(-4px, -6px) scale(0.8);
        opacity: 0.6;
    }
    75% {
        transform: translate(8px, -14px) scale(1.1);
        opacity: 0.9;
    }
}

@keyframes sparkTrailFall {
    0% { top: -8%; opacity: 0; transform: scaleY(0.5); }
    15% { opacity: 0.7; transform: scaleY(1); }
    85% { opacity: 0.5; }
    100% { top: 105%; opacity: 0; transform: scaleY(0.3); }
}

/* ── Subtitle Text ── */
.banner-subtitle {
    position: relative;
    z-index: 2;
    font-size: 1.05rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin: 0.5rem 0 0;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(255, 120, 50, 0.3),
                 0 0 40px rgba(255, 80, 30, 0.15);
    animation: subtitleGlow 4s ease-in-out infinite;
    will-change: text-shadow;
}

@keyframes subtitleGlow {
    0%, 100% {
        text-shadow: 0 0 20px rgba(255, 120, 50, 0.2),
                     0 0 40px rgba(255, 80, 30, 0.1);
        color: rgba(255, 255, 255, 0.65);
    }
    50% {
        text-shadow: 0 0 30px rgba(255, 120, 50, 0.4),
                     0 0 60px rgba(255, 80, 30, 0.2);
        color: rgba(255, 255, 255, 0.85);
    }
}

/* ── Horizontal Accent Line ── */
.banner-divider {
    position: relative;
    z-index: 2;
    width: 120px;
    height: 2px;
    margin: 1rem auto 0;
    background: linear-gradient(90deg, transparent, rgba(255, 100, 40, 0.5), transparent);
    border-radius: 1px;
    animation: dividerShimmer 3s ease-in-out infinite;
}

@keyframes dividerShimmer {
    0%, 100% { opacity: 0.4; width: 100px; }
    50% { opacity: 0.8; width: 140px; }
}

/* ── Reduce motion for accessibility ── */
@media (prefers-reduced-motion: reduce) {
    .logo-3d-wrapper,
    .logo-3d-inner,
    .banner-video,
    .spark,
    .spark-trail,
    .chain-link,
    .building,
    .banner-glow,
    .banner-glow-secondary,
    .logo-reflection,
    .banner-subtitle,
    .banner-divider {
        animation: none !important;
    }
    .banner-scene {
        animation: fadeUp 0.6s ease forwards !important;
    }
}

/* ── Portal Cards Grid ── */
.portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .portal-grid { grid-template-columns: 1fr; }
}

/* ── Card Base ── */
.portal-card {
    background: var(--landing-surface);
    border: 1px solid var(--landing-border);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

.portal-card:nth-child(1) { animation: fadeUp 0.6s ease 0.15s forwards; }
.portal-card:nth-child(2) { animation: fadeUp 0.6s ease 0.3s forwards; }

.portal-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portal-card.mechanic-card::before {
    background: linear-gradient(90deg, var(--landing-accent), transparent);
}

.portal-card.gc-card::before {
    background: linear-gradient(90deg, var(--landing-gc-accent), transparent);
}

.portal-card:hover {
    background: var(--landing-surface-hover);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.portal-card:hover::before {
    opacity: 1;
}

.portal-card .card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.mechanic-card .card-icon {
    background: var(--landing-accent-glow);
    color: var(--landing-accent);
}

.gc-card .card-icon {
    background: var(--landing-gc-glow);
    color: var(--landing-gc-accent);
}

.portal-card .card-icon i { font-size: 1.4rem; }

.portal-card h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 0.5rem;
}

.portal-card p {
    font-size: 0.9rem;
    color: var(--landing-text-muted);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.portal-card .card-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: gap 0.2s ease;
}

.mechanic-card .card-cta { color: var(--landing-accent); }
.gc-card .card-cta { color: var(--landing-gc-accent); }

.portal-card:hover .card-cta { gap: 0.75rem; }

/* ── Login Form Views ── */
.login-view {
    display: none;
    max-width: 460px;
    margin: 0 auto;
    width: 100%;
}

.login-view.active {
    display: block;
    animation: fadeUp 0.4s ease forwards;
}

.login-panel {
    background: var(--landing-surface);
    border: 1px solid var(--landing-border);
    border-radius: 16px;
    padding: 2rem;
}

.login-panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.login-panel-header .panel-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mechanic-view .panel-icon {
    background: var(--landing-accent-glow);
    color: var(--landing-accent);
}

.gc-view .panel-icon {
    background: var(--landing-gc-glow);
    color: var(--landing-gc-accent);
}

.login-panel-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.login-panel-header small {
    font-size: 0.85rem;
    color: var(--landing-text-muted);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--landing-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.back-link:hover { color: var(--landing-text); }

/* ── Dark Form Controls ── */
.dark-form .form-label {
    font-weight: 500;
    color: var(--landing-text);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.dark-form .form-select,
.dark-form .form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--landing-border);
    border-radius: 10px;
    color: var(--landing-text);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.dark-form .form-select:focus,
.dark-form .form-control:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--landing-accent);
    box-shadow: 0 0 0 3px var(--landing-accent-glow);
    color: var(--landing-text);
}

.dark-form .form-select option {
    background: var(--landing-surface);
    color: var(--landing-text);
}

.dark-form .form-check-input {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--landing-border);
}

.dark-form .form-check-input:checked {
    background-color: var(--landing-accent);
    border-color: var(--landing-accent);
}

.dark-form .form-check-label {
    color: var(--landing-text-muted);
    font-size: 0.85rem;
}

/* ── Buttons ── */
.btn-mechanic {
    background: var(--landing-accent);
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    width: 100%;
    transition: background 0.2s, transform 0.1s;
}

.btn-mechanic:hover {
    background: var(--landing-accent-hover);
    color: #fff;
}

.btn-mechanic:active { transform: translateY(1px); }

.btn-gc {
    background: var(--landing-gc-accent);
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    width: 100%;
    transition: background 0.2s, transform 0.1s;
}

.btn-gc:hover {
    background: var(--landing-gc-accent-hover);
    color: #fff;
}

.btn-gc:active { transform: translateY(1px); }

.btn-mechanic:disabled,
.btn-gc:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Error Alert (dark) ── */
.error-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: #fca5a5;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    display: none;
}

.error-alert.show { display: flex; align-items: center; gap: 0.5rem; }

/* ── GC Access Code Input ── */
.access-code-input {
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 600;
    font-size: 1.25rem;
}

/* ── Animations ── */
@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .banner-scene { margin-bottom: 2rem; }
    .banner-video { max-width: 100%; }
    .logo-reflection { width: 280px; }
    .banner-glow { width: 320px; height: 280px; }
    .banner-glow-secondary { width: 380px; height: 320px; }
    .banner-backdrop { width: 100%; height: 280px; }
    .banner-subtitle { font-size: 0.85rem; letter-spacing: 0.08em; }
    .portal-card { padding: 1.5rem; }
    .login-panel { padding: 1.5rem; }
}

@media (max-width: 400px) {
    .logo-reflection { width: 220px; }
    .banner-glow { width: 260px; height: 220px; }
    .banner-glow-secondary { width: 300px; height: 260px; }
    .banner-subtitle { font-size: 0.75rem; }
}
/* ── Theme Toggle FAB ── */
.theme-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid var(--landing-border);
    background: var(--landing-surface);
    color: var(--landing-text);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.theme-fab:hover { background: var(--landing-surface-hover); transform: scale(1.05); }
body.light-mode .theme-fab .bi-sun-fill { display: none; }
body.light-mode .theme-fab .bi-moon-stars-fill { display: inline; }
.theme-fab .bi-moon-stars-fill { display: none; }
