/* GeoGenie Chantier Pro - Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

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

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

#app {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    width: auto;
    background: white;
    padding: 0.25rem;
    border-radius: 8px;
}

.app-header h1 {
    font-size: 1.5rem;
    flex: 1;
}

.sync-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.sync-btn:hover {
    background: rgba(255,255,255,0.3);
}

.sync-icon {
    font-size: 1.2rem;
}

.sync-status {
    font-size: 0.85rem;
}

/* Navigation */
.main-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-start;
    padding: 0.5rem;
    position: sticky;
    top: 82px;
    z-index: 100;
    box-shadow: var(--shadow);
    overflow: visible;
    gap: 0.5rem;
}

.main-nav::-webkit-scrollbar {
    height: 4px;
}

.main-nav::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.nav-btn {
    background: none;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-secondary);
    transition: all 0.3s;
    border-radius: 8px;
    flex-shrink: 0;
    min-width: 80px;
    white-space: nowrap;
}

.nav-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.nav-btn.active {
    color: var(--primary-color);
    background: var(--bg-color);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-label {
    font-size: 0.85rem;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background: #475569;
}

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

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

/* Gestion Grid */
.gestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gestion-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.gestion-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.gestion-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.card-count {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 1.1rem;
}

/* Rapports List */
.rapports-list {
    display: grid;
    gap: 1rem;
}

.rapport-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.rapport-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

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

.rapport-date {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

.rapport-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.rapport-info {
    display: grid;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    flex: 1;
    min-width: 200px;
}

/* Consultation Tabs */
.consultation-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

/* Modal Container - only visible when has content */
#modalContainer:empty {
    display: none !important;
}

#modalContainer:not(:empty) {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.5);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

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

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

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.page-header-with-close {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.page-header-with-close h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.page-header-with-close .modal-close {
    font-size: 1.8rem;
    padding: 0.25rem 0.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
}

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

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

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

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

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

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

.badge-interim {
    background: #fce7f3;
    color: #9f1239;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        padding: 0.75rem;
    }
    
    .app-header h1 {
        font-size: 1.2rem;
    }
    
    .logo {
        height: 40px;
    }
    
    .main-nav {
        top: 70px;
        padding: 0.25rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-btn {
        padding: 0.5rem 0.75rem;
        min-width: 70px;
    }
    
    .nav-label {
        font-size: 0.7rem;
    }
    
    .nav-icon {
        font-size: 1.2rem;
    }
    
    .main-content,
    #content {
        padding: 0.75rem;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .dashboard-container,
    .page {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .gestion-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-input {
        min-width: 100%;
    }
    
    .consultation-tabs {
        overflow-x: auto;
    }
    
    .tab-btn {
        white-space: nowrap;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    /* animation: fadeIn 0.3s ease-out; - désactivé pour éviter clignotement */
}

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

.spinning {
    animation: spin 1s linear infinite;
}


/* Form Sections */
.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.form-section-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.form-section .form-row:last-child {
    margin-bottom: 0;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.login-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 55vw;
    max-width: 220px;
    height: auto;
    margin-bottom: 0.5rem;
    background: white;
    padding: 10px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.login-header h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

.login-form input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.login-error {
    background: #fee;
    color: var(--danger-color);
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Logout Button */
.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    margin-left: auto;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.logout-btn:active {
    transform: translateY(0);
}

/* Styles pour les nouvelles sections */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Styles pour Stock, Métré, Plans, Réunions, Notes */
#page-stock, #page-metre, #page-plans, #page-reunions, #page-notes {
    padding: 20px;
}

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

.section-header h2 {
    margin: 0;
}

.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.item-card {
    background-color: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.item-card h3 {
    margin-top: 0;
}



/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    transform: translateX(400px);
    transition: transform 0.3s ease-out;
    max-width: 300px;
}

.notification.show {
    transform: translateX(0);
}

.notification-info {
    border-left: 4px solid var(--primary-color);
}

.notification-success {
    border-left: 4px solid var(--success-color);
}

.notification-error {
    border-left: 4px solid var(--danger-color);
}

.notification-warning {
    border-left: 4px solid var(--warning-color);
}

/* Modal Confirm */
.modal-confirm {
    max-width: 400px;
}

.modal-confirm .modal-body {
    padding: 2rem;
    text-align: center;
}

.modal-confirm .modal-body p {
    font-size: 1.1rem;
    margin: 0;
}

/* Items List */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}

.item-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s;
}

.item-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.item-card-content h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.item-card-content p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.item-card-actions {
    display: flex;
    gap: 0.5rem;
}

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

/* Modal Large */
.modal-large {
    max-width: 1000px;
}

/* Rapport Container */
.rapport-container {
    max-width: 1200px;
    margin: 0 auto;
}

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

.rapport-header-section h2 {
    margin: 0;
}

.rapport-actions {
    display: flex;
    gap: 1rem;
}

.rapport-infos-generales,
.rapport-chantiers-section,
.rapport-camions-generaux,
.rapport-recapitulatif,
.rapport-observations,
.rapport-signature {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.rapport-infos-generales h3,
.rapport-chantiers-section h3,
.rapport-camions-generaux h3,
.rapport-recapitulatif h3,
.rapport-observations h3,
.rapport-signature h3 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* Chantier Card */
.chantier-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

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

.chantier-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.chantier-taches {
    margin-bottom: 1.5rem;
}

.chantier-taches h5 {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

.chantier-recapitulatif h5 {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
}

/* Tache Card */
.tache-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

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

.tache-header h6 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.tache-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tache-recap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.recap-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recap-item span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.recap-item strong {
    font-size: 1.1rem;
    color: var(--text-primary);
}

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

.recap-global-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.recap-item-large {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.recap-item-large span {
    color: var(--text-secondary);
    font-size: 1rem;
}

.recap-item-large strong {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.text-large {
    font-size: 1.75rem !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

/* Signature Canvas */
#signatureCanvas {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: crosshair;
    display: block;
    margin-bottom: 1rem;
    background: white;
}

/* Camions List */
.camions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.camion-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Badge Styles */
.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

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

/* Hidden */
.hidden {
    display: none !important;
}

/* Auth Container */
#auth-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#username-display {
    color: white;
    font-weight: 500;
}

#logout-button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

#logout-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Login Screen */
#login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
}

#login-screen h2 {
    color: white;
    margin-bottom: 2rem;
    font-size: 2rem;
}

#login-screen input {
    width: 100%;
    max-width: 300px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
}

#login-screen button {
    width: 100%;
    max-width: 300px;
    padding: 1rem;
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#login-screen button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#login-screen .error {
    color: #fee;
    background: rgba(239, 68, 68, 0.2);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    max-width: 300px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .rapport-header-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rapport-actions {
        flex-direction: column;
    }
    
    .tache-sections {
        flex-direction: column;
    }
    
    .recap-global-grid {
        grid-template-columns: 1fr;
    }
    
    #signatureCanvas {
        width: 100%;
        height: 150px;
    }
}


/* Profile Page Styles */
.profile-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.profile-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.profile-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.info-card {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #555;
}

.info-value {
    color: #2c3e50;
}

.form-card {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 20px;
}

.form-card .form-group {
    margin-bottom: 15px;
}

.form-card label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-card .form-input,
.form-card .form-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-card .form-input:focus,
.form-card .form-select:focus {
    outline: none;
    border-color: #3498db;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    border-left: 4px solid #c33;
}

.admin-section {
    border: 2px solid #f39c12;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
}

.users-list {
    margin-top: 15px;
    overflow-x: auto;
}

.data-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background: #3498db;
    color: white;
    font-weight: 600;
}

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

