@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

:root {
    --primary: #00897b; /* Vert d'eau moderne */
    --primary-hover: #00695c;
    --bg: #f4f6f8;
    --card-bg: #ffffff;
    --text: #333333;
    --text-muted: #777777;
    --success: #2e7d32;
    --danger: #c62828;
    --border: #e0e0e0;
}
.form-select {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
}
body { 
    font-family: 'Cairo', sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
    direction: rtl; /* Très important pour l'arabe */
    text-align: right;
}

/* Navbar */
nav { background: var(--card-bg); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
nav .logo { font-size: 1.6rem; font-weight: 700; color: var(--primary); text-decoration: none; }
nav .menu a { color: var(--text); text-decoration: none; margin-right: 20px; margin-left: 0; transition: 0.3s; font-weight: 600; }
nav .menu a:hover { color: var(--primary); }

/* Layout */
.container { max-width: 1200px; margin: 30px auto; padding: 0 20px; }
.btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; font-family: 'Cairo', sans-serif; font-size: 1rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.btn-primary { background: var(--primary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-outline { border: 1px solid var(--border); background: transparent; color: var(--text); }

/* Forms */
input, select, textarea { width: 100%; padding: 12px; margin: 10px 0; background: #fff; border: 1px solid var(--border); color: var(--text); border-radius: 6px; box-sizing: border-box; font-family: 'Cairo', sans-serif; }
.form-box { max-width: 450px; margin: 50px auto; background: var(--card-bg); padding: 30px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }

/* Product Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }
.product-card { background: var(--card-bg); border-radius: 12px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; border: 1px solid var(--border); display: flex; flex-direction: column; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.08); }
.product-img { width: 100%; height: 220px; object-fit: cover; background: #eee; }
.product-info { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.product-title { font-size: 1.3rem; margin: 0 0 10px 0; font-weight: 700; }
.product-price { font-size: 1.4rem; font-weight: bold; color: var(--primary); margin-bottom: 15px; display: block; }
.product-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 20px; flex-grow: 1; }
.actions { display: flex; gap: 10px; margin-top: auto; }
.actions .btn { flex: 1; font-size: 0.95rem; }

/* Single Product View (Affichage unique) */
.single-product-container { display: flex; flex-wrap: wrap; gap: 40px; background: var(--card-bg); padding: 40px; border-radius: 15px; }
.single-image { flex: 1; min-width: 300px; }
.single-image img {
    width: 100%;           /* Prend toute la largeur de la zone */
    height: auto;          /* Garde les proportions */
    max-height: 450px;     /* C'est LA correction : on limite la hauteur à 450px */
    object-fit: contain;   /* L'image s'adapte sans être coupée ni déformée */
    border-radius: 10px;
    background-color: #fff; /* Fond blanc si l'image est petite */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* Petite ombre pour l'esthétique */
    display: block;        /* Évite les petits espaces blancs en bas */
}
.single-details { flex: 1; min-width: 300px; }

/* Dashboard Tables */
table { width: 100%; border-collapse: collapse; margin-top: 20px; background: var(--card-bg); border-radius: 8px; overflow: hidden; }
th, td { padding: 12px; text-align: right; border-bottom: 1px solid var(--border); }
th { background: #fafafa; color: var(--primary); }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: var(--card-bg); padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; position: relative; text-align: right; }
.close { position: absolute; top: 15px; left: 20px; font-size: 28px; cursor: pointer; color: #999; }
.social-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.social-btns a { text-align: center; }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--card-bg); padding: 20px; border-radius: 10px; text-align: center; border-right: 4px solid var(--primary); }
