/* General Admin Styling (Charte Officielle & Aération Dashboard) */
:root {
    --admin-primary: var(--color-navy, #1A2A40); /* Bleu marine officiel Shopact */
    --admin-secondary: var(--color-orange, #FF6600); /* Orange officiel Shopact */
    --admin-accent: var(--color-orange, #FF6600); /* Boutons d'action principaux en orange selon gemini.md */
    --admin-bg-light: #F8FAFC;
    --admin-bg-dark: #243450;
    --admin-text-light: #F1F5F9;
    --admin-text-dark: #334155;
    --admin-border-color: #E2E8F0;
    --admin-shadow: 0 8px 24px rgba(26, 42, 64, 0.07);
    --admin-shadow-lg: 0 16px 40px rgba(26, 42, 64, 0.12);
    --admin-font-inter: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --admin-font-playfair: 'Playfair Display', Georgia, serif;
    --touch-target: 44px;
}

body {
    font-family: var(--admin-font-inter);
    margin: 0;
    background-color: var(--admin-bg-light);
    color: var(--admin-text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Admin Sidebar */
.admin-sidebar {
    width: 250px;
    background-color: var(--admin-primary);
    color: var(--admin-text-light);
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
}

.sidebar-header h2 {
    font-family: var(--admin-font-playfair);
    color: var(--admin-secondary);
    margin: 0;
    font-size: 1.8em;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    margin-bottom: 15px;
}

.sidebar-nav a {
    color: var(--admin-text-light);
    text-decoration: none;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    min-height: var(--touch-target);
    border-radius: 8px;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background-color: var(--admin-secondary);
    color: var(--admin-primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

/* Admin Main Content */
.admin-main-content {
    flex-grow: 1;
    padding: 30px;
    background-color: var(--admin-bg-light);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--admin-border-color);
}

.main-header h1 {
    margin: 0;
    font-family: var(--admin-font-playfair);
    color: var(--admin-primary);
}

/* Buttons are now handled globally by style.css to ensure UI uniformity */

/* Forms (Moderne & Lisible) */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.92em;
    color: var(--admin-primary);
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--admin-border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-family: var(--admin-font-inter);
    font-size: 0.98em;
    min-height: var(--touch-target);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--admin-secondary);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.15);
}

.form-group textarea {
    resize: vertical;
}

.error-message {
    color: #e74c3c;
    font-size: 0.85em;
    margin-top: 5px;
    display: block;
}

.error-banner {
    background-color: #fdd;
    color: #c0392b;
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    text-align: center;
    border: 1px solid #e74c3c;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.checkbox-label input {
    margin-right: 8px;
}

/* Admin Login Page Specific */
.admin-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-bg-dark) 100%);
}

