/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* HEADER */
.top-header {
    background: linear-gradient(90deg, #000 0%, #5a3a1a 100%);
    color: white;
    padding: 25px;
    position: relative;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.site-title {
    font-size: 3.5rem;
    margin: 0;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 800;
    background: linear-gradient(45deg, #d4af37, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-style: italic;
    font-size: 1.2rem;
    margin-top: 10px;
    color: #d4af37;
}

.header-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

/* BOUTONS */
button {
    background: linear-gradient(45deg, #d4af37, #b8941f);
    border: none;
    padding: 12px 24px;
    margin: 5px;
    cursor: pointer;
    font-weight: bold;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    background: linear-gradient(45deg, #b8941f, #d4af37);
}

.btn-add {
    background: linear-gradient(45deg, #28a745, #20c997);
}

.btn-logout {
    background: linear-gradient(45deg, #dc3545, #c82333);
}

.btn-whatsapp {
    background: linear-gradient(45deg, #25D366, #128C7E);
}

/* FILTRE */
.filter {
    text-align: center;
    margin: 25px;
}

.filter select {
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid #d4af37;
    background: white;
    cursor: pointer;
    min-width: 200px;
}

/* PRODUITS */
#products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.product {
    background: white;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    border: 2px solid #d4af37;
}

.product:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.product img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.product h3 {
    font-size: 1.4rem;
    margin: 10px 0;
    color: #333;
}

.product p {
    font-size: 1.3rem;
    color: #d4af37;
    font-weight: bold;
    margin: 10px 0;
}

/* ADMIN PANEL */
.admin-panel {
    background: white;
    padding: 30px;
    margin: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    border: 2px solid #d4af37;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.admin-form input,
.admin-form select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.admin-form input:focus,
.admin-form select:focus {
    outline: none;
    border-color: #d4af37;
}

.image-upload-section {
    border: 2px dashed #d4af37;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.upload-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    margin: 15px auto;
    border-radius: 10px;
    display: none;
}

.admin-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

/* MODALES */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* NAVIGATEUR D'IMAGES */
.image-browser {
    width: 90%;
    max-width: 1000px;
}

.image-browser-controls {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
}

#imageSearch {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    min-width: 250px;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.image-item {
    border: 3px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    background: #f8f9fa;
}

.image-item:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.image-item.selected {
    border-color: #28a745;
    background: #e8f5e9;
}

.image-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 10px;
}

.image-name {
    font-size: 13px;
    word-break: break-all;
    color: #333;
    font-weight: 500;
}

.image-selection-footer {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #eee;
}

.selection-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

/* PANIER */
.cart-modal {
    width: 90%;
    max-width: 500px;
}

.cart-items {
    max-height: 300px;
    overflow-y: auto;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-total {
    font-size: 1.5rem;
    text-align: center;
    margin: 20px 0;
    color: #d4af37;
}

.cart-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* UPLOAD MODAL */
.upload-modal {
    max-width: 400px;
}

.upload-info {
    font-size: 14px;
    color: #666;
    margin: 10px 0 20px;
}

.upload-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* FOOTER */
footer {
    background: #000;
    color: #d4af37;
    text-align: center;
    padding: 25px;
    margin-top: 50px;
    font-size: 1.1rem;
}

/* CLASSES UTILITAIRES */
.hidden {
    display: none !important;
}

.danger {
    background: linear-gradient(45deg, #dc3545, #c82333);
}

.btn-close {
    background: #6c757d;
}

.btn-cancel {
    background: #6c757d;
}

.btn-use {
    background: linear-gradient(45deg, #28a745, #20c997);
}

.btn-refresh {
    background: linear-gradient(45deg, #17a2b8, #138496);
}

.btn-upload {
    background: linear-gradient(45deg, #6f42c1, #6610f2);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .site-title {
        font-size: 2.5rem;
    }
    
    .header-actions {
        position: static;
        justify-content: center;
        margin-top: 20px;
    }
    
    #products {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        padding: 15px;
    }
    
    .image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .image-browser-controls {
        flex-direction: column;
    }
    
    #imageSearch {
        min-width: 100%;
    }
}
