/* ==========================================================================
   Fichier : assets/css/admin.css
   Description : Styles principaux pour l'administration de BobyShop
   ========================================================================== */

/* ---------------------------
   Variables de thème
--------------------------- */
:root {
    --primary: #e60000;
    --primary-dark: #cc0000;
    --secondary: #333;
    --background: #f8f9fa;
    --white: #ffffff;
    --gray-light: #f1f1f1;
    --gray-medium: #ccc;
    --gray-dark: #666;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --font-family: 'Segoe UI', Arial, sans-serif;
}

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

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--secondary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---------------------------
   Layout général
--------------------------- */
.admin-main {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.admin-container h1 {
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
    text-align: center;
}

/* ---------------------------
   HEADER
--------------------------- */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--secondary);
    padding: 10px 20px;
    color: var(--white);
}

.admin-header-left .admin-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: bold;
    color: var(--white);
}

.admin-header-left img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: var(--primary);
    padding: 8px 15px;
    border-radius: 8px;
    color: var(--white);
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: var(--primary-dark);
}

/* ---------------------------
   NAVIGATION
--------------------------- */
.admin-nav {
    background: #222;
}

.admin-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.admin-nav ul li {
    flex: 1;
}

.admin-nav ul li a {
    display: block;
    padding: 12px;
    color: var(--white);
    text-align: center;
    transition: background 0.3s;
}

.admin-nav ul li a:hover,
.admin-nav ul li a.active {
    background: var(--primary);
}

/* ---------------------------
   Boutons
--------------------------- */
.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-decoration: none;
    text-align: center;
    transition: 0.3s ease;
    cursor: pointer;
    border: none;
    background: var(--gray-dark);
    color: var(--white);
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-info {
    background: var(--info);
}

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

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

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

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

/* ---------------------------
   Alertes
--------------------------- */
.alert {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

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

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

/* ---------------------------
   Onglets
--------------------------- */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.tab-link {
    padding: 10px 20px;
    border-radius: 6px;
    background: var(--gray-light);
    color: var(--secondary);
    font-weight: 500;
    transition: 0.3s ease;
}

.tab-link:hover {
    background: var(--gray-medium);
}

.tab-link.active {
    background: var(--primary);
    color: var(--white);
}

/* ---------------------------
   Actions et recherche
--------------------------- */
.admin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-form input[type="text"] {
    padding: 8px 10px;
    border: 1px solid var(--gray-medium);
    border-radius: 6px;
    min-width: 220px;
    font-size: 0.9rem;
}

/* ---------------------------
   Tableaux
--------------------------- */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-light);
    text-align: left;
    font-size: 0.9rem;
}

.admin-table thead {
    background: var(--primary);
    color: var(--white);
}

.admin-table tr:hover {
    background: #f9f9f9;
}

.admin-table td .btn {
    margin-right: 5px;
}

/* Badge de stock */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    text-align: center;
}

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

.badge-warning {
    background: var(--warning);
    color: #000;
}

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

/* ---------------------------
   Pagination
--------------------------- */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 8px;
    flex-wrap: wrap;
}

.page-link {
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--gray-light);
    color: var(--secondary);
    font-size: 0.9rem;
    text-decoration: none;
    transition: 0.3s ease;
}

.page-link:hover {
    background: var(--gray-medium);
}

.page-link.active {
    background: var(--primary);
    color: var(--white);
}

/* Masquer le modal par défaut */
.modal.hidden {
    display: none;
}

/* ---------------------------
   Modale (pop-up)
--------------------------- */
.modal {
    position: fixed;
    display: block;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    position: relative;
    animation: fadeIn 0.3s ease;
}

