/* ==========================================================================
   DESIGN SYSTEM : GREEN & CLEAN (EcoCollect Pro)
   ========================================================================== */
:root {
    --bg-app: #f4f6f8;
    --text-main: #1e293b;       /* Ardoise sombre */
    --text-muted: #64748b;     /* Gris bleuté doux */
    
    /* Dégradés et couleurs émeraude */
    --color-primary: #059669;       /* Émeraude principal */
    --color-primary-light: #10b981; /* Vert d'eau émeraude */
    --color-primary-glow: rgba(5, 150, 105, 0.15);
    --color-secondary: #0ea5e9;     /* Bleu ciel doux */
    
    /* Cartes & Tables */
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(226, 232, 240, 0.8);
    --card-shadow: rgba(148, 163, 184, 0.08);
    
    /* Types de déchets color-coding */
    --color-om: #64748b;            /* Gris ardoise (Ordures Ménagères) */
    --color-tri: #eab308;           /* Jaune (Tri Sélectif) */
    --color-verre: #059669;         /* Vert émeraude (Verre) */
    --color-vegetaux: #65a30d;      /* Vert olive (Végétaux) */
    --color-encombrants: #a855f7;   /* Violet vif (Encombrants) */
    --color-alimentaire: #ea580c;   /* Orange cuivré (Alimentaire) */

    /* Boutons et États */
    --color-danger: #e11d48;
    --color-danger-light: rgba(225, 29, 72, 0.1);
    
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESETS & GLOBAL STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Background gradients overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    background: radial-gradient(circle at 10% 20%, rgba(16, 185, 129, 0.04) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(14, 165, 233, 0.04) 0%, transparent 40%);
    pointer-events: none;
}

/* ==========================================================================
   GLASSMORPHISM / CARDS
   ========================================================================== */
.glass {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 30px var(--card-shadow),
                0 1px 3px rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ==========================================================================
   APPLICATION LAYOUT
   ========================================================================== */
.app-container {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 15px 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
}

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

.logo-emoji {
    font-size: 2.2rem;
    animation: rotateLogo 20s infinite linear;
}

@keyframes rotateLogo {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-text h1 .badge {
    font-size: 0.65rem;
    font-family: var(--font-sans);
    font-weight: 700;
    background-color: #d1fae5;
    color: #065f46;
    padding: 2px 6px;
    border-radius: 50px;
    letter-spacing: 0.5px;
}

.logo-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Navigation Tabs */
.app-nav {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 50px;
    border: 1px solid #e2e8f0;
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-normal);
}

.nav-tab:hover {
    color: var(--text-main);
}

.nav-tab.active {
    color: white;
    background: var(--color-primary);
    box-shadow: 0 4px 10px rgba(5, 150, 105, 0.25);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-status-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 50px;
}

.auth-status-indicator.unlocked {
    color: var(--color-primary);
    background: #d1fae5;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-lock {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--text-main);
}

.btn-lock:hover {
    background: #e2e8f0;
}

.btn-lock.unlocked {
    background: #d1fae5;
    border-color: #a7f3d0;
    color: #065f46;
}

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

.btn-primary:hover:not(:disabled) {
    background: #047857;
    box-shadow: 0 4px 12px var(--color-primary-glow);
}

.btn-primary:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: white;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-danger-link {
    background: transparent;
    color: var(--color-danger);
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.btn-danger-link:hover:not(:disabled) {
    background: var(--color-danger-light);
}

.btn-danger-link:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

/* ==========================================================================
   WORKSPACE PANES
   ========================================================================== */
.app-main {
    flex: 1;
    position: relative;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   SECTION 1 : CONSULTATION LAYOUT
   ========================================================================== */
.search-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    align-items: start;
}

.search-sidebar {
    padding: 20px;
}

.search-sidebar h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 5px;
}

.section-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.4;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
    position: relative;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group select, .form-group input {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 10px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--text-main);
    outline: none;
    transition: var(--transition-fast);
}

.form-group select:focus, .form-group input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Autocomplete Suggestions */
.search-box-wrapper {
    position: relative;
}

.suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    width: 440px;
    max-width: 90vw;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    margin-top: 4px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 320px;
    overflow-y: auto;
    display: none;
}

.suggestions-list.active {
    display: block;
}

.suggestion-item {
    padding: 10px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: var(--transition-fast);
    text-align: left;
}

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

