/* =================================================================
   ADMIN.CSS - Styles centralisés pour l'administration
   ================================================================= */

/* Admin Top Header */
.admin-top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.admin-top-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-burger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.3s ease;
}

.menu-burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #2c2c2c;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-burger:hover span {
    background: #c9a66b;
}

.menu-burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.menu-burger.active span:nth-child(2) {
    opacity: 0;
}

.menu-burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.admin-top-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c2c2c;
    letter-spacing: 0.3px;
}

.admin-top-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: #fafafa;
    border-radius: 25px;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-profile:hover {
    background: #c9a66b;
    color: white;
    border-color: #c9a66b;
}

.admin-profile:hover .admin-avatar {
    border-color: white;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1100;
}

.admin-profile.active .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.85rem 1.25rem;
    color: #2c2c2c;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
    border-bottom: none;
}

.dropdown-item:hover {
    background: #c9a66b;
    color: white;
}

.admin-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c9a66b;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.admin-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 60px;
}

/* Sidebar */
.admin-sidebar {
    width: 220px;
    position: fixed;
    top: 60px;
    left: 0;
    height: calc(100vh - 60px);
    overflow-y: auto;
    background: #3d2617;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: left 0.3s ease;
}

.admin-sidebar.collapsed {
    left: -220px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

.nav-item {
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.2px;
    border-left: 3px solid transparent;
    margin: 0.1rem 0;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: #fff;
    border-left-color: #c9a66b;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
}

.nav-item span {
    font-size: 1.1rem;
}

/* Menu parent avec sous-menu */
.nav-item-parent {
    margin: 0.1rem 0;
}

.nav-item-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-arrow {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    margin-left: auto;
    font-weight: 300;
}

.nav-item-parent.active .nav-arrow,
.nav-item-parent.open .nav-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.nav-item-parent.active .nav-submenu,
.nav-item-parent.open .nav-submenu {
    max-height: 200px;
}

.nav-subitem {
    padding: 0.6rem 1.25rem 0.6rem 3rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    font-weight: 400;
}

.nav-subitem:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-subitem.active {
    color: #c9a66b;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 1.5rem 2rem;
    max-width: 100%;
    overflow-x: hidden;
    transition: margin-left 0.3s ease;
}

.admin-main.expanded {
    margin-left: 0;
}

.admin-header {
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0;
    letter-spacing: -0.2px;
}

/* Bloc principal de contenu avec espacement réduit - v3 */
.admin-content {
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem !important;
    overflow-x: auto;
}

/* Force le margin-bottom même si autre chose essaie de l'écraser */
.admin-main > .admin-content {
    margin-bottom: 1.5rem !important;
}

.admin-content:last-child {
    margin-bottom: 0;
}

.admin-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--accent-gold);
}

/* Grid pour mettre plusieurs admin-content côte à côte */
.admin-content-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-content-grid:last-child {
    margin-bottom: 0;
}

/* Grid avec 3 colonnes */
.admin-content-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Grid avec proportions personnalisées */
.admin-content-grid.layout-60-40 {
    grid-template-columns: 60% 1fr;
}

.admin-content-grid.layout-70-30 {
    grid-template-columns: 70% 1fr;
}

.admin-content-grid.layout-40-60 {
    grid-template-columns: 40% 1fr;
}

.admin-content-grid.layout-30-70 {
    grid-template-columns: 30% 1fr;
}

/* Grid avec colonnes auto (s'adaptent au contenu) */
.admin-content-grid.auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* admin-content dans une grid n'a pas besoin de margin-bottom */
.admin-content-grid .admin-content {
    margin-bottom: 0 !important;
}

/* Responsive pour la grid */
@media (max-width: 968px) {
    .admin-content-grid,
    .admin-content-grid.cols-3,
    .admin-content-grid.layout-60-40,
    .admin-content-grid.layout-70-30,
    .admin-content-grid.layout-40-60,
    .admin-content-grid.layout-30-70,
    .admin-content-grid.auto-fit {
        grid-template-columns: 1fr;
    }
}

/* Messages d'alerte avec espacement pour admin */
.admin-main .alert {
    margin-bottom: 1.5rem !important;
}

/* Overlay pour mobile - SUPPRIMÉ (pas besoin du gris) */
.sidebar-overlay {
    display: none;
}

/* =================================================================
   ADMIN SPECIFIC STYLES - Gestion des Administrateurs
   ================================================================= */

.create-form {
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.create-form h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: #2c2c2c;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.admins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.admin-card {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.admin-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.admin-card .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #e0e0e0;
    gap: 0.5rem;
    box-shadow: none;
}

.admin-username {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c2c2c;
    word-break: break-word;
}

