/* ============================================
   CHATRENCONTRE - Admin CSS
   Styles du back-office - Full Responsive
   ============================================ */

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    overflow-x: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: rgba(15, 15, 15, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 1.5rem;
}

.sidebar-nav { flex: 1; overflow-y: auto; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
}

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

.sidebar-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    min-width: 20px;
    opacity: 0.7;
}

.sidebar-link.active svg { opacity: 1; }

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: white;
    z-index: 150;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s ease;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle svg {
    width: 24px;
    height: 24px;
}

/* Mobile Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* ============================================
   HEADER
   ============================================ */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card.primary::before { background: #3b82f6; }
.stat-card.success::before { background: #22c55e; }
.stat-card.warning::before { background: #f59e0b; }
.stat-card.danger::before { background: #ef4444; }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
}

.stat-change {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    max-width: 50%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.stat-change.up { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.stat-change.down { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* ============================================
   TABLES - Responsive
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

.admin-table {
    width: 100%;
    min-width: 600px;
    background: transparent;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    padding: 1rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    white-space: nowrap;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Mobile Card View for Tables */
.mobile-card-list {
    display: none;
}

.mobile-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.mobile-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.mobile-card-row {
    color: rgba(255, 255, 255, 0.5);
}

.mobile-card-row span {
    color: rgba(255, 255, 255, 0.8);
}

.mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ============================================
   BADGES
   ============================================ */
.badge { 
    display: inline-flex; 
    padding: 0.25rem 0.75rem; 
    border-radius: 999px; 
    font-size: 0.75rem; 
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    white-space: nowrap;
}

.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-primary:disabled { background: #3b82f680; cursor: not-allowed; }
.btn-secondary { background: rgba(255, 255, 255, 0.05); color: rgba(255, 255, 255, 0.7); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
}

/* Action buttons */
.action-btns { display: flex; gap: 0.5rem; }
.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}
.action-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.action-btn.danger:hover { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* ============================================
   CARDS
   ============================================ */
.admin-card {
    background: rgba(26, 26, 26, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group { margin-bottom: 1.25rem; }
.form-label { 
    display: block; 
    font-size: 0.875rem; 
    font-weight: 500; 
    color: rgba(255, 255, 255, 0.7); 
    margin-bottom: 0.5rem; 
}
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.9375rem;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}
.form-input:focus { outline: none; border-color: #3b82f6; }
.form-input::placeholder { color: rgba(255, 255, 255, 0.3); }

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

/* Filter Form */
.filter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-form .form-input {
    width: auto;
    min-width: 120px;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.pagination-info {
    padding: 0.5rem 1rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Loading Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.animate-spin {
    animation: spin 1s linear infinite;
}

/* ============================================
   RESPONSIVE - TABLET (1024px)
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid.lg\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   RESPONSIVE - MOBILE (768px)
   ============================================ */
@media (max-width: 768px) {
    /* Sidebar Mobile */
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }
    
    .sidebar-overlay.active {
        pointer-events: auto;
    }
    
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Main Content */
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-bottom: 5rem; /* Space for floating button */
    }
    
    /* Header */
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-title {
        font-size: 1.5rem;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    .stat-change {
        font-size: 0.65rem;
        padding: 0.15rem 0.35rem;
    }
    
    /* Cards */
    .admin-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .admin-card-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Tables - Hide on mobile, show cards */
    .table-wrapper {
        display: none;
    }
    
    .mobile-card-list {
        display: block;
    }
    
    /* Filter Form */
    .filter-form {
        width: 100%;
    }
    
    .filter-form .form-input {
        flex: 1;
        min-width: 0;
    }
    
    .filter-form .btn {
        width: 100%;
    }
    
    /* Pagination */
    .pagination {
        gap: 0.25rem;
    }
    
    .pagination .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   RESPONSIVE - SMALL MOBILE (480px)
   ============================================ */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-card-body {
        grid-template-columns: 1fr;
    }
    
    .action-btns {
        flex-wrap: wrap;
    }
    
    .btn-sm {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }
}