.suggestion-item:hover {
    background: #f1f5f9;
    color: var(--color-primary);
}

.suggestion-city {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 4px;
    float: right;
}

/* Quick Stats Card */
.quick-stats-card {
    margin-top: 15px;
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Empty State */
.empty-results-state {
    background: white;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: inline-block;
}

.empty-results-state h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-main);
    margin-bottom: 8px;
}

/* Site Details & Calendar */
.site-detail-card {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: white;
}

.site-detail-card.hidden {
    display: none;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 20px;
    gap: 20px;
}

.site-city-badge {
    background: #d1fae5;
    color: #065f46;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: 50px;
    display: inline-block;
    margin-bottom: 6px;
}

#site-display-name {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
}

.site-sectors-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    min-width: 320px;
}

.sector-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sector-badge.om {
    background-color: #f1f5f9;
    border: 1px solid #94a3b8;
    border-left: 5px solid var(--color-om);
    color: #1e293b;
}

.sector-badge.tri {
    background-color: #fef08a;
    border: 1px solid #eab308;
    border-left: 5px solid #ca8a04;
    color: #854d0e;
}

.sector-badge.verre {
    background-color: #d1fae5;
    border: 1px solid #34d399;
    border-left: 5px solid var(--color-verre);
    color: #065f46;
}

.sector-badge.vegetaux {
    background-color: #ecfccb;
    border: 1px solid #a3e635;
    border-left: 5px solid var(--color-vegetaux);
    color: #3f6212;
}

.sector-badge.encombrants {
    background-color: #f3e8ff;
    border: 1px solid #c084fc;
    border-left: 5px solid var(--color-encombrants);
    color: #581c87;
}

.sector-badge.alimentaire {
    background-color: #ffedd5;
    border: 1px solid #fb923c;
    border-left: 5px solid var(--color-alimentaire);
    color: #7c2d12;
}

/* Grille Hebdomadaire */
.weekly-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
}

