﻿/* --- SNAPBOUTIK SPLASH SCREEN --- */
#splash-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}
.splash-logo { width: 120px; height: 120px; margin-bottom: 20px; border-radius: 20px; }
.splash-title { font-size: 2rem; font-weight: 800; color: #2c3e50; margin: 0; }
.splash-slogan { font-size: 1rem; color: #3498db; font-style: italic; margin-top: 5px; }
:root {
    /* --- CONFIGURATION DYNAMIQUE SNAPBOUTIK --- */
    --main-color: #2c3e50;
    --accent-color: var(--shop-theme-color, #3498db); /* Couleur dynamique */
    --shop-theme-color: #3498db; /* Valeur par défaut (Bleu) */
    --bg-color: #D0F2EC; 
    --app-bg: #ffffff;
    --text-color: #333333;
    --radius: 8px;
    
    /* --- COULEURS SUCCES --- */
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-border: #155724;
    
    /* --- COULEURS ADMIN --- */
    --card-new-prod: #3498db;  /* Bleu */
    --card-stock: #9b59b6;     /* Violet */
    --card-cat: #f39c12;       /* Orange */
    --card-bank: #27ae60;      /* Vert */
    
    /* --- COULEUR CARTE CLIENT --- */
    --shop-card-color: #2c3e50;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0; padding: 0;
}

/* --- CONTENEUR GLOBAL --- */
.app-container {
    width: 100%; max-width: 1200px; margin: 0 auto; background: var(--app-bg);
    min-height: 100vh; box-shadow: 0 0 20px rgba(0,0,0,0.1); position: relative;
}

/* =========================================
   --- PARTIE 1 : LA BOUTIQUE (CLIENT) ---
   ========================================= */

/* HEADER & NAV */
.shop-header { background: #fff; padding: 15px; text-align: center; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 100; }
.shop-header h1 { margin: 0; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 1px; display:flex; align-items:center; justify-content:center; gap:10px; }
.shop-logo { height: 30px; width: auto; object-fit: contain; }

.category-nav { 
    display: flex; flex-wrap: wrap; justify-content: center; 
    padding: 10px; background: #fff; gap: 8px; border-bottom: 1px solid #f0f0f0; 
}
.category-nav a { text-decoration: none; color: #666; padding: 6px 14px; border-radius: 20px; background: #f4f4f4; font-size: 0.85rem; font-weight: 500; transition: 0.2s; }
.category-nav a.active { background: var(--main-color); color: #fff; }

/* GRILLE PRODUITS ADAPTATIVE SNAPBOUTIK */
.product-grid { 
    padding: 15px; 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
    background: #fafafa; 
}

@media (min-width: 768px) {
    .product-grid { 
        grid-template-columns: repeat(4, 1fr); 
    }
}

.product-card {
    background: #fff; border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform 0.2s ease;
    border: 2px solid #e0e0e0; border-bottom-width: 5px; border-bottom-color: #ccc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.08); display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px rgba(0,0,0,0.15); }

.card-header-shop {
    background-color: var(--shop-card-color); color: white; padding: 10px; text-align: center;
    font-weight: bold; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.img-container { position: relative; width: 100%; padding-top: 100%; background: #eee; }
.img-container img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.badge-vendu {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-10deg);
    background: rgba(200, 0, 0, 0.9); color: white; padding: 4px 10px; font-weight: bold; border: 1px solid white;
}

.card-details { padding: 10px; text-align: center; }
.mini-price { font-size: 1.1rem; font-weight: bold; color: #333; margin-top: 5px; display: block; }
.mini-old-price { text-decoration: line-through; color: #999; font-size: 0.8rem; margin-right: 5px; }
.mini-promo { color: var(--accent-color); }
.btn-see-more { display: block; width: 80%; margin: 10px auto 5px; padding: 8px; background: #f0f2f5; color: #666; border-radius: 20px; text-align: center; font-size: 0.8rem; font-weight: 500; }


/* =========================================
   --- PARTIE 2 : FENÊTRE MODALE ---
   ========================================= */

.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 1000;
    display: none; justify-content: center; align-items: center; 
    padding: 20px; box-sizing: border-box; 
}
.modal-overlay.open { display: flex; animation: fadeIn 0.3s; }

.modal-content {
    background: #fff; width: 100%; max-width: 480px; 
    height: auto; max-height: 85vh; 
    border-radius: 20px; padding: 20px; box-sizing: border-box;
    overflow-y: auto; position: relative; animation: slideUp 0.3s;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.btn-close {
    position: absolute; top: 15px; right: 15px;
    background: #f0f0f0; border: none; width: 35px; height: 35px; border-radius: 50%;
    font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10;
}

/* Galerie & Infos */
.modal-gallery-main { width: 100%; aspect-ratio: 1/1; background: #eee; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.modal-gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.modal-thumbnails { display: flex; gap: 10px; margin-bottom: 20px; }
.thumb { width: 60px; height: 60px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.thumb.active { border-color: var(--shop-card-color); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.modal-title { margin: 0 0 10px; font-size: 1.4rem; color: var(--shop-card-color); }
.modal-desc { color: #666; font-size: 0.95rem; line-height: 1.5; margin-bottom: 20px; }

/* Tags Client */
.size-selector-client { margin-bottom: 15px; }
.size-tag-client { 
    display: inline-block; padding: 5px 10px; border: 1px solid #ccc; border-radius: 4px; 
    margin-right: 5px; font-size: 0.85rem; background: #f9f9f9; color: #555;
}

.shipping-selector { background: #f9f9f9; padding: 15px; border-radius: 12px; margin-bottom: 20px; border: 1px solid #eee; }
.shipping-option { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed #ddd; cursor: pointer; }
.shipping-option:last-child { border-bottom: none; }
.radio-group { display: flex; align-items: center; gap: 10px; }
.radio-group input { transform: scale(1.3); }

.total-price-box { text-align: center; margin-bottom: 15px; font-size: 1.2rem; font-weight: bold; }
.big-price { font-size: 1.8rem; color: var(--shop-card-color); }

.btn-stripe-modal { 
    background: #32325d; color: white; width: 100%; padding: 15px; 
    border: none; border-radius: 50px; font-weight: bold; font-size: 1rem; cursor: pointer; margin-bottom: 10px;
    box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11);
}
.btn-paypal-modal {
    background: #ffc439; color: black; width: 100%; padding: 15px; 
    border: none; border-radius: 50px; font-weight: bold; font-size: 1rem; cursor: pointer; text-decoration: none; display: block; text-align: center; box-sizing: border-box;
}


/* =========================================
   --- PARTIE 3 : CONSOLE ADMIN ---
   ========================================= */

.admin-container { 
    padding: 15px; max-width: 600px; margin: 0 auto; 
    background: transparent; min-height: 100vh;
}
.admin-container h1 { text-align: center; margin-bottom: 25px; color: #333; }

/* Carte Admin (Accordéon) */
.admin-card {
    background: #fff; border-radius: 12px; margin-bottom: 15px; overflow: hidden; transition: transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); border: 2px solid #ccc; border-bottom-width: 5px;
}
.admin-card:hover { transform: translateY(-2px); box-shadow: 0 8px 15px rgba(0,0,0,0.15); }

.border-blue { border-color: var(--card-new-prod); }
.border-purple { border-color: var(--card-stock); }
.border-orange { border-color: var(--card-cat); }
.border-green { border-color: var(--card-bank); }

.card-header {
    padding: 15px 20px; color: white; font-weight: bold; font-size: 1.05rem;
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-right { display: flex; align-items: center; gap: 10px; }

.header-new { background-color: var(--card-new-prod); }
.header-stock { background-color: var(--card-stock); }
.header-cat { background-color: var(--card-cat); }
.header-bank { background-color: var(--card-bank); }

.arrow-icon { transition: transform 0.3s ease; font-size: 0.8rem; }
.arrow-icon.open { transform: rotate(180deg); }
.toggle-hint { font-size: 0.75rem; color: #e0e0e0; font-weight: normal; font-style: italic; }

/* CORPS DE CARTE (Fermé par défaut) */
.card-body { padding: 20px; display: none; }
.card-body.open { display: block; animation: slideDown 0.3s ease-out; }

/* Grille Photos */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 5px; }
.photo-slot {
    aspect-ratio: 1 / 1; border: 2px dashed #cbd5e0; border-radius: 8px;
    background: #f8fafc; position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
}
.photo-slot:hover { border-color: var(--card-new-prod); background: #f0f7ff; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; top:0; left:0; }
.photo-controls { text-align: center; z-index: 2; }
.photo-label { font-size: 0.7rem; color: #999; margin-top: 5px; }
.btn-mini-action { font-size: 1.5rem; color: #a0aec0; }
.input-photo { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; z-index: 10; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; color: #444; }
.form-group input, .form-group textarea, .form-group select { 
    width: 100%; padding: 12px; border: 2px solid #ccc; background-color: #fff;
    border-radius: 8px; box-sizing: border-box; font-size: 1rem; transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { 
    border-color: var(--card-new-prod); outline: none; 
}
.form-row { display: flex; gap: 15px; }
.form-row > * { flex: 1; }

.btn-primary { 
    width: 100%; padding: 14px; background: var(--card-new-prod); color: white; 
    border: none; border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: bold;
    box-shadow: 0 4px 0 #2980b9; margin-top: 10px;
}
.btn-primary:active { transform: translateY(4px); box-shadow: none; }

/* --- SECTION TAILLES (Bordure Arrondie Épaisse) --- */
.size-section {
    margin-bottom: 25px; 
    border: 3px solid #ccc; /* Bordure épaisse */
    border-radius: 20px;    /* Bien arrondi */
    padding: 20px; 
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.size-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.size-col h4 { margin: 0 0 10px 0; font-size: 0.9rem; color: #555; text-align: center; border-bottom: 1px solid #ddd; padding-bottom: 5px; }
.size-buttons-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* Bouton Taille Cliquable */
.size-btn {
    width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 1px solid #ccc;
    display: flex; align-items: center; justify-content: center; font-size: 0.8rem; cursor: pointer;
    transition: all 0.2s; user-select: none;
}
.size-btn.selected {
    background: var(--card-new-prod); color: white; border-color: var(--card-new-prod); font-weight: bold; transform: scale(1.1);
}
.size-checkbox { display: none; }


/* --- SECTION LIVRAISON COMPACTE (Bordure Foncée) --- */
.shipping-compact-box {
    background: #fff; 
    border: 3px solid #777; /* Bordure Foncée */
    border-radius: 12px; 
    margin-bottom: 20px; 
    overflow: hidden;
}
.shipping-trigger {
    padding: 15px; display: flex; align-items: center; justify-content: space-between; background: #f0f0f0; cursor: pointer; font-weight: bold;
}
.shipping-trigger-left { display: flex; align-items: center; gap: 10px; color: #333; }
.shipping-trigger-right { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; color: #3498db; }
.shipping-trigger-right .arrow { font-size: 0.7rem; transition: transform 0.3s; }
.shipping-trigger-right .arrow.open { transform: rotate(180deg); }

.shipping-content {
    padding: 15px; border-top: 1px dashed #777; display: none; background: #fff;
}
.shipping-content.open { display: block; }
.shipping-row {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.shipping-row:last-child { margin-bottom: 0; }
.check-group { display: flex; align-items: center; gap: 10px; flex-grow: 1; }
.check-group input[type=checkbox] { width: 20px; height: 20px; border: 2px solid #ccc; cursor: pointer; }
.shipping-labels { display: flex; flex-direction: column; }
.label-main { font-weight: 600; font-size: 0.9rem; color: #333; }
.label-sub { font-size: 0.75rem; color: #888; font-style: italic; }
.price-input-small {
    width: 80px !important; padding: 8px !important; text-align: right;
    border: 2px solid #ccc !important; border-radius: 6px !important;
}

/* Stock & Catégories */
.stock-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
}

.stock-grid.open {
    display: grid;
}
.product-item { 
    display: flex; flex-direction: column; padding: 10px; background: #fff; 
    border: 1px solid #bbb; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.product-item-top { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.product-thumb { width: 50px; height: 50px; border-radius: 6px; object-fit: cover; background: #eee; border:1px solid #ddd; }
.product-info { font-size: 0.85rem; line-height: 1.3; overflow: hidden; }
.product-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; }

.btn-icon {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    font-size: 1rem; transition: transform 0.1s; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-icon:active { transform: scale(0.95); }
.btn-edit { background: #e3f2fd; color: #2196f3; text-decoration: none;}
.btn-delete { background: #ffebee; color: #e74c3c; } 
.btn-check { background: #e8f5e9; color: #2ecc71; }
.btn-add-cat { 
    background: var(--card-cat); color: white; border: none; 
    padding: 0 20px; border-radius: 8px; font-weight: bold; cursor: pointer;
    box-shadow: 0 3px 0 #d35400;
}
.btn-add-cat:active { transform: translateY(3px); box-shadow: none; }

.cat-item { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: #fff; border-bottom: 1px solid #f0f0f0; }
.cat-item form input[type=text], .admin-card .card-body form[style*="display:flex"] input[name=nom_cat] {
    border: 2px solid #ccc !important; border-radius: 12px !important; padding: 10px !important; box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.alert {
    background-color: var(--success-bg); color: var(--success-text);
    padding: 15px; margin-bottom: 25px; border: 2px solid var(--success-border);
    border-radius: 12px; text-align: center; font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }