/* ============================================
   ALYNA JURÍDICA - PÁGINA DE ATIVAÇÃO
   Design: Premium, Glassmorphism, Modern UI
   ============================================ */

/* CSS Variables */
:root {
    /* Colors - Premium Dark Theme */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --secondary-light: #34d399;
    --accent: #f59e0b;
    --danger: #ef4444;
    
    /* Backgrounds */
    --bg-dark: #0f0f1a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    /* Borders */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(99, 102, 241, 0.5);
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-bg: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Effects */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-bg);
    z-index: -2;
}

.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.05) 0%, transparent 70%);
    z-index: -1;
    animation: bgPulse 10s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

/* Header / Logo */
.header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    color: var(--text-primary);
}

.logo-highlight {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Main Card */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

/* States */
.state {
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.state.hidden {
    display: none;
}

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

/* Loading State */
.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

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

/* Error State */
.error-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
}

#errorState h2 {
    color: var(--danger);
    margin-bottom: var(--spacing-sm);
}

/* Connected / Success States */
.success-animation {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.success-icon {
    font-size: 5rem;
    display: inline-block;
}

.success-icon.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.connected-info, .success-details {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.connected-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-light);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
}

.detail-icon {
    font-size: 1.25rem;
}

.success-note {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-md);
}

/* QR Code State */
.welcome {
    margin-bottom: var(--spacing-lg);
}

.welcome h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.welcome .subtitle {
    color: var(--text-secondary);
}

/* QR Container */
.qr-container {
    margin-bottom: var(--spacing-lg);
}

.qr-wrapper {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    margin-bottom: var(--spacing-md);
    position: relative;
    box-shadow: var(--shadow-glow);
}

.qr-loading {
    text-align: center;
    color: var(--bg-dark);
}

.qr-loading .spinner {
    border-color: #e5e7eb;
    border-top-color: var(--primary);
}

.qr-loading p {
    color: #6b7280;
    font-size: 0.875rem;
}

.qr-image {
    max-width: 250px;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.qr-error {
    text-align: center;
    color: var(--danger);
}

.qr-error span {
    font-size: 2rem;
}

.qr-error p {
    margin: var(--spacing-sm) 0;
    color: #6b7280;
}

/* Timer */
.qr-timer {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.timer-bar {
    flex: 1;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.timer-progress {
    height: 100%;
    background: var(--gradient-primary);
    transition: width 1s linear;
    width: 100%;
}

.timer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Instructions */
.instructions {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: left;
    margin-bottom: var(--spacing-lg);
}

.instructions h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.instructions ol {
    padding-left: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.instructions li {
    margin-bottom: var(--spacing-xs);
}

.instructions li strong {
    color: var(--text-primary);
}

/* Status */
.status-container {
    display: flex;
    justify-content: center;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: blink 1.5s ease-in-out infinite;
}

.status-dot.waiting {
    background: var(--accent);
}

.status-dot.checking {
    background: var(--primary);
}

.status-dot.connected {
    background: var(--secondary);
    animation: none;
}

.status-dot.error {
    background: var(--danger);
    animation: none;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-outline {
    background: transparent;
    color: var(--primary-light);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: rgba(99, 102, 241, 0.1);
}

.btn-small {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
}

.refresh-icon {
    transition: transform var(--transition-normal);
}

.btn-outline:hover .refresh-icon {
    transform: rotate(180deg);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    color: var(--text-muted);
    font-size: 0.75rem;
}

.footer a {
    color: var(--primary-light);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.copyright {
    margin-top: var(--spacing-xs);
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: var(--spacing-md);
    }
    
    .card {
        padding: var(--spacing-lg);
    }
    
    .welcome h1 {
        font-size: 1.25rem;
    }
    
    .qr-wrapper {
        min-height: 240px;
    }
    
    .qr-image {
        max-width: 200px;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Confetti animation (for success) */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
