/* Main Dashboard Styles */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #34495e;
    --text-color: #333;
    --border-radius: 6px;
    --box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: var(--text-color);
    line-height: 1.6;
}

/* Login Page Styles */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #3498db, #2c3e50);
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.login-box h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-box h2 {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 400;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.form-group button {
    width: 100%;
    padding: 0.8rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.form-group button:hover {
    background-color: #2980b9;
}

.error-message {
    background-color: #fceaea;
    color: var(--danger-color);
    padding: 0.8rem;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--danger-color);
}

/* Dashboard Layout */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Navigation Menu */
.main-nav {
    background-color: var(--secondary-color);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.main-nav ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-x: auto;
}

.main-nav li {
    flex: 0 0 auto;
}

.main-nav a {
    display: block;
    color: white;
    text-decoration: none;
    padding: 1rem 1.5rem;
    transition: background-color 0.3s;
}

.main-nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.main-nav a.active {
    background-color: var(--primary-color);
    font-weight: bold;
}

@media (max-width: 768px) {
    .main-nav ul {
        flex-direction: column;
    }
    
    .main-nav li {
        width: 100%;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

.header-left h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.header-left p {
    color: #777;
}

.header-right {
    display: flex;
    gap: 1rem;
}

.btn-print, .btn-refresh, .btn-logout {
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-print {
    background-color: var(--light-color);
    color: var(--dark-color);
    border: 1px solid #ddd;
}

.btn-refresh {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.btn-logout {
    background-color: var(--danger-color);
    color: white;
    border: none;
}

/* Date Navigation */
.date-navigation {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

.btn-nav {
    background-color: var(--light-color);
    color: var(--dark-color);
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    border: 1px solid #ddd;
    transition: background-color 0.3s;
}

.btn-nav:hover {
    background-color: #ddd;
}

/* Stats Cards */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.stat-card h3 {
    color: var(--dark-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.sub-value {
    color: #777;
    font-size: 0.9rem;
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.chart-card {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.chart-card h3 {
    color: var(--dark-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.chart-container {
    height: 300px;
    margin-bottom: 1.5rem;
    position: relative;
}

/* Styles spécifiques pour les graphiques */
canvas {
    max-width: 100%;
    height: auto !important;
}

/* Transactions Card */
.transactions-card {
    grid-column: 1 / -1;
}

/* Tables */
.data-table {
    margin-top: 1rem;
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--dark-color);
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #777;
    font-style: italic;
}

/* Stock Badges */
.stock-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
}

.stock-ok {
    background-color: rgba(75, 192, 192, 0.2);
    color: rgba(75, 192, 192, 1);
    border: 1px solid rgba(75, 192, 192, 0.4);
}

.stock-low {
    background-color: rgba(255, 206, 86, 0.2);
    color: rgba(255, 206, 86, 1);
    border: 1px solid rgba(255, 206, 86, 0.4);
}

.stock-out {
    background-color: rgba(255, 99, 132, 0.2);
    color: rgba(255, 99, 132, 1);
    border: 1px solid rgba(255, 99, 132, 0.4);
}

/* Filter Form */
.filter-container {
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
}

.filter-form .form-group {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.filter-form input,
.filter-form select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.btn-filter,
.btn-reset {
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-filter {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.btn-reset {
    background-color: var(--light-color);
    color: var(--dark-color);
    border: 1px solid #ddd;
}

/* Progress Bar */
.progress-bar {
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }
    
    .dashboard-container {
        width: 100%;
        max-width: none;
        padding: 0;
    }
    
    .header-right, .btn-print, .btn-refresh, .btn-logout {
        display: none;
    }
    
    .chart-card, .stat-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #eee;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-right {
        margin-top: 1rem;
    }
}

@media (max-width: 576px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
}
