/* TDF Manager - Admin CSS */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #1e293b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --radius: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    background: var(--light);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--dark);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    padding: 10px 20px 5px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
}

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

.nav-item .icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px 30px;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.page-subtitle {
    color: var(--secondary);
    margin-top: 5px;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    background: var(--light);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
}

.stat-card .label {
    color: var(--secondary);
    font-size: 0.875rem;
}

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger { border-left: 4px solid var(--danger); }
.stat-card.info { border-left: 4px solid var(--info); }

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--light);
    font-weight: 600;
    color: var(--secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td {
    background: var(--light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

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

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

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
}

.btn-outline:hover {
    background: var(--light);
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--dark);
}

.form-group .hint {
    font-size: 12px;
    color: var(--secondary);
    margin-top: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #e2e8f0;
    color: #475569;
}

/* Status badges */
.status-pending { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-done { background: #d1fae5; color: #065f46; }
.status-draft { background: #e2e8f0; color: #475569; }
.status-planned { background: #dbeafe; color: #1e40af; }

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

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

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

.login-header h1 {
    font-size: 1.75rem;
    color: var(--dark);
}

.login-header p {
    color: var(--secondary);
    margin-top: 5px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

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

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--secondary);
    transition: all 0.2s;
}

.tab:hover {
    color: var(--dark);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--dark);
    margin-bottom: 10px;
}

/* Map container */
.map-container {
    height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* File upload */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.file-upload:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.file-upload input {
    display: none;
}

.file-upload .icon {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 15px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE - VERSION MOBILE
   ============================================ */

/* Bouton hamburger */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--dark);
    color: white;
    padding: 0 15px;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
}

.mobile-header h1 {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hamburger {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
}

/* Overlay pour fermer le menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
}

.sidebar-overlay.active {
    display: block;
}

/* Mobile < 768px */
@media (max-width: 768px) {
    /* Header mobile visible */
    .mobile-header {
        display: flex;
    }
    
    /* Sidebar en drawer */
    .sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 999;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-header {
        display: none; /* Caché car on a le mobile-header */
    }
    
    /* Contenu principal */
    .main-content {
        margin-left: 0;
        padding: 75px 12px 20px 12px; /* Padding top pour le header fixe */
    }
    
    /* Stats en grille 2x2 */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .value {
        font-size: 1.5rem;
    }
    
    .stat-card .icon {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    .stat-card .label {
        font-size: 0.75rem;
    }
    
    /* Page header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 12px;
        margin-bottom: 15px;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .btn-group {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    /* Cards */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-body {
        padding: 12px 15px;
    }
    
    /* Form row en colonne */
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Tableaux */
    .table-container {
        margin: 0 -15px;
        padding: 0 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 500px;
    }
    
    th, td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Boutons plus gros pour touch */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    /* Formulaires */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="url"],
    select,
    textarea {
        padding: 12px 14px;
        font-size: 16px; /* Évite le zoom sur iOS */
    }
    
    /* Modals */
    .modal {
        width: 95%;
        max-height: 85vh;
        margin: 10px;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    /* Alerts */
    .alert {
        padding: 12px 15px;
        font-size: 13px;
    }
    
    /* Planning table - format spécial */
    .planning-mobile {
        display: block;
    }
    
    .planning-desktop {
        display: none;
    }
    
    /* Login page */
    .login-box {
        padding: 25px 20px;
    }
    
    /* File upload */
    .file-upload {
        padding: 25px 15px;
    }
    
    /* Empty state */
    .empty-state {
        padding: 40px 15px;
    }
    
    .empty-state .icon {
        font-size: 3rem;
    }
}

/* Très petit écran < 380px */
@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    
    .stat-card .icon {
        margin-bottom: 0;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--secondary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