.calendar-day-col {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.day-header {
    background: #eaeef3;
    color: var(--text-main);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
    padding: 10px 5px;
    border-bottom: 1px solid #e2e8f0;
}

.calendar-day-col.today {
    border-color: var(--color-primary-light);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.calendar-day-col.today .day-header {
    background: #d1fae5;
    color: #065f46;
}

.day-collect-list {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
}

/* Collect Cards inside calendar days */
.collect-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.collect-card-title {
    font-weight: 700;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    text-transform: uppercase;
}

/* Badges de déchet */
.collect-card[data-type="OM"] {
    background-color: #f1f5f9;
    border: 1px solid #94a3b8;
    border-left: 5px solid var(--color-om);
}
.collect-card[data-type="OM"] .collect-card-title {
    background: #cbd5e1;
    color: #1e293b;
}

.collect-card[data-type="TRI"] {
    background-color: #fef08a;
    border: 1px solid #eab308;
    border-left: 5px solid #ca8a04;
}
.collect-card[data-type="TRI"] .collect-card-title {
    background: #fde047;
    color: #854d0e;
}

.collect-card[data-type="VERRE"] {
    background-color: #d1fae5;
    border: 1px solid #34d399;
    border-left: 5px solid var(--color-verre);
}
.collect-card[data-type="VERRE"] .collect-card-title {
    background: #a7f3d0;
    color: #065f46;
}

.collect-card[data-type="VEGETAUX"] {
    background-color: #ecfccb;
    border: 1px solid #a3e635;
    border-left: 5px solid var(--color-vegetaux);
}
.collect-card[data-type="VEGETAUX"] .collect-card-title {
    background: #d9f99d;
    color: #3f6212;
}

.collect-card[data-type="ENCOMBRANTS"] {
    background-color: #f3e8ff;
    border: 1px solid #c084fc;
    border-left: 5px solid var(--color-encombrants);
}
.collect-card[data-type="ENCOMBRANTS"] .collect-card-title {
    background: #e9d5ff;
    color: #581c87;
}

.collect-card[data-type="ALIMENTAIRE"] {
    background-color: #ffedd5;
    border: 1px solid #fb923c;
    border-left: 5px solid var(--color-alimentaire);
}
.collect-card[data-type="ALIMENTAIRE"] .collect-card-title {
    background: #fed7aa;
    color: #7c2d12;
}

.collect-time {
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.3;
}

.collect-sector {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* No collect item */
.no-collect-info {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-align: center;
    margin-top: 15px;
    font-style: italic;
}

/* ==========================================================================
   EDITORS STYLES (TABLES & SHEETS)
   ========================================================================== */
.editor-layout {
    padding: 25px;
    background: white;
}

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

.editor-title h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
}

.editor-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.input-search-table {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    outline: none;
    min-width: 200px;
    transition: var(--transition-fast);
}

.input-search-table:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.select-filter-table {
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
    outline: none;
    background: white;
    cursor: pointer;
}

/* Data Table Grid */
.table-container {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    max-height: 480px;
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.data-table thead th {
    background: #1e293b;
    color: white;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: var(--transition-fast);
}

.data-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #f1f5f9;
}

.data-table tbody td {
    padding: 10px 16px;
    color: var(--text-main);
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Edit Mode table fields */
.data-table tbody td.editable {
    cursor: pointer;
    position: relative;
    transition: var(--transition-fast);
}

/* Style when auth is active (Editing enabled) */
body.edit-mode-unlocked .data-table tbody td.editable:hover {
    background: #e2f2e9;
    outline: 1px dashed var(--color-primary-light);
}

.cell-input {
    width: 100%;
    border: 1px solid var(--color-primary-light);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    outline: none;
    box-shadow: 0 0 0 2px var(--color-primary-glow);
    background: white;
}

.col-actions {
    text-align: center;
    width: 100px;
}

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.save-indicator {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fef3c7;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    animation: pulse 2s infinite;
}

.save-indicator.hidden {
    display: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ==========================================================================
   MODAL / AUTOPASSWORD
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 420px;
    padding: 25px;
    background: white;
    transform: scale(0.95);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--text-main);
}

.modal-body p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.error-msg {
    color: var(--color-danger);
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg);
    padding: 12px 25px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--color-primary-light);
    box-shadow: 0 0 6px var(--color-primary-light);
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
    .search-layout {
        grid-template-columns: 1fr;
    }
    
    .weekly-calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        text-align: center;
    }
    
    .header-logo {
        flex-direction: column;
        gap: 5px;
    }
    
    .app-nav {
        flex-direction: column;
        border-radius: var(--radius-md);
        padding: 5px;
    }
    
    .nav-tab {
        border-radius: var(--radius-sm);
        padding: 8px;
    }
    
    .nav-tab.active {
        box-shadow: none;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .weekly-calendar-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .site-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .site-sectors-grid {
        grid-template-columns: repeat(2, 1fr);
        min-width: 0;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .editor-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-search-table, .select-filter-table, .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .weekly-calendar-grid {
        grid-template-columns: 1fr;
    }
    
    .site-sectors-grid {
        grid-template-columns: 1fr;
    }
}

/* Drag and Drop visual feedback */
.data-table tbody tr.drag-over {
    border-top: 3px solid var(--color-primary-light);
    background-color: #ecfdf5 !important;
}

body.edit-mode-unlocked .data-table tbody tr {
    cursor: grab;
}

body.edit-mode-unlocked .data-table tbody tr:active {
    cursor: grabbing;
}

/* ==========================================================================
   BIN ORDERS CARD & STYLES (EcoCollect Pro)
   ========================================================================== */
.site-orders-card {
    margin-top: 25px;
    padding: 20px 25px;
}

.orders-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #d1fae5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.orders-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.order-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: var(--transition-fast);
}

.order-item:hover {
    box-shadow: 0 4px 12px rgba(148, 163, 184, 0.05);
    border-color: #cbd5e1;
}

.order-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px dashed #e2e8f0;
    padding-bottom: 8px;
}

.order-meta strong {
    color: var(--text-main);
}

.order-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.contact-link.web {
    background: #e0f2fe;
    color: #0369a1;
}

.contact-link.web:hover {
    background: #bae6fd;
}

.contact-link.mail {
    background: #f0fdf4;
    color: #15803d;
}

.contact-link.mail:hover {
    background: #dcfce7;
}

.contact-link.tel {
    background: #ecfdf5;
    color: #047857;
}

.contact-link.tel:hover {
    background: #d1fae5;
}

.order-method {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 5px;
}

.order-observations {
    background: #fff7ed;
    border-left: 4px solid #f97316;
    padding: 12px 15px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #7c2d12;
    line-height: 1.45;
    margin-top: 5px;
    white-space: pre-line;
}

.table-link {
    color: var(--color-primary);
    text-decoration: underline;
    font-weight: 500;
}