.btn-icon {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-block;
    margin: 0 2px;
}

.btn-icon:hover {
    transform: scale(1.1);
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.add-user-form {
    background: #f0f8ff;
    border-radius: 6px;
    padding: 20px;
    margin-top: 15px;
    border: 2px solid #3498db;
}

.add-user-form h4 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.info-card ol {
    margin-left: 20px;
    line-height: 1.8;
}

.info-card code {
    background: #2c3e50;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.info-card em {
    color: #7f8c8d;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .profile-container {
        padding: 10px;
    }
    
    .info-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* Stock Management Styles */
.stock-container {
    padding: 20px;
}

.stock-filters {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stock-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

.tab-btn.active {
    border-color: #3498db;
    background: #3498db;
    color: white;
}

.stock-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stock-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.stock-table-container {
    overflow-x: auto;
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.stock-table th,
.stock-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.stock-table th {
    background: #3498db;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.stock-table tbody tr:hover {
    background: #f5f5f5;
}

.stock-row.alerte {
    background: #fff3cd !important;
}

.stock-row.alerte:hover {
    background: #ffe69c !important;
}

.total-row {
    background: #e8f4f8 !important;
    font-weight: bold;
}

.total-row td {
    border-top: 2px solid #3498db;
    padding: 15px 12px;
}

.empty-row {
    text-align: center;
    padding: 40px 20px !important;
    color: #999;
    font-style: italic;
}

.actions-cell {
    white-space: nowrap;
    text-align: center;
    padding: 8px !important;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    margin-top: 20px;
}

.empty-state p {
    font-size: 16px;
    color: #666;
}

/* Mouvements History */
tr.entree {
    background: #d4edda;
}

tr.sortie {
    background: #f8d7da;
}

tr.entree:hover {
    background: #c3e6cb !important;
}

tr.sortie:hover {
    background: #f5c6cb !important;
}

/* Responsive */
@media (max-width: 768px) {
    .stock-tabs {
        flex-direction: column;
    }
    
    .stock-table {
        font-size: 12px;
    }
    
    .stock-table th,
    .stock-table td {
        padding: 8px 4px;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start !important;
    }
    
    .header-actions {
        display: flex;
        gap: 10px;
        width: 100%;
    }
    
    .header-actions button {
        flex: 1;
        font-size: 12px;
    }
}

/* Bordereau Management Styles */
.bordereau-container {
    padding: 20px;
}

.bordereau-filters {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bordereau-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bordereau-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.category-section {
    margin-bottom: 30px;
}

.category-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 16px;
}

.bordereau-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.bordereau-table th,
.bordereau-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.bordereau-table th {
    background: #3498db;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.bordereau-table tbody tr:hover {
    background: #f5f5f5;
}

.total-section {
    margin-top: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.info-display {
    background: #e8f4f8;
    padding: 12px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .bordereau-table {
        font-size: 12px;
    }
    
    .bordereau-table th,
    .bordereau-table td {
        padding: 8px 4px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start !important;
    }
    
    .header-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
}

/* Code Badge Style */
.code-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 13px;
    display: inline-block;
}

/* Ouvriers List Styles */
.ouvriers-list-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    background: #f9f9f9;
}

.ouvriers-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.checkbox-label:hover {
    border-color: #3498db;
    background: #f0f8ff;
}

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

.checkbox-label span {
    flex: 1;
    font-weight: 500;
}

.checkbox-label.has-conflict {
    border-color: #ff9800;
    background: #fff8e1;
}

.checkbox-label.has-conflict:hover {
    background: #ffecb3;
}

.warning-badge {
    background: #ff9800;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 10px;
    white-space: nowrap;
}

.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px;
    margin-top: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.6;
}

.info-box strong {
    color: #1976d2;
}

/* Responsive */
@media (max-width: 768px) {
    .ouvriers-list-container {
        max-height: 300px;
    }
    
    .checkbox-label {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .warning-badge {
        margin-left: 0;
        margin-top: 5px;
    }
}

/* Liste Matériaux Styles */
.liste-materiaux-container {
    padding: 20px;
}

.liste-materiaux-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.materiaux-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.materiaux-table th,
.materiaux-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.materiaux-table th {
    background: #3498db;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.materiaux-table tbody tr:hover {
    background: #f5f5f5;
}

.materiaux-table td.actions-cell {
    white-space: nowrap;
    text-align: center;
    padding: 8px !important;
}

/* Responsive */
@media (max-width: 768px) {
    .materiaux-table {
        font-size: 12px;
    }
    
    .materiaux-table th,
    .materiaux-table td {
        padding: 8px 4px;
    }
}

/* Signature Canvas */
#signatureCanvas {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    cursor: crosshair;
    display: block;
    max-width: 100%;
    height: auto;
    touch-action: none;
}

.signature-section {
    margin-top: 2rem;
}

.signature-section h3 {
    margin-bottom: 1rem;
}

#clearSignatureBtn {
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    #signatureCanvas {
        width: 100%;
        height: 150px;
    }
}


