/**
 * Dashboard - Responsive Design
 * Optimisation mobile, tablette et desktop
 */

/* ========================================
   LAYOUT GÉNÉRAL
   ======================================== */

#content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Container principal du dashboard */
.dashboard-container {
    padding: 1.5rem;
}

/* ========================================
   HEADER & FILTRES DE PÉRIODE
   ======================================== */

.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* Filtres de période */
.periode-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.btn-periode {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    cursor: pointer;
}

.btn-periode:hover {
    background: var(--gray-50);
    border-color: var(--yaye-green);
}

.btn-periode.active {
    background: var(--yaye-green);
    border-color: var(--yaye-green);
    color: white;
}

/* Date inputs */
.periode-custom {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.date-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-input-group label {
    font-size: 0.875rem;
    color: var(--gray-600);
    white-space: nowrap;
}

.date-input-group input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

/* ========================================
   STATS CARDS (KPI)
   ======================================== */

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

.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--gray-200);
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--yaye-green-dark);
}

.stat-icon.blue {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #2563eb;
}

.stat-icon.yellow {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #d97706;
}

.stat-icon.red {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: var(--yaye-red-dark);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1;
}

.stat-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.stat-trend.up {
    background: #d1fae5;
    color: #059669;
}

.stat-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

/* ========================================
   CHARTS & WIDGETS
   ======================================== */

.charts-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
}

.chart-card.full {
    grid-column: span 12;
}

.chart-card.half {
    grid-column: span 6;
}

.chart-card.third {
    grid-column: span 4;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
}

.chart-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ========================================
   ACTIVITÉS RÉCENTES
   ======================================== */

.activities-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.5rem;
    border-left: 3px solid var(--yaye-green);
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: white;
    color: var(--yaye-green);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.activity-description {
    font-size: 0.813rem;
    color: var(--gray-600);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
}

/* ========================================
   RESPONSIVE MOBILE (<= 768px)
   ======================================== */

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

    /* Header */
    .dashboard-title {
        font-size: 1.5rem;
    }

    .dashboard-subtitle {
        font-size: 0.813rem;
    }

    /* Filtres de période - Stack vertical sur mobile */
    .periode-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .btn-periode {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .periode-custom {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .date-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .date-input-group label {
        font-size: 0.813rem;
    }

    .date-input-group input {
        width: 100%;
    }

    /* Stats Grid - 1 colonne sur mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.813rem;
    }

    /* Charts - Full width sur mobile */
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .chart-card {
        padding: 1.25rem;
        grid-column: span 1 !important;
    }

    .chart-card.full,
    .chart-card.half,
    .chart-card.third {
        grid-column: span 1 !important;
    }

    .chart-title {
        font-size: 1rem;
    }

    .chart-container {
        height: 250px;
    }

    /* Activités */
    .activity-item {
        padding: 0.875rem;
        gap: 0.75rem;
    }

    .activity-icon {
        width: 36px;
        height: 36px;
    }

    .activity-title {
        font-size: 0.813rem;
    }

    .activity-description {
        font-size: 0.75rem;
    }
}

/* ========================================
   RESPONSIVE TABLETTE (769px - 1024px)
   ======================================== */

@media (min-width: 769px) and (max-width: 1024px) {
    /* Container */
    .dashboard-container {
        padding: 1.25rem;
    }

    /* Stats Grid - 2 colonnes sur tablette */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    /* Charts - Adapter la grille */
    .chart-card.full {
        grid-column: span 12;
    }

    .chart-card.half {
        grid-column: span 12; /* Full width sur tablette */
    }

    .chart-card.third {
        grid-column: span 6; /* 2 colonnes sur tablette */
    }

    .chart-container {
        height: 280px;
    }
}

/* ========================================
   RESPONSIVE DESKTOP LARGE (>= 1440px)
   ======================================== */

@media (min-width: 1440px) {
    /* Container */
    .dashboard-container {
        padding: 2rem;
        max-width: 1600px;
        margin: 0 auto;
    }

    /* Stats Grid - 4 colonnes sur grand écran */
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }

    .stat-card {
        padding: 1.75rem;
    }

    .stat-icon {
        width: 56px;
        height: 56px;
    }

    .stat-value {
        font-size: 2.25rem;
    }

    /* Charts */
    .charts-grid {
        gap: 1.5rem;
    }

    .chart-card {
        padding: 1.75rem;
    }

    .chart-container {
        height: 350px;
    }
}

/* ========================================
   ANIMATIONS & TRANSITIONS
   ======================================== */

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

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* Stagger animation pour les stats cards */
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

/* Skeleton loading pour les charts */
.chart-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ========================================
   UTILITIES
   ======================================== */

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scroll-horizontal {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.scroll-horizontal::-webkit-scrollbar {
    height: 6px;
}

.scroll-horizontal::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block;
    }
}