.table-link:hover {
    color: var(--color-primary-light);
}

.edit-cell-icon {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-left: 4px;
}

/* ==========================================================================
   ECRAN DE CONNEXION (EcoCollect Pro)
   ========================================================================== */
.login-screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.99));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.login-screen-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.02);
}

.login-card {
    width: 90%;
    max-width: 440px;
    padding: 35px;
    background: white;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08), 
                0 1px 3px rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.login-logo-emoji {
    font-size: 3rem;
    animation: rotateLogo 25s infinite linear;
}

.login-header h2 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.8rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.login-body {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-footer {
    display: flex;
    flex-direction: column;
    margin-top: 10px;
}

.login-footer .btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    justify-content: center;
}

.user-display-name {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-tab.hidden {
    display: none !important;
}

.hidden:not(.login-screen-overlay) {
    display: none !important;
}

/* Schedule Groups Styles */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.group-profile-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.group-profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    border-color: var(--color-primary-light);
}

.group-profile-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-sites-count {
    background: var(--color-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 50px;
}

.group-calendar-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    background: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px dashed #cbd5e1;
}

.group-calendar-day {
    display: flex;
    align-items: flex-start;
    border-bottom: 1px dashed #cbd5e1;
    padding: 8px 0;
}

.group-calendar-day:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.group-day-name {
    width: 80px;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--text-main);
    padding-top: 5px; /* align with badge text */
}

.group-day-badges {
    display: grid;
    grid-template-columns: repeat(3, minmax(85px, 95px));
    gap: 4px 6px;
    justify-content: start;
    align-items: center;
    flex-grow: 1;
}

.group-collect-badge-placeholder {
    width: 100%;
    height: 25px;
    visibility: hidden;
}

.group-day-time {
    color: var(--color-primary);
    font-weight: 500;
    text-align: right;
}

.group-sites-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 150px;
    overflow-y: auto;
    font-size: 0.85rem;
    padding-right: 5px;
}

.group-site-item {
    padding: 6px 10px;
    background: #f1f5f9;
    border-radius: 4px;
    color: var(--text-main);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.group-site-item:hover {
    background: var(--color-primary);
    color: white;
}

.group-site-item:hover .time-badge {
    border-color: rgba(255, 255, 255, 0.4) !important;
}

/* Time badges in site list */
.time-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 0.725rem;
    font-weight: 600;
    border-radius: 4px;
    margin: 1px;
    white-space: nowrap;
    transition: border-color var(--transition-fast);
}

/* Group Calendar Collect Badges */
.group-collect-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    margin: 2px;
    border: 1px solid #cbd5e1;
}

.group-day-badges .group-collect-badge {
    width: 100%;
    margin: 0;
    padding: 3px 4px;
    font-size: 0.68rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.group-collect-badge[data-type="OM"] {
    background-color: #f1f5f9;
    border-color: #94a3b8;
    color: #1e293b;
    border-left: 4px solid var(--color-om);
}
.group-collect-badge[data-type="TRI"] {
    background-color: #fef08a;
    border-color: #eab308;
    color: #854d0e;
    border-left: 4px solid #ca8a04;
}
.group-collect-badge[data-type="VERRE"] {
    background-color: #d1fae5;
    border-color: #34d399;
    color: #065f46;
    border-left: 4px solid var(--color-verre);
}
.group-collect-badge[data-type="VEGETAUX"] {
    background-color: #ecfccb;
    border-color: #a3e635;
    color: #3f6212;
    border-left: 4px solid var(--color-vegetaux);
}
.group-collect-badge[data-type="ENCOMBRANTS"] {
    background-color: #f3e8ff;
    border-color: #c084fc;
    color: #581c87;
    border-left: 4px solid var(--color-encombrants);
}
.group-collect-badge[data-type="ALIMENTAIRE"] {
    background-color: #ffedd5;
    border-color: #fb923c;
    color: #7c2d12;
    border-left: 4px solid var(--color-alimentaire);
}

/* Section-based City rows for Group Schedule */
.city-group-section {
    width: 100%;
    margin-bottom: 30px;
}

.city-row-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 12px;
    border-bottom: 2px solid var(--color-primary-glow);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.city-groups-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

.city-groups-row .group-profile-card {
    max-width: 600px;
    width: 100%;
}

@media (max-width: 900px) {
    .city-groups-row {
        grid-template-columns: 1fr;
    }
}