.modal-header {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Animation modale */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------
   Responsive
--------------------------- */
@media (max-width: 992px) {
    .admin-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        width: 100%;
        justify-content: space-between;
    }

    .search-form input[type="text"] {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .admin-table th, 
    .admin-table td {
        padding: 8px;
        font-size: 0.8rem;
    }

    .btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .tabs {
        flex-direction: column;
    }

    .tab-link {
        width: 100%;
        text-align: center;
    }

    .search-form {
        flex-direction: column;
    }

    .search-form input[type="text"],
    .search-form button {
        width: 100%;
    }
}
/* ---------------------------
   FOOTER ADMIN
--------------------------- */
.admin-footer {
    background: #111;
    color: var(--white);
    padding: 15px 20px;
    text-align: center;
    border-top: 1px solid var(--gray-dark);
    margin-top: 20px;
}

.admin-footer-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.admin-footer-container p {
    margin: 0;
}

/* Responsive footer */
@media (max-width: 768px) {
    .admin-footer-container {
        font-size: 0.8rem;
        padding: 10px;
    }
}
/* ============================
   Dashboard Responsive
============================ */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.stat-card i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.stat-card h3 {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 5px;
}

.stat-card p {
    color: var(--gray-dark);
    font-size: 0.9rem;
}

.stat-card:hover {
    transform: translateY(-5px);
}

/* ============================
   Table Responsive
============================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px;
}

/* ============================
   Section commandes
============================ */
.dashboard-section {
    background: var(--white);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================
   Loader
============================ */
.loader {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--gray-dark);
    font-size: 1rem;
}

/* ============================
   Responsive
============================ */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* Recherche produits */
.search-results {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results div {
    padding: 10px;
    cursor: pointer;
}

.search-results div:hover {
    background: #f0f0f0;
}

/* Total */
.total-display {
    text-align: right;
    margin-top: 20px;
    font-size: 1.2rem;
    font-weight: bold;
}
/* === Formulaire produit === */
.admin-form-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 8px rgba(0,0,0,0.05);
    max-width: 900px;
    margin: auto;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
}

.admin-form-group label {
    font-weight: 600;
    margin-bottom: 6px;
}

.admin-form-group input,
.admin-form-group select,
.admin-form-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.admin-form-group textarea {
    resize: vertical;
}

/* Aperçu image */
.image-upload {
    display: flex;
    flex-direction: column;
}

.image-preview-container {
    margin-top: 10px;
    text-align: center;
}

.image-preview-container img {
    max-width: 150px;
    max-height: 150px;
    border-radius: 10px;
    border: 1px solid #ddd;
}

/* Actions */
.admin-form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.btn {
    background: #007bff;
    color: #fff;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-size: 1rem;
}

.btn:hover {
    background: #0056b3;
}

.btn-cancel {
    background: #e0e0e0;
    color: #333;
}

.btn-cancel:hover {
    background: #ccc;
}

/* Responsive */
@media (max-width: 768px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .admin-form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .btn, .btn-cancel {
        width: 100%;
    }
}
/* === Formulaire Catégorie === */
.admin-form-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    max-width: 800px;
    margin: 20px auto;
}

.admin-form-container h1 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.admin-form-group label {
    font-weight: 600;
    margin-bottom: 8px;
}

.admin-form-group input,
.admin-form-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.admin-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.helper-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* Boutons d'action */
.admin-form-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #ddd;
}

/* Messages */
.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .admin-form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
/* === Formulaire Catégorie === */
.admin-form-container {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    max-width: 800px;
    margin: 20px auto;
}

.admin-form-container h1 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.admin-form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #222;
}

.admin-form-group input,
.admin-form-group textarea {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.admin-form-group input:focus,
.admin-form-group textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 4px rgba(0, 123, 255, 0.4);
    outline: none;
}

.admin-form-group textarea {
    resize: vertical;
    min-height: 90px;
}

.helper-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

/* === Actions du formulaire === */
.admin-form-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: #fff;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #ddd;
}

/* === Messages === */
.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

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

/* === Responsive === */
@media (max-width: 768px) {
    .admin-form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
.admin-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.admin-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
}
.modal-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
