:root {
    /* Cores principais - paleta moderna */
    --gradient-primary: linear-gradient(135deg, #001d6c 0%, #003380 50%, #0043ce 100%);
    --gradient-success: linear-gradient(135deg, #198038 0%, #2d8c5a 50%, #3dcc7a 100%);
    --gradient-warning: linear-gradient(135deg, #b34c00 0%, #e66c2c 50%, #ff8c42 100%);
    
    /* Cores sólidas */
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-primary: #001d6c;
    --color-primary-hover: #002d9c;
    --color-accent: #0043ce;
    --color-success: #198038;
    --color-success-light: #defbe6;
    --color-warning: #b34c00;
    --color-warning-light: #fff4e5;
    --color-text: #1a1a1a;
    --color-text-light: #6b7280;
    --color-border: #e5e7eb;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Bordas */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Animações */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-surface: #1f1f1f;
    --color-primary: #0058ff;
    --color-primary-hover: #3377ff;
    --color-accent: #5c8eff;
    --color-success: #3dcc7a;
    --color-success-light: #1e3a2a;
    --color-text: #f3f4f6;
    --color-text-light: #9ca3af;
    --color-border: #374151;
}

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

body {
    font-family: 'Inter', 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: var(--transition);
}

/* Header moderno */
.modern-header {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.modern-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.125rem;
    opacity: 0.95;
}

/* Container principal */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Cards modernos */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--color-border);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
}

.card-description {
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* File upload area */
.file-area {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--color-bg);
}

.file-area:hover {
    border-color: var(--color-accent);
    background: var(--color-surface);
}

.file-area.drag-over {
    border-color: var(--color-accent);
    background: rgba(0, 67, 206, 0.05);
}

.file-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.file-label {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.file-hint {
    font-size: 0.75rem;
    color: var(--color-text-light);
}

/* Formulários */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

select, button {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.875rem;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 67, 206, 0.1);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
}

/* Botão principal */
.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Resultados */
.results-container {
    background: var(--gradient-primary);
    border-radius: var(--xl);
    padding: 2rem;
    margin-top: 2rem;
}

.results-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--color-bg) 0%, var(--color-surface) 100%);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Gráfico */
.chart-container {
    background: var(--color-bg);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1rem 0;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bar-label {
    width: 100px;
    font-weight: 600;
}

.bar-wrapper {
    flex: 1;
    min-width: 200px;
}

.bar-bg {
    background: var(--color-border);
    border-radius: 999px;
    height: 32px;
    overflow: hidden;
}

.bar-fill {
    background: var(--gradient-primary);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.75rem;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    transition: width 1s ease;
    border-radius: 999px;
}

.bar-fill.mais-rapido {
    background: var(--gradient-success);
}

.bar-value {
    min-width: 80px;
    font-weight: 600;
    color: var(--color-text);
}

/* Downloads */
.downloads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.download-card {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid var(--color-border);
}

.download-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.download-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.download-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.download-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Results Table */
.results-table {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--color-border);
}

.results-table table {
    width: 100%;
}

.results-table thead {
    background: var(--color-bg);
}

.results-table th,
.results-table td {
    padding: 0.75rem;
    text-align: left;
}

.results-table th {
    font-weight: 600;
    color: var(--color-primary);
}

.results-table tbody tr:hover {
    background: var(--color-bg);
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    z-index: 1000;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s ease;
    z-index: 10000;
    border-left: 4px solid var(--color-success);
    max-width: 400px;
}

.toast.error {
    border-left-color: var(--color-warning);
    background: rgba(255, 100, 100, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bar-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .bar-label {
        width: auto;
    }
    
    .bar-wrapper {
        width: 100%;
    }
    
    .modern-header {
        padding: 2rem 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }
}