.admin-login-card {
    background-color: white;
    padding: 40px;
    border-radius: 14px;
    box-shadow: var(--admin-shadow);
    text-align: center;
    width: 92%;
    max-width: 540px;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.admin-login-header {
    margin-bottom: 30px;
}

.admin-logo {
    margin-bottom: 15px;
}

.admin-login-header h1 {
    font-family: var(--admin-font-playfair);
    color: var(--admin-primary);
    margin-bottom: 10px;
}

.admin-login-header p {
    color: var(--admin-text-dark);
    font-size: 0.95em;
}

.admin-login-form {
    text-align: left;
}

.back-link {
    display: inline-flex;
    align-items: center;
    margin-top: 20px;
    color: var(--admin-accent);
    text-decoration: none;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #2980b9;
}

.back-link svg {
    margin-right: 5px;
    transform: rotate(90deg);
}

/* Spinner for loading buttons */
.spinner {
    animation: rotate 0.8s linear infinite;
    margin-right: 8px;
}

.spinner circle {
    stroke: white;
    stroke-dashoffset: 0;
    transform-origin: center;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Product List Styling (Tableau aéré & Dashboard) */
.product-list-section {
    margin-top: 34px;
}

.product-list-section h2 {
    color: var(--admin-primary);
    margin-bottom: 22px;
    font-family: var(--admin-font-playfair);
    font-size: 1.6em;
}

.product-list-container {
    background-color: white;
    padding: 24px;
    border-radius: 14px;
    box-shadow: var(--admin-shadow);
    border: 1px solid var(--admin-border-color);
    overflow-x: auto; /* For responsive tables */
}

.product-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
}

.product-table th,
.product-table td {
    text-align: left;
    padding: 16px 18px;
    border-bottom: 1px solid var(--admin-border-color);
    vertical-align: middle;
}

.product-table th {
    background-color: var(--admin-bg-light);
    font-weight: 700;
    color: var(--admin-primary);
    text-transform: uppercase;
    font-size: 0.82em;
    letter-spacing: 0.6px;
}

.product-table tbody tr { transition: background-color 0.2s ease; }
.product-table tbody tr:hover {
    background-color: #f8fafc;
}

.product-table img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--admin-border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.product-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.product-actions .btn {
    min-height: 44px;
    padding: 8px 14px;
    font-size: 0.86em;
    border-radius: 8px;
}

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

.btn-edit:hover {
    background-color: var(--admin-secondary);
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background-color: #c0392b;
}

/* Modal Styling */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
}

.modal.open {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 10px;
    box-shadow: var(--admin-shadow);
    position: relative;
}

/* Close buttons use global .modal-close */

.modal h2 {
    color: var(--admin-primary);
    margin-top: 0;
    margin-bottom: 20px;
    font-family: var(--admin-font-playfair);
}

.modal .btn-primary {
    margin-top: 20px;
}

/* Grilles interactives pour Tailles (Pointures) et Couleurs dans le modal */
.size-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.size-pill {
    background: #f1f3f5;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 10px 4px;
    font-size: 0.95em;
    font-weight: 600;
    color: var(--admin-text-color);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-pill:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.size-pill.active {
    background: var(--admin-accent);
    color: white;
    border-color: #d35400;
    box-shadow: 0 2px 5px rgba(255, 102, 0, 0.3);
}

.color-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 8px;
}

.color-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-swatch:hover {
    background: #f1f3f5;
    border-color: #adb5bd;
}

.color-swatch.active {
    border-color: var(--admin-accent);
    background: #fff8f3;
    box-shadow: 0 2px 5px rgba(255, 102, 0, 0.15);
}

.color-swatch .color-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    position: relative;
}

.color-swatch.active .color-circle::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 13px;
    font-weight: 800;
    text-shadow: 0 0 3px rgba(0,0,0,0.8);
}

.color-swatch .color-name {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--admin-text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =====================================================
   CORRECTIFS MODALE INSCRIPTION - Plans Abonnement
   ===================================================== */
.plan-option {
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    box-sizing: border-box;
}
.plan-option strong,
.plan-option p {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* =====================================================
   SIDEBAR - Onglet Modération
   ===================================================== */
#sidebarModerationItem {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
    padding-top: 10px;
}
#sidebarModerationItem a {
    color: #ef4444 !important;
    font-weight: 700 !important;
    display: block;
    transition: background 0.2s;
}
#sidebarModerationItem a:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* =====================================================
   TOGGLE STOCK - Formulaire produit admin
   ===================================================== */
.stock-toggle-label {
    user-select: none;
}
.stock-toggle-track {
    cursor: pointer;
    flex-shrink: 0;
}

/* Product Modal Grid Layout */
.product-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.product-form-full-width {
    grid-column: 1 / -1;
}
@media (max-width: 600px) {
    .product-form-grid {
        grid-template-columns: 1fr;
    }
}

#logoutBtn { background: transparent; color: rgba(255, 255, 255, 0.7); border: 1px solid rgba(255, 255, 255, 0.2); width: 100%; margin-top: 20px; transition: all 0.2s; }
#logoutBtn:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; border-color: #ef4444; }
