/* ========================================
   VARIABLES ET COULEURS
   ======================================== */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #c0392b;
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #bdc3c7;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ========================================
   RESET ET STYLES GLOBAUX
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* ========================================
   APP LAYOUT
   ======================================== */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: 250px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: var(--white);
    padding: 30px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    color: var(--white);
    letter-spacing: 1px;
    padding: 0 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 20px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 15px;
}

.sidebar nav a {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar nav a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    transform: translateX(5px);
}

.sidebar nav a.logout {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 20px;
    color: var(--accent-color);
}

.sidebar nav a.logout:hover {
    background-color: rgba(231, 76, 60, 0.1);
    color: var(--white);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.content {
    margin-left: 250px;
    flex: 1;
    overflow-y: auto;
    background-color: #f5f6fa;
    padding: 30px;
}

/* ========================================
   HEADERS ET TITRES
   ======================================== */
h2 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 25px;
    font-weight: 700;
}

h3 {
    color: var(--primary-color);
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 600;
}

/* ========================================
   BOUTONS
   ======================================== */
button, .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: var(--secondary-color);
    color: var(--white);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background-color: #2980b9;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #95a5a6;
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    box-shadow: var(--shadow-lg);
}

.btn-success {
    background-color: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background-color: #229954;
    box-shadow: var(--shadow-lg);
}

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

.btn-danger:hover {
    background-color: #a93226;
    box-shadow: var(--shadow-lg);
}

.btn-warning {
    background-color: var(--warning-color);
    color: var(--white);
}

.btn-warning:hover {
    background-color: #d68910;
    box-shadow: var(--shadow-lg);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========================================
   INPUT ET FORMULAIRES
   ======================================== */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-dark);
}

/* ========================================
   RECHERCHE
   ======================================== */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: var(--white);
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.search-bar input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
}

.search-bar input::placeholder {
    color: var(--text-light);
}

/* ========================================
   GRILLE DE PRODUITS
   ======================================== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.product-card {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f6fa 0%, #ecf0f1 100%);
}

.product-info {
    padding: 15px;
}

.product-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
    word-wrap: break-word;
}

.product-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.product-category {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 10px;
}

.product-stock {
    font-size: 12px;
    padding: 6px 12px;
    background: #f0f0f0;
    border-radius: 4px;
    margin-bottom: 12px;
    display: inline-block;
    font-weight: 600;
}

.product-stock.low {
    background: #ffeaea;
    color: var(--danger-color);
}

.product-stock.ok {
    background: #e8f8f5;
    color: var(--success-color);
}

.product-stock.medium {
    background: #fef5e7;
    color: var(--warning-color);
}

.product-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.product-actions button {
    flex: 1;
    padding: 8px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-edit {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-edit:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-delete {
    background: var(--danger-color);
    color: var(--white);
}

.btn-delete:hover {
    background: #a93226;
    transform: translateY(-2px);
}

.btn-add {
    background: var(--success-color);
    color: var(--white);
}

.btn-add:hover {
    background: #229954;
    transform: translateY(-2px);
}

/* ========================================
   MODAL
   ======================================== */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--white);
    padding: 35px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-dark);
}

/* ========================================
   PANIER
   ======================================== */
.cart-item {
    background: var(--white);
    padding: 12px;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.cart-item span {
    flex: 1;
    font-weight: 600;
}

.cart-item input {
    width: 60px;
    padding: 6px;
}

.cart-item button {
    padding: 6px 12px;
    font-size: 12px;
}

/* ========================================
   STATS ET INFOS
   ======================================== */
.stat-box {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border-left: 4px solid var(--secondary-color);
}

.stat-box.success {
    border-left-color: var(--success-color);
}

.stat-box.danger {
    border-left-color: var(--danger-color);
}

.stat-box.warning {
    border-left-color: var(--warning-color);
}

.stat-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 5px;
}

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

/* ========================================
   TABLEAU
   ======================================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, #34495e 100%);
    color: var(--white);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--light-bg);
}

tbody tr:hover {
    background-color: #f9f9f9;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .content {
        margin-left: 200px;
        padding: 20px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 25px;
    }
    
    h2 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 150px;
        padding: 20px 0;
    }
    
    .content {
        margin-left: 150px;
        padding: 15px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    button {
        width: 100%;
    }
}