/* Stock Container Modal */
.stock-container-modal {
    padding: 0;
}

.stock-container-modal .stock-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.stock-container-modal .tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.stock-container-modal .tab-btn:hover {
    color: var(--primary-color);
    background: var(--bg-color);
}

.stock-container-modal .tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.stock-container-modal .stock-content {
    max-height: 60vh;
    overflow-y: auto;
}

/* Item Card Actions with Stock Button */
.item-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.item-card-actions .btn-sm {
    white-space: nowrap;
}

/* Modal Large for Stock */
.modal-large .modal-body {
    /* Le défilement est géré par le style général de .modal-body */
}



/* Bordereau Container Modal */
.bordereau-container-modal {
    padding: 0;
}

.bordereau-container-modal .bordereau-content {
    max-height: 60vh;
    overflow-y: auto;
}



/* Progress Bar for Avancement */
.progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background-color: #3b82f6;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 10px;
}

.info-display {
    padding: 10px;
    background: #f3f4f6;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}



/* Avancement Styles */
.avancement-container {
    padding: 1rem;
}

.avancement-global-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.avancement-global-card h4 {
    margin: 0 0 1rem 0;
    font-size: 1.3em;
}

.avancement-tasks {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.avancement-task-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s;
}

.avancement-task-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

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

.task-header > div:first-child {
    flex: 1;
}

.task-percentage {
    margin-left: 1rem;
}

.task-details {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

@media (max-width: 768px) {
    .avancement-task-card {
        padding: 1rem;
    }
    
    .task-header {
        flex-direction: column;
    }
    
    .task-percentage {
        margin-left: 0;
        margin-top: 0.5rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row > div {
        width: 100% !important;
    }
}

/* Styles pour les actions de tâche */
.tache-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tache-header-actions .btn {
    white-space: nowrap;
}


/* ===== BROUILLON ET SAUVEGARDE AUTOMATIQUE ===== */

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

.rapport-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brouillon-badge {
    background: #ff9800;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.auto-save-indicator {
    font-size: 14px;
    color: #4caf50;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.brouillon-card {
    background: #fff3cd;
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.brouillon-card h3 {
    color: #ff9800;
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brouillon-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
}

.brouillon-meta {
    font-size: 14px;
    color: #666;
}

.brouillon-actions {
    display: flex;
    gap: 10px;
}

.brouillon-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
}


/* Plans et Réunions dans la modale chantier */
.plans-grid, .reunions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.plan-card, .reunion-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: box-shadow 0.3s ease;
}

.plan-card:hover, .reunion-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.plan-header, .reunion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.plan-header h4, .reunion-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.plan-version {
    background: #2196f3;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.reunion-date {
    background: #ff9800;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.plan-info, .reunion-info {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

.plan-actions, .reunion-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.plans-chantier-container, .reunions-chantier-container {
    padding: 10px;
}



/* Tabs pour dessin */
.tabs-container {
    margin-top: 10px;
}

.tabs {
    display: flex;
    gap: 5px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 15px;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: var(--bg-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
}

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

/* Canvas toolbar */
.canvas-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.btn-tool {
    background: white;
    border: 2px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    min-width: 40px;
}

.btn-tool:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
}

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

#colorPicker-ordre,
#colorPicker-cr,
#colorPicker-note {
    width: 50px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

#sizePicker-ordre,
#sizePicker-cr,
#sizePicker-note {
    width: 120px;
    cursor: pointer;
}

canvas {
    display: block;
    border-radius: 8px;
    background: white;
    box-shadow: var(--shadow);
    cursor: crosshair;
}

/* Textarea agrandis */
textarea[rows="8"],
textarea[rows="10"],
textarea[rows="15"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

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

/* Responsive canvas */
@media (max-width: 768px) {
    canvas {
        width: 100%;
        height: auto;
    }
    
    .canvas-toolbar {
        justify-content: space-between;
    }
    
    .btn-tool {
        padding: 6px 10px;
        font-size: 16px;
        min-width: 35px;
    }
    
    #sizePicker-ordre,
    #sizePicker-cr,
    #sizePicker-note {
        width: 80px;
    }
}

/* Styles pour la comparaison de coûts dans le métré */
.cout-comparison {
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.cout-label {
    font-size: 0.9rem;
    color: #495057;
    padding: 0.25rem 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.badge-green {
    background: #28a745 !important;
    color: white !important;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
}

.badge-red {
    background: #dc3545 !important;
    color: white !important;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 1rem;
}

.ecart-quantite {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .cout-comparison {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .cout-label,
    .badge-green,
    .badge-red,
    .ecart-quantite {
        width: 100%;
        text-align: left;
    }
}



/* Styles pour l'affichage de la semaine et des horaires */
.semaine-display {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #1565c0;
}

.horaires-travail {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.horaires-travail h4 {
    margin: 0 0 1rem 0;
    color: #495057;
    font-size: 1.1rem;
}

.horaires-travail .form-row {
    gap: 1rem;
}

.horaires-travail input[type="time"] {
    font-size: 1rem;
    padding: 0.5rem;
}

/* Responsive pour mobile */
@media (max-width: 768px) {
    .horaires-travail .form-row {
        flex-direction: column;
    }
    
    .horaires-travail .form-group {
        width: 100%;
    }
}



/* Styles pour les alertes */
.alert {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert p {
    margin: 0.5rem 0;
}

.alert strong {
    color: #000;
}

.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}



/* Styles pour le récapitulatif ouvriers */
.rapport-recapitulatif-ouvriers {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.ouvriers-recap-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ouvrier-recap-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border: 2px solid #28a745;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ouvrier-recap-card.has-depassement {
    border-color: #ffc107;
    background: #fffbf0;
}

.ouvrier-recap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.ouvrier-recap-header h4 {
    margin: 0 0 0.5rem 0;
    color: #2563eb;
    font-size: 1.2rem;
}

.ouvrier-recap-total {
    text-align: right;
}

.ouvrier-recap-total span {
    display: block;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.ouvrier-recap-total strong {
    font-size: 1.5rem;
    color: #000;
}

.ouvrier-recap-details {
    margin: 1rem 0;
}

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

.details-table th {
    background: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}

.details-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.details-table .total-row {
    background: #f8f9fa;
    font-weight: bold;
}

.details-table .total-row td {
    border-top: 2px solid #dee2e6;
    border-bottom: none;
}

.ouvrier-recap-calcul {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

.badge-success {
    background: #28a745;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #000;
}

/* Responsive */
@media (max-width: 768px) {
    .ouvrier-recap-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .ouvrier-recap-total {
        text-align: left;
        width: 100%;
    }
    
    .details-table {
        font-size: 0.9rem;
    }
    
    .details-table th,
    .details-table td {
        padding: 0.5rem;
    }
}



/* Styles pour les rapports hebdomadaire et mensuel */
.rapport-hebdo-container,
.rapport-mensuel-container {
    padding: 2rem;
}

.rapport-hebdo-header,
.rapport-mensuel-header {
    margin-bottom: 2rem;
}

.rapport-hebdo-header h2,
.rapport-mensuel-header h2 {
    margin-bottom: 1rem;
}

.rapport-hebdo-controls,
.rapport-mensuel-controls {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.rapport-hebdo-info,
.rapport-mensuel-info {
    background: #e3f2fd;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid #2196f3;
}

.rapport-hebdo-info h3,
.rapport-mensuel-info h3 {
    margin: 0 0 0.5rem 0;
    color: #1565c0;
}

.rapport-hebdo-info p,
.rapport-mensuel-info p {
    margin: 0.25rem 0;
    color: #424242;
}

.alert-info {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #17a2b8;
    margin-top: 1rem;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #dc3545;
}

.ouvriers-hebdo-list,
.ouvriers-mensuel-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ouvrier-hebdo-card,
.ouvrier-mensuel-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border: 2px solid #28a745;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ouvrier-hebdo-card.has-depassement-hebdo {
    border-color: #dc3545;
    background: #fff5f5;
}

.ouvrier-hebdo-header,
.ouvrier-mensuel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.ouvrier-hebdo-header h4,
.ouvrier-mensuel-header h4 {
    margin: 0;
    color: #2563eb;
    font-size: 1.2rem;
}

.ouvrier-mensuel-badges {
    display: flex;
    gap: 0.5rem;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.ouvrier-hebdo-details,
.ouvrier-mensuel-stats {
    margin: 1rem 0;
}

.ouvrier-mensuel-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.stat-card.stat-warning {
    background: #fff3cd;
    border-color: #ffc107;
}

.stat-card.stat-total {
    background: #e3f2fd;
    border-color: #2196f3;
}

.stat-label {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #000;
}

.ouvrier-mensuel-moyenne {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #666;
}

.ouvrier-mensuel-moyenne strong {
    color: #000;
    font-size: 1.1rem;
    margin-left: 0.5rem;
}

.loading,
.empty-state,
.error-state {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.error-state {
    color: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .rapport-hebdo-controls,
    .rapport-mensuel-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rapport-hebdo-controls .form-group,
    .rapport-mensuel-controls .form-group {
        width: 100%;
    }
    
    .ouvrier-hebdo-header,
    .ouvrier-mensuel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .ouvrier-mensuel-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}



/* Styles pour la section heures ouvrier */
.heures-ouvrier-container {
    padding: 1rem;
}

.heures-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.heures-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    border: 2px solid #28a745;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.heures-card.has-depassement {
    border-color: #dc3545;
    background: #fff5f5;
}

.heures-card h3 {
    margin: 0 0 1rem 0;
    color: #2563eb;
    font-size: 1.1rem;
}

.heures-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #000;
}

.stat-value.text-danger {
    color: #dc3545;
}

.stat-value.text-warning {
    color: #ffc107;
}

.heures-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .heures-summary {
        grid-template-columns: 1fr;
    }
    
    .heures-actions {
        flex-direction: column;
    }
}



/* Styles pour les options d'export PDF */
.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.export-section {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.export-section h4 {
    margin: 0 0 1rem 0;
    color: #2563eb;
    font-size: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin: 0.25rem 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.checkbox-label:hover {
    background: white;
}

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

.checkbox-label span {
    flex: 1;
    font-size: 0.9rem;
    color: #333;
}

.export-presets {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #dee2e6;
}

.export-presets p {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #666;
}

@media (max-width: 768px) {
    .export-options {
        grid-template-columns: 1fr;
    }
}



/* Styles pour les rapports journaliers par chantier */
.rapports-chantier-container {
    padding: 1rem;
}

.rapports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.rapports-list {
    display: grid;
    gap: 1rem;
}

.rapport-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.rapport-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.rapport-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.rapport-card-header h4 {
    margin: 0;
    color: #2563eb;
    font-size: 1.1rem;
}

.rapport-card-body {
    margin-bottom: 1rem;
}

.rapport-stats {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
}

.rapport-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rapport-stats .stat-icon {
    font-size: 1.5rem;
}

.rapport-stats .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2563eb;
}

.rapport-stats .stat-label {
    color: #666;
    font-size: 0.9rem;
}

.rapport-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.rapport-view {
    padding: 1rem;
}

.rapport-info-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.rapport-info-section h4 {
    margin: 0 0 1rem 0;
    color: #2563eb;
}

.rapport-info-section p {
    margin: 0.5rem 0;
    color: #333;
}

.rapport-chantier-section {
    margin-bottom: 2rem;
}

.rapport-tache {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.rapport-tache h5 {
    margin: 0 0 1rem 0;
    color: #2563eb;
    font-size: 1.1rem;
}

.rapport-subsection {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.rapport-subsection h6 {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.95rem;
    font-weight: bold;
}

.rapport-subsection ul {
    margin: 0;
    padding-left: 1.5rem;
}

.rapport-subsection li {
    margin: 0.25rem 0;
    color: #333;
}

@media (max-width: 768px) {
    .rapports-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .rapport-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .rapport-stats {
        flex-direction: column;
        gap: 1rem;
    }
}



/* Informations détaillées des ouvriers */
.ouvrier-info-details {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.ouvrier-numero {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: #f1f5f9;
    color: #475569;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.ouvrier-type {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

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

/* Responsive pour les informations ouvriers */
@media (max-width: 768px) {
    .ouvrier-info-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}



/* Prévisualisation email */
.email-preview {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.email-preview .form-group {
    margin-bottom: 1rem;
}

.email-preview label {
    display: block;
    margin-bottom: 0.5rem;
    color: #495057;
}

.email-preview p {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    margin: 0;
}

.email-preview .form-textarea {
    width: 100%;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

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

/* Bouton succès */
.btn-success {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Texte informatif */
.info-text {
    color: #6c757d;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}



/* Interface de répartition bordereau */
.modal-xlarge {
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
}

.repartition-summary {
    background: #f0f9ff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
}

.repartition-summary h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.ressources-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.ressources-summary span {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}

.position-repartition-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.position-header h5 {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.ressources-repartition {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.ressources-repartition h6 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.ressource-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: white;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.ressource-item label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-input-sm {
    width: 100px;
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.cout-label {
    min-width: 100px;
    text-align: right;
    font-weight: 500;
    color: var(--success-color);
}

.position-cout-total {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-color);
    text-align: right;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.validation-summary {
    background: #fffbeb;
    border: 2px solid var(--warning-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.validation-summary h4 {
    color: var(--warning-color);
    margin-bottom: 1rem;
}

.validation-section {
    margin-bottom: 1rem;
}

.validation-section h6 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.validation-section div {
    padding: 0.25rem 0;
    font-size: 0.9rem;
}

.validation-total {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--warning-color);
    font-size: 1.1rem;
}

.unit-label {
    margin-left: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}



/* ========================================
   Section Dégâts
   ======================================== */

.degats-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #fff5f5;
    border-left: 4px solid #ef4444;
    border-radius: 4px;
}

.degats-section h5 {
    color: #dc2626;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.degats-empty {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
    font-style: italic;
}

/* Carte Dégât */
.degat-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s;
}

.degat-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.degat-card.degat-alert {
    border-color: #ef4444;
    border-width: 2px;
    background-color: #fef2f2;
}

/* En-tête Dégât */
.degat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.degat-type {
    font-weight: 600;
    font-size: 1rem;
    color: #374151;
}

.degat-statut {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
}

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

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

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

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

/* Corps Dégât */
.degat-body {
    margin-bottom: 0.75rem;
}

.degat-body p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.degat-body strong {
    color: #374151;
    font-weight: 600;
}

.alert-text {
    color: #dc2626 !important;
    font-weight: 600 !important;
    margin-top: 0.5rem !important;
    padding: 0.5rem;
    background-color: #fee2e2;
    border-radius: 4px;
}

/* Actions Dégât */
.degat-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Récapitulatif Pertes */
.recap-pertes {
    color: #dc2626;
    font-weight: 600;
    padding: 0.5rem;
    background-color: #fee2e2;
    border-radius: 4px;
    margin-top: 0.5rem;
}

.recap-pertes-detail {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .degat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .degat-actions {
        justify-content: flex-start;
    }
}



/* Styles pour les tableaux d'historique des heures */
.heures-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.heures-section h3 {
    margin: 0 0 1rem 0;
    color: #2563eb;
    font-size: 1.2rem;
}

.table-heures {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table-heures thead {
    background-color: #f8fafc;
}

.table-heures th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.table-heures td {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.table-heures tbody tr:hover {
    background-color: #f8fafc;
}

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

@media (max-width: 768px) {
    .heures-section {
        padding: 1rem;
    }
    
    .table-heures {
        font-size: 0.9rem;
    }
    
    .table-heures th,
    .table-heures td {
        padding: 0.5rem 0.25rem;
    }
}



/* Primary Modal Content Styles */
.modal-content {
    background-color: var(--card-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.large-modal {
    max-width: 900px;
}

.modal-content .modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg, #ffffff);
}

.modal-content .modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary, #1f2937);
}

.modal-content .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    background: var(--card-bg, #ffffff);
}

.modal-content .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--card-bg, #ffffff);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: var(--bg-color, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

/* Secondary Modal Styles for Category Management */
#categoryModalContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000; /* Higher than main modal */
    display: none;
}

.modal-backdrop-secondary {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Slightly lighter backdrop */
}

.modal-content-secondary {
    background-color: var(--card-bg);
    margin: 10% auto; /* 10% from the top and centered */
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1001;
    max-width: 500px;
    width: 90%;
}

/* Ensure the modal content inside is styled like a regular modal */
.modal-content-secondary .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-content-secondary .modal-body {
    padding: 15px 0;
}

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



/* ===== Quantity Tracker Dashboard ===== */

.quantity-dashboard {
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.dashboard-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.dashboard-header h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.quantity-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.summary-card.total {
    border-left-color: #2196F3;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.1), rgba(33, 150, 243, 0.05));
}

.summary-card.usable {
    border-left-color: #4CAF50;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(76, 175, 80, 0.05));
}

.summary-card.lost {
    border-left-color: #F44336;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1), rgba(244, 67, 54, 0.05));
}

.summary-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-primary);
}

.quantity-breakdown,
.quantity-by-site,
.detailed-breakdown {
    margin-bottom: 2rem;
}

.quantity-breakdown h4,
.quantity-by-site h4,
.detailed-breakdown h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.quantity-table,
.detailed-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.quantity-table thead,
.detailed-table thead {
    background: var(--primary-color);
    color: white;
}

.quantity-table th,
.detailed-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.quantity-table td,
.detailed-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.quantity-table tbody tr:hover,
.detailed-table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.quantity-table tbody tr:last-child,
.detailed-table tbody tr:last-child {
    border-bottom: none;
}

.total-row {
    background-color: rgba(37, 99, 235, 0.1);
    font-weight: bold;
    border-top: 2px solid var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    transition: width 0.3s ease;
    min-width: 30px;
}

/* Responsive */
@media (max-width: 768px) {
    .quantity-summary {
        grid-template-columns: 1fr;
    }

    .quantity-table,
    .detailed-table {
        font-size: 0.9rem;
    }

    .quantity-table th,
    .quantity-table td,
    .detailed-table th,
    .detailed-table td {
        padding: 0.5rem;
    }

    .summary-value {
        font-size: 1.4rem;
    }
}


/* ===== Liste Matériel ===== */

.liste-materiel-container {
    padding: 1.5rem;
}

.materiau-section {
    margin-bottom: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

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

.materiau-header h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
}

.materiau-total {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9rem;
}

.materiel-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.materiel-table thead {
    background: var(--primary-color);
    color: white;
}

.materiel-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.materiel-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.materiel-table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.total-section {
    text-align: center;
    padding: 1rem;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    margin-top: 2rem;
}

.total-section p {
    color: var(--primary-color);
    font-weight: bold;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .materiel-table {
        font-size: 0.9rem;
    }

    .materiel-table th,
    .materiel-table td {
        padding: 0.5rem;
    }

    .materiau-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .materiau-total {
        width: 100%;
        text-align: center;
    }
}


/* ===== Recherche Globale ===== */

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.search-container {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.global-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: white;
    color: #1f2937 !important;
    -webkit-text-fill-color: #1f2937 !important;
    transition: all 0.3s;
}

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

.global-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-results-container {
    padding: 1rem 0;
}

.search-category {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.search-category:last-child {
    border-bottom: none;
}

.search-category h4 {
    padding: 0.5rem 1rem;
    margin: 0;
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    background-color: rgba(37, 99, 235, 0.05);
}

.search-result-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s;
    border-left: 3px solid transparent;
}

.search-result-item:hover {
    background-color: rgba(37, 99, 235, 0.05);
    border-left-color: var(--primary-color);
}

.result-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.result-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.4;
}

.result-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

.search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .search-container {
        max-width: 100%;
    }

    .global-search-results {
        max-height: 400px;
    }
}


/* ===== Recherche Locale ===== */

.page-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.local-search-input {
    flex: 1;
    max-width: 300px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: white;
    color: var(--text-color);
    transition: all 0.3s;
}

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

.no-results-message {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .page-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .local-search-input {
        max-width: 100%;
    }
}

/* ===== Statuts Unifiés ===== */

/* Statuts Équipements */
.statut-disponible {
    background-color: #10b981;
    color: white;
}

.statut-en-service {
    background-color: #3b82f6;
    color: white;
}

.statut-prete {
    background-color: #f59e0b;
    color: white;
}

.statut-en-panne {
    background-color: #f97316;
    color: white;
}

.statut-en-reparation {
    background-color: #6b7280;
    color: white;
}

.statut-hors-service {
    background-color: #ef4444;
    color: white;
}

.statut-perdu {
    background-color: #dc2626;
    color: white;
}

/* Statuts Locations */
.statut-location-en-cours {
    background-color: #10b981;
    color: white;
}

.statut-location-retournee {
    background-color: #6b7280;
    color: white;
}

.statut-location-en-retard {
    background-color: #ef4444;
    color: white;
    animation: pulse-warning 1.5s infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Statuts Chantiers */
.statut-chantier-en-cours {
    background-color: #10b981;
    color: white;
}

.statut-chantier-en-attente {
    background-color: #f59e0b;
    color: white;
}

.statut-chantier-termine {
    background-color: #3b82f6;
    color: white;
}

.statut-chantier-cloture {
    background-color: #ef4444;
    color: white;
}

/* Badge de statut générique */
.statut-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Export Rapports Page */
.export-rapports-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
}

.export-rapports-container .page-header {
    margin-bottom: 1.5rem;
}

.export-rapports-container .page-subtitle {
    color: #666;
    margin-top: 0.5rem;
}

.export-filters {
    margin-bottom: 1.5rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s;
}

.filter-tab:hover {
    background: #f3f4f6;
}

.filter-tab.active {
    background: var(--primary-color);
    color: white;
}

.filter-content {
    display: none;
    padding: 1rem 0;
}

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

.resultats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.export-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.resultats-summary {
    margin-bottom: 1rem;
}

.rapports-liste {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rapport-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.rapport-item:hover {
    background: #f1f5f9;
}

.rapport-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rapport-item-info strong {
    color: var(--text-primary);
}

.rapport-chantiers {
    color: #666;
    font-size: 0.9rem;
}

.rapport-item-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .filter-tabs {
        flex-direction: column;
    }
    
    .resultats-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .export-buttons {
        width: 100%;
    }
    
    .export-buttons .btn {
        flex: 1;
    }
}

/* Permissions System Styles */
.permissions-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.permissions-section h4 {
    margin: 0 0 15px 0;
    color: #1e40af;
    font-size: 1.1rem;
}

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

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.permission-category {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 12px;
}

.permission-category h5 {
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #3b82f6;
    color: #1e40af;
    font-size: 0.85rem;
    font-weight: 600;
}

.permission-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.permission-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.permission-checkbox:hover {
    background: #f1f5f9;
}

.permission-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.permission-checkbox span {
    font-size: 0.85rem;
    color: #374151;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

.templates-manager {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.templates-manager h4 {
    margin: 0 0 15px 0;
    color: #1e40af;
}

.edit-template-form,
.add-user-form,
.edit-user-form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .permissions-grid {
        grid-template-columns: 1fr;
    }
    
    .permissions-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .permissions-actions select,
    .permissions-actions button {
        width: 100%;
        margin: 5px 0;
    }
}

/* Alerte Pointage Dashboard */
.pointage-alerte-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.pointage-alerte-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.3);
}

.pointage-alerte-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.pointage-alerte-icon {
    font-size: 1.5rem;
}

.pointage-alerte-title {
    font-weight: 600;
    font-size: 1rem;
    color: #92400e;
}

.pointage-alerte-content {
    font-size: 0.95rem;
    color: #78350f;
    margin-bottom: 8px;
}

.pointage-alerte-action {
    font-size: 0.85rem;
    color: #b45309;
    font-weight: 500;
    text-align: right;
}

.gestion-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .gestion-actions {
        flex-direction: column;
    }
    
    .gestion-actions .btn {
        width: 100%;
    }
}

/* Rapports Engins */
.rapports-engins-page {
    padding: 0;
}

.rapports-engins-page .page-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.rapports-engins-page .filters-bar,
.rapports-engins-page .stats-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.rapports-engins-page .filters-bar .form-control,
.rapports-engins-page .stats-filters .form-control {
    min-width: 150px;
    max-width: 200px;
}

.rapports-engins-page .export-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.rapports-liste {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.rapport-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-left: 4px solid #3b82f6;
}

.rapport-card.etat-panne {
    border-left-color: #ef4444;
    background: #fef2f2;
}

.rapport-card.etat-surveiller {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.rapport-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.rapport-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.etat-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

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

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

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

.rapport-details {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 8px;
}

.rapport-taches {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 5px;
}

.rapport-anomalies {
    font-size: 0.9rem;
    color: #dc2626;
    background: #fef2f2;
    padding: 8px;
    border-radius: 6px;
    margin-top: 8px;
}

.rapport-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.form-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-card textarea.form-control {
    width: 100%;
    min-width: 100%;
    resize: none;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #1e40af;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 5px;
}

.heures-engins-list h4 {
    margin-bottom: 15px;
    color: #1e40af;
}

.engin-heures-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .rapport-details {
        flex-direction: column;
        gap: 5px;
    }
    
    .rapports-engins-page .filters-bar .form-control {
        min-width: 100%;
        max-width: 100%;
    }
}

/* Non utilisés tab styles */
.non-utilises-section {
    padding: 15px 0;
}

.engins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.engin-check-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-left: 4px solid #94a3b8;
}

.engin-check-card.status-ok {
    border-left-color: #22c55e;
    background: #f0fdf4;
}

.engin-check-card.status-non-utilise {
    border-left-color: #6b7280;
    background: #f3f4f6;
}

.engin-check-card.status-warning {
    border-left-color: #f59e0b;
    background: #fffbeb;
}

.engin-check-card .engin-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.engin-check-card .engin-type {
    font-size: 12px;
    color: #64748b;
}

.engin-check-card .engin-status {
    font-size: 13px;
    font-weight: 500;
}

/* Date range filters */
.date-range-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.date-filter-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-filter-item label {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

.date-filter-item input[type="date"] {
    width: auto;
    min-width: 140px;
    max-width: 160px;
}

/* Formulaire nouveau rapport - champs plus larges */
.rapports-engins-page .form-card .form-control {
    width: 100%;
    min-width: 0;
}

.rapports-engins-page .form-card select.form-control {
    width: 100%;
}

@media (max-width: 768px) {
    .rapports-engins-page .form-row {
        flex-direction: column;
    }
    
    .rapports-engins-page .form-row .form-group {
        width: 100%;
    }
}
