/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color palette */
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --primary-active: #4f46e5;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    
    /* Neutral colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-normal: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
}

/* Base styles */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1e1b4b 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-4);
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--space-6);
}

.title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.title-icon {
    font-size: var(--font-size-3xl);
    -webkit-text-fill-color: var(--primary-color);
    background: none;
}

.subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    font-weight: 400;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* TOTP Card */
.totp-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.totp-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 0 1px var(--primary-color);
}

/* TOTP Display */
.totp-display {
    text-align: center;
    margin-bottom: var(--space-6);
}

.totp-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    margin-bottom: var(--space-3);
}

.totp-code {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    letter-spacing: 0.1em;
    min-height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
}

.totp-code:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

/* Countdown Section */
.countdown-section {
    text-align: center;
    margin-bottom: var(--space-6);
    padding: var(--space-4);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}



@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.countdown-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.countdown-timer {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    margin-bottom: var(--space-1);
    transition: color 0.3s ease;
    animation: pulse 1s ease-in-out;
}

.countdown-timer.warning {
    color: var(--warning-color);
    animation: pulse-warning 1s ease-in-out;
}

.countdown-timer.danger {
    color: var(--error-color);
    animation: pulse-danger 0.5s ease-in-out;
}

.countdown-timer.safe {
    color: var(--success-color);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes pulse-warning {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes pulse-danger {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

.countdown-unit {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Actions */
.actions {
    text-align: center;
}

.copy-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 200px;
    justify-content: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.copy-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-active) 100%);
}

.copy-btn:active:not(:disabled) {
    transform: translateY(0);
}

.copy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.copy-btn.success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
}

.copy-btn.error {
    background: linear-gradient(135deg, var(--error-color) 0%, #dc2626 100%);
}

.btn-icon {
    font-size: var(--font-size-lg);
}

.btn-text {
    font-weight: 600;
}

/* Status Message */
.status-message {
    margin-top: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 500;
    transition: all var(--transition-normal);
}

.status-message.success {
    background: rgb(16 185 129 / 0.1);
    color: var(--success-color);
    border: 1px solid rgb(16 185 129 / 0.2);
}

.status-message.error {
    background: rgb(239 68 68 / 0.1);
    color: var(--error-color);
    border: 1px solid rgb(239 68 68 / 0.2);
}

/* Loading Animation */
.loading-dots {
    display: inline-block;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0%, 20% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
    80%, 100% {
        opacity: 0.3;
    }
}

/* Footer */
.footer {
    margin-top: var(--space-4);
    text-align: center;
}

.footer-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    line-height: 1.4;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: var(--space-4);
    }
    
    .title {
        font-size: var(--font-size-3xl);
    }
    
    .totp-card {
        padding: var(--space-6);
    }
    
    .totp-code {
        font-size: var(--font-size-3xl);
        padding: var(--space-4);
    }
    
    .countdown-timer {
        font-size: var(--font-size-2xl);
    }
    
    .copy-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: var(--font-size-2xl);
        flex-direction: column;
        gap: var(--space-2);
    }
    
    .subtitle {
        font-size: var(--font-size-base);
    }
    
    .totp-code {
        font-size: var(--font-size-2xl);
        letter-spacing: 0.05em;
    }
}

/* Focus styles for accessibility */
.copy-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.totp-code:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-dots {
        animation: none;
    }
}

/* Dark mode support (already dark by default) */
@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f8fafc;
        --bg-tertiary: #f1f5f9;
        --text-primary: #0f172a;
        --text-secondary: #475569;
        --text-muted: #64748b;
        --border-color: #e2e8f0;
    }
}