.admin-role {
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.role-admin {
    background: linear-gradient(135deg, #c9a66b, #b8935a);
    color: white;
}

.role-gestion_commandes {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
}

.role-visualisateur {
    background: linear-gradient(135deg, #607d8b, #455a64);
    color: white;
}

.admin-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #757575;
    margin-bottom: 1rem;
}

.admin-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.status-badge {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-active {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

.status-inactive {
    background: #f44336;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
    transform: translateY(-1px);
}

/* Modaux */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c2c2c;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.modal-content form {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.modal-actions .btn {
    flex: 1;
}

/* =================================================================
   ADMIN RESPONSIVE
   ================================================================= */

@media (max-width: 968px) {
    .admin-top-header {
        padding: 0 1rem;
    }

    .admin-top-logo {
        font-size: 1.1rem;
    }

    .admin-name {
        display: none;
    }

    .admin-sidebar {
        width: 200px;
    }

    .admin-sidebar.collapsed {
        left: -200px;
    }

    .admin-main {
        margin-left: 200px;
        padding: 1.25rem;
    }

    .admin-main.expanded {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .admin-top-header {
        height: 56px;
        padding: 0 0.75rem;
    }

    .admin-layout {
        padding-top: 56px;
    }

    .admin-sidebar {
        width: 280px;
        top: 56px;
        height: calc(100vh - 56px);
        left: -280px;
    }

    .admin-sidebar.active {
        left: 0;
    }

    .sidebar-overlay {
        top: 56px;
        height: calc(100vh - 56px);
    }

    .nav-item {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        gap: 0.875rem;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: #c9a66b;
        background: rgba(255, 255, 255, 0.1);
    }

    .nav-item span {
        font-size: 1.3rem;
    }

    .admin-main {
        margin-left: 0;
        padding: 1rem;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.25rem;
    }

    .admin-header h2 {
        font-size: 1.5rem;
    }

    .admin-content {
        padding: 1.25rem;
    }

    .admin-profile {
        padding: 0.4rem 0.75rem;
    }

    .admin-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .admins-grid {
        grid-template-columns: 1fr;
    }

    .admin-actions {
        flex-direction: column;
    }

    .admin-actions .btn {
        width: 100%;
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .admin-top-header {
        padding: 0 0.5rem;
    }

    .admin-top-logo {
        font-size: 1rem;
    }

    .admin-main {
        padding: 0.75rem;
    }

    .admin-header {
        padding: 1rem;
    }

    .admin-header h2 {
        font-size: 1.3rem;
    }

    .admin-content {
        padding: 1rem;
    }
}

/* =================================================================
   CONTENT SECTIONS - Classes pour structurer le contenu
   ================================================================= */

/* Section générique pour séparer les différentes parties du contenu */
.content-section {
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.content-section:last-child {
    margin-bottom: 0;
}

.content-section h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #2c2c2c;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--accent-gold);
}

/* Section avec fond coloré pour mettre en valeur */
.content-section.highlight {
    background: linear-gradient(135deg, #faf9f7 0%, #ffffff 100%);
    border: 2px solid var(--accent-gold);
    box-shadow: 0 4px 12px rgba(201, 166, 107, 0.15);
}

/* Section d'alerte ou d'avertissement */
.content-section.warning {
    background: #fff9e6;
    border: 2px solid #ffc107;
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.15);
}

.content-section.warning h3 {
    color: #856404;
    border-bottom-color: #ffc107;
}

/* Section de succès */
.content-section.success {
    background: #f0f9f4;
    border: 2px solid #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.content-section.success h3 {
    color: #155724;
    border-bottom-color: #28a745;
}

/* Section d'information */
.content-section.info {
    background: #e8f4f8;
    border: 2px solid #17a2b8;
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.15);
}

.content-section.info h3 {
    color: #0c5460;
    border-bottom-color: #17a2b8;
}

/* Section compacte avec moins de padding */
.content-section.compact {
    padding: 1.5rem;
}

/* Grid de sections (2 colonnes) */
.content-sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
}

/* Pour forcer une section sur toute la largeur dans une grid */
.content-section.full-width {
    grid-column: 1 / -1;
}

/* Espacement entre les sections */
.admin-content > .content-section {
    margin-bottom: 2rem;
}

.admin-content > .content-section:last-child,
.admin-content > .content-sections-grid:last-child {
    margin-bottom: 0;
}

/* Responsive pour les sections */
@media (max-width: 968px) {
    .content-sections-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .content-section {
        padding: 1.5rem;
    }

    .content-section h3 {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: 1.25rem;
    }

    .content-section h3 {
        font-size: 1.2rem;
        padding-bottom: 0.75rem;
        margin-bottom: 1rem;
    }
}
