/* ================================================
   BudgetBucket - Modern Financial Login Page
   ================================================ */

:root {
    /* Primary Palette - Rich Emerald */
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;
    --primary-200: #a7f3d0;
    --primary-300: #6ee7b7;
    --primary-400: #34d399;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --primary-800: #065f46;
    --primary-900: #064e3b;
    
    /* Neutral Palette */
    --neutral-50: #fafafa;
    --neutral-100: #f4f4f5;
    --neutral-200: #e4e4e7;
    --neutral-300: #d4d4d8;
    --neutral-400: #a1a1aa;
    --neutral-500: #71717a;
    --neutral-600: #52525b;
    --neutral-700: #3f3f46;
    --neutral-800: #27272a;
    --neutral-900: #18181b;
    
    /* Accent */
    --accent-gold: #fbbf24;
    --accent-coral: #f97316;
    
    /* Backgrounds */
    --bg-showcase: linear-gradient(145deg, #064e3b 0%, #065f46 50%, #047857 100%);
    --bg-login: #fafafa;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(16, 185, 129, 0.3);
    
    /* Typography */
    --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Space Mono', monospace;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* ================================================
   Reset & Base
   ================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-display);
    background: var(--neutral-100);
    color: var(--neutral-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ================================================
   Layout Container
   ================================================ */

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
}

/* ================================================
   Left Side - Showcase Section
   ================================================ */

.showcase-section {
    background: var(--bg-showcase);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
}

@media (max-width: 1024px) {
    .showcase-section {
        padding: 1.5rem 1rem;
        min-height: auto;
    }
    
    .showcase-content {
        text-align: center;
    }
    
    .logo {
        margin-bottom: 1rem;
    }
    
    .logo-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
    
    .video-container {
        max-width: 100%;
        margin-bottom: 1rem;
    }
    
    .video-wrapper {
        border-radius: 12px;
    }
    
    .features {
        gap: 1rem;
    }
    
    .feature-icon {
        font-size: 1.5rem;
    }
    
    .feature-item span {
        font-size: 0.75rem;
    }
    
    .floating-shapes {
        display: none;
    }
}

.showcase-content {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.logo-icon svg {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.logo-text {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.02em;
}

/* Full-Width Cinematic Video */
.video-container {
    width: 100%;
    max-width: 90%;
    margin: 0 auto 2rem;
}

.video-wrapper {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    background: #000;
}

.video-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent, rgba(255,255,255,0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 5;
}

.demo-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* Sound Toggle Button */
.sound-toggle {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(16, 185, 129, 0.95);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    z-index: 100;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

.sound-toggle:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.05);
}

.sound-toggle svg {
    width: 20px;
    height: 20px;
}

.sound-toggle .icon-unmuted {
    display: none;
}

.sound-toggle.unmuted .icon-muted {
    display: none;
}

.sound-toggle.unmuted .icon-unmuted {
    display: block;
}

.sound-label {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.sound-toggle.unmuted .sound-label {
    display: none;
}

/* Pulse animation to draw attention */
.sound-toggle:not(.unmuted) {
    animation: pulse-sound 2s ease-in-out infinite;
}

@keyframes pulse-sound {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
    }
}

/* Features */
.features {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: white;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.feature-item:nth-child(1) { animation-delay: 0.3s; }
.feature-item:nth-child(2) { animation-delay: 0.4s; }
.feature-item:nth-child(3) { animation-delay: 0.5s; }

.feature-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.feature-item span {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Floating Shapes */
.floating-shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-300);
    top: -100px;
    right: -100px;
    animation: float 20s ease-in-out infinite;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: var(--accent-gold);
    bottom: -50px;
    left: -50px;
    animation: float 25s ease-in-out infinite reverse;
}

.shape-3 {
    width: 200px;
    height: 200px;
    background: white;
    top: 50%;
    left: 20%;
    animation: float 15s ease-in-out infinite;
}

/* ================================================
   Right Side - Login Section
   ================================================ */

.login-section {
    background: var(--bg-login);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 2rem;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.6s ease;
}

/* Login Header */
.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--neutral-900);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.login-header p {
    color: var(--neutral-500);
    font-size: 1rem;
}

/* Tabs */
.login-tabs {
    display: flex;
    background: var(--neutral-100);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 2rem;
    border: 1px solid var(--neutral-200);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--neutral-500);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-btn:hover {
    color: var(--neutral-700);
}

.tab-btn.active {
    background: white;
    color: var(--primary-600);
    box-shadow: var(--shadow-sm);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--neutral-700);
}

/* Phone Input */
.phone-input {
    display: flex;
    gap: 0.75rem;
}

