/* Variables globales */
:root {
    --primary-blue: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --orange: #f97316;
    --orange-light: #fb923c;
    --green: #10b981;
    --green-light: #34d399;
    --purple: #a855f7;
    --purple-light: #c084fc;
    --teal: #14b8a6;
    --teal-light: #2dd4bf;
    --emerald: #059669;
    --emerald-light: #10b981;
    --red: #ef4444;
    --yellow: #f59e0b;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.dashboard-header {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.header-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Sélecteur de période */
.period-selector {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-xl);
}

.period-selector h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.period-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.period-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1.25rem 2rem;
    border: 3px solid var(--border-color);
    background: white;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.period-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-blue);
}

.period-btn.active {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    border-color: var(--primary-blue);
    color: white;
}

.period-number {
    font-size: 2.5rem;
    font-weight: 700;
}

.period-label {
    font-size: 0.875rem;
    font-weight: 600;
}

.period-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 1rem;
}

.period-current {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    display: inline-block;
}

/* Contrôles de test */
.test-controls {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--yellow);
}

.test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.test-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.toggle-btn {
    padding: 0.5rem 1rem;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.3s ease;
}

.toggle-btn:hover {
    background: var(--text-primary);
}

.test-controls-content {
    display: block;
}

.test-controls-content.hidden {
    display: none;
}

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

.test-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.test-control label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.test-control input[type="number"] {
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.test-control input[type="range"] {
    width: 100%;
}

.test-value {
    font-weight: 700;
    color: var(--primary-blue);
}

/* Section KPI */
.kpi-section {
    margin-bottom: 2rem;
}

.kpi-row {
    margin-bottom: 3rem;
}

.row-title {
    color: white;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.kpi-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.kpi-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-xl);
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.kpi-card.total-card {
    background: linear-gradient(135deg, #fafafa, #f5f5f5);
    border: 3px solid var(--primary-blue);
}

/* Liquid Fill Design */
.gauge-liquid {
    text-align: center;
}

.gauge-liquid-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    overflow: hidden;
    border: 5px solid;
    background: #f8fafc;
}

.gauge-liquid-container.liquid-blue {
    border-color: var(--primary-blue);
}

.gauge-liquid-container.liquid-orange {
    border-color: var(--orange);
}

.gauge-liquid-container.liquid-purple {
    border-color: var(--purple);
}

.gauge-liquid-container.liquid-green {
    border-color: var(--green);
}

.gauge-liquid-container.liquid-teal {
    border-color: var(--teal);
}

.gauge-liquid-container.liquid-emerald {
    border-color: var(--emerald);
}

.gauge-liquid-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.liquid-blue .gauge-liquid-fill {
    background: linear-gradient(180deg, var(--primary-light), var(--primary-blue));
}

.liquid-orange .gauge-liquid-fill {
    background: linear-gradient(180deg, var(--orange-light), var(--orange));
}

.liquid-purple .gauge-liquid-fill {
    background: linear-gradient(180deg, var(--purple-light), var(--purple));
}

.liquid-green .gauge-liquid-fill {
    background: linear-gradient(180deg, var(--green-light), var(--green));
}

.liquid-teal .gauge-liquid-fill {
    background: linear-gradient(180deg, var(--teal-light), var(--teal));
}

.liquid-emerald .gauge-liquid-fill {
    background: linear-gradient(180deg, var(--emerald-light), var(--emerald));
}

.gauge-liquid-wave {
    position: absolute;
    top: -10px;
    left: -50%;
    width: 200%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.3) 0%, transparent 50%);
    animation: wave 3s linear infinite;
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(50%); }
}

.gauge-liquid-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.gauge-number-liquid {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.gauge-percentage-liquid {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gauge-number-liquid-white {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gauge-percentage-liquid-white {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gauge-label-bottom {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.liquid-icon {
    font-size: 1.5rem;
}

/* Total Général Section */
.total-general-section {
    margin-top: 3rem;
}

.total-general-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 2rem;
    border: 3px solid var(--primary-blue);
    transition: all 0.3s ease;
}

.total-general-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.3);
}

.total-general-icon {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-lg);
}

.total-general-content {
    flex: 1;
}

.total-general-label {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.total-general-number {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 1rem;
}

.total-general-breakdown {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.125rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

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

.breakdown-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.breakdown-separator {
    color: var(--border-color);
    font-weight: 300;
}

/* Footer */
.dashboard-footer {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    margin-top: 2rem;
}

.dashboard-footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1200px) {
    .kpi-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .kpi-grid-3 {
        grid-template-columns: 1fr;
    }

    .period-buttons {
        flex-direction: column;
    }

    .period-btn {
        width: 100%;
    }

    .total-general-card {
        flex-direction: column;
        text-align: center;
    }

    .total-general-number {
        font-size: 3rem;
    }

    .total-general-icon {
        width: 80px;
        height: 80px;
        font-size: 3rem;
    }

    .test-grid {
        grid-template-columns: 1fr;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card {
    animation: fadeIn 0.6s ease backwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.total-general-card {
    animation: slideIn 0.8s ease 0.4s backwards;
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .test-controls,
    .toggle-btn {
        display: none;
    }

    .dashboard-container {
        padding: 0;
    }
}
