/**
 * Styles Assistance TAFILALET - Version Corrigée
 */

/* Variables CSS */
:root {
    --primary-color: #dc2626;
    --primary-dark: #991b1b;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-red: 0 4px 6px -1px rgba(220, 38, 38, 0.2);
}

/* Reset & Global */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-small {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-small img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-left h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    color: white;
    font-weight: 600;
    font-size: 1.05rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(10px);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding: 2rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #dc2626;
}

.dashboard-header h2 {
    color: #1e293b;
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #1e293b 0%, #64748b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 0.625rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.02em;
}

.btn-primary {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    box-shadow: var(--shadow-red);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    box-shadow: 0 6px 12px rgba(220, 38, 38, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 1.75rem;
    border-bottom: 2px solid #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, white 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.btn-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--secondary-color);
    line-height: 1;
    transition: all 0.2s;
}

.btn-close:hover {
    color: #dc2626;
    transform: scale(1.1);
}

/* Forms */
.mission-form, .modal-form {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Search Bar */
.search-bar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-bar input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
}

/* Missions List */
.missions-list {
    padding: 1.5rem;
}

.mission-item {
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mission-item:hover {
    border-color: #dc2626;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
    transform: translateY(-2px);
}

.mission-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.mission-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
}

.mission-meta {
    color: var(--secondary-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.mission-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.detail-label {
    font-size: 0.75rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.detail-value {
    color: var(--dark-color);
}

/* Mission Type Select */
.mission-type-select {
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
}

.mission-type-select option {
    font-size: 1rem;
    padding: 0.5rem;
}

/* Mission Type Badges */
.mission-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.mission-type-badge {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mission-type-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.mission-type-depannage {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
}

.mission-type-taxi {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: white;
}

.mission-type-ambulance {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    color: white;
}

/* Smaller badges for tables */
.mission-type-badge-sm {
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

.mission-type-badge-sm.mission-type-depannage {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
}

.mission-type-badge-sm.mission-type-taxi {
    background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
    color: white;
}

.mission-type-badge-sm.mission-type-ambulance {
    background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
    color: white;
}

.badge-pointed {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    background-color: #d4edda;
    color: #155724;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 8px;
}

.amount-text {
    color: #dc2626;
    font-size: 1.05rem;
    font-weight: 600;
}

/* Error & Success Messages */
.error-message {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    font-weight: 500;
}

.success-message {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    font-weight: 500;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: white;
    border-radius: 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 2.5rem;
    border: 1px solid var(--border-color);
}

.logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-placeholder {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fef2f2 0%, white 100%);
    border-radius: 1.25rem;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.1);
}

.logo-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-container h1 {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--secondary-color);
    font-size: 1.05rem;
    font-weight: 500;
}

.login-form {
    margin: 2rem 0;
}

.login-footer {
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--secondary-color);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 80px);
}

.sidebar {
    width: 250px;
    background: white;
    box-shadow: var(--shadow);
    padding: 2rem 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-link {
    padding: 1rem 2rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.nav-link:hover {
    background: var(--light-color);
}

.nav-link.active {
    background: var(--light-color);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

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

.tab-content {
    display: none;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.75rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card.highlight {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    border: none;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.stat-card.highlight h3 {
    color: rgba(255, 255, 255, 0.9);
}

.stat-value {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--dark-color);
    line-height: 1;
}

.stat-card.highlight .stat-value {
    color: white;
}

/* Filters Bar */
.filters-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filters-bar input,
.filters-bar select {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

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

.data-table thead {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
}

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

.data-table tr:hover {
    background: var(--light-color);
}

.point-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Action buttons */
.btn-edit, .btn-delete, .btn-toggle {
    padding: 0.4rem 0.6rem;
    margin: 0 0.15rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.3rem;
    transition: transform 0.2s;
}

.btn-edit:hover, .btn-delete:hover, .btn-toggle:hover {
    transform: scale(1.2);
}

.btn-edit {
    color: #007bff;
}

.btn-delete {
    color: #dc3545;
}

.btn-toggle {
    color: #ffc107;
}

/* Daily Total Card */
.daily-total-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.5rem;
    text-align: center;
}

.daily-total-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    opacity: 0.95;
    font-weight: 600;
}

.total-amount {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

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

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 800px;
}

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

.modal-header h3 {
    font-size: 1.5rem;
    color: var(--dark-color);
    font-weight: 700;
}

.modal-form {
    padding: 1.5rem;
}

/* Loading & Empty States */
.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
    font-size: 1.05rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--secondary-color);
    font-style: italic;
    font-size: 1.05rem;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .header-left h1 {
        font-size: 1.25rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .mission-details {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-bar {
        flex-direction: column;
    }
    
    .filters-bar input,
    .filters-bar select {
        min-width: auto;
    }
    
    .data-table {
        font-size: 0.875rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
    
    .login-card {
        padding: 2rem 1.5rem;
    }
    
    .logo-placeholder {
        width: 80px;
        height: 80px;
    }
    
    .logo-container h1 {
        font-size: 1.75rem;
    }
}