.country-select {
    width: 110px;
    padding: 0.875rem 1rem;
    border: 1px solid var(--neutral-200);
    border-radius: 12px;
    background: white;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--neutral-800);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.country-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.phone-input input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--neutral-200);
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--neutral-800);
    transition: all var(--transition-fast);
}

.phone-input input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.phone-input input::placeholder {
    color: var(--neutral-400);
}

/* PIN Input */
.pin-input-container {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.pin-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    border: 2px solid var(--neutral-200);
    border-radius: 12px;
    background: white;
    color: var(--neutral-800);
    transition: all var(--transition-fast);
}

.pin-digit:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
    transform: translateY(-2px);
}

.pin-digit.filled {
    border-color: var(--primary-500);
    background: var(--primary-50);
}

/* Primary Button */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border: none;
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
    margin-top: 0.5rem;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

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

/* Forgot PIN */
.forgot-pin {
    text-align: center;
    margin-top: 1rem;
}

.forgot-pin a {
    font-size: 0.875rem;
    color: var(--primary-600);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.forgot-pin a:hover {
    color: var(--primary-700);
    text-decoration: underline;
}

/* ================================================
   QR Code Login
   ================================================ */

.qr-login {
    text-align: center;
}

.qr-code-container {
    position: relative;
    display: inline-block;
    margin-bottom: 1.5rem;
}

.qr-code {
    width: 200px;
    height: 200px;
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.qr-code:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-xl);
}

/* QRCode.js creates both canvas and img - hide canvas, show only img */
#qr-code canvas {
    display: none !important;
}

#qr-code img {
    display: block !important;
}

.qr-refresh {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    background: var(--primary-500);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.qr-refresh svg {
    width: 20px;
    height: 20px;
    color: white;
}

.qr-refresh:hover {
    background: var(--primary-600);
    transform: rotate(180deg);
}

.qr-instructions {
    margin-bottom: 1rem;
}

.qr-instructions h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-800);
    margin-bottom: 0.75rem;
}

.qr-instructions ol {
    text-align: left;
    max-width: 280px;
    margin: 0 auto;
    padding-left: 1.25rem;
}

.qr-instructions li {
    font-size: 0.875rem;
    color: var(--neutral-600);
    margin-bottom: 0.5rem;
}

.qr-instructions strong {
    color: var(--neutral-800);
}

.qr-timer {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--neutral-100);
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--neutral-600);
}

#qr-countdown {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--primary-600);
}

/* ================================================
   Divider & Secondary Button
   ================================================ */

.divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
}

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

.divider span {
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--neutral-500);
}

.btn-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: white;
    color: var(--neutral-700);
    border: 1px solid var(--neutral-200);
    border-radius: 12px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-base);
}

.btn-secondary svg {
    width: 20px;
    height: 20px;
    color: var(--primary-500);
}

.btn-secondary:hover {
    border-color: var(--primary-500);
    color: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ================================================
   Footer
   ================================================ */

.login-footer {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 100%;
    max-width: 420px;
}

.login-footer p {
    font-size: 0.75rem;
    color: var(--neutral-400);
    margin-bottom: 0.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-links a {
    font-size: 0.75rem;
    color: var(--neutral-500);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary-600);
}

/* ================================================
   Animations
   ================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(10px, -20px);
    }
    50% {
        transform: translate(-10px, -10px);
    }
    75% {
        transform: translate(20px, -30px);
    }
}

/* ================================================
   Mobile Responsive
   ================================================ */

@media (max-width: 1024px) {
    .login-section {
        min-height: auto;
        justify-content: flex-start;
        padding: 2rem 1.5rem;
    }
    
    .login-card::before {
        display: none;
    }
    
    .login-header {
        margin-bottom: 1.5rem;
    }
    
    .login-header h1 {
        font-size: 1.5rem;
    }
    
    .login-footer {
        position: relative;
        bottom: auto;
        transform: none;
        margin-top: 2rem;
    }
}

@media (max-width: 480px) {
    .login-section {
        padding: 1.5rem 1rem;
    }
    
    .login-header h1 {
        font-size: 1.35rem;
    }
    
    .pin-input-container {
        gap: 0.4rem;
    }
    
    .pin-digit {
        width: 40px;
        height: 48px;
        font-size: 1rem;
    }
    
    .tab-btn {
        font-size: 0.75rem;
        padding: 0.65rem 0.5rem;
    }
    
    .tab-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .qr-code {
        width: 160px;
        height: 160px;
    }
    
    .sound-toggle {
        bottom: 12px;
        right: 12px;
        padding: 8px 14px;
        font-size: 0.75rem;
    }
    
    .sound-toggle svg {
        width: 16px;
        height: 16px;
    }
    
    .features {
        gap: 0.75rem;
    }
}

/* ================================================
   Loading States & Utilities
   ================================================ */

.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--neutral-200);
    border-top-color: var(--primary-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

