/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 0.8;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

.badge-alerts {
    background: #ff4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.75rem;
    margin-left: 5px;
}

.badge-critical {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #333;
}

.badge-info {
    background: #17a2b8;
    color: white;
}

.badge-open {
    background: #dc3545;
    color: white;
}

.badge-in_progress {
    background: #ffc107;
    color: #333;
}

.badge-resolved {
    background: #28a745;
    color: white;
}

.badge-ignored {
    background: #6c757d;
    color: white;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Dashboard */
.dashboard h2 {
    margin-bottom: 2rem;
    color: #333;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.kpi-icon {
    font-size: 2.5rem;
}

.kpi-content h3 {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.kpi-content p {
    color: #666;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.stats-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-card h3 {
    margin-bottom: 1rem;
    color: #333;
}

.stats-content p {
    margin: 0.5rem 0;
    color: #666;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    color: #333;
}

.filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.filter-select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-primary {
    padding: 0.5rem 1.5rem;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

/* Table */
.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8f9fa;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table .loading,
.data-table .empty,
.data-table .error {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.data-table .error {
    color: #dc3545;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-gsa {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-tsa {
    background: #fff3e0;
    color: #f57c00;
}

.badge-en_cours {
    background: #e8f5e9;
    color: #388e3c;
}

.badge-en_pause {
    background: #fff9c4;
    color: #f57f17;
}

.badge-termine {
    background: #e0e0e0;
    color: #616161;
}

.badge-annule {
    background: #ffebee;
    color: #c62828;
}

.badge-success {
    background: #e8f5e9;
    color: #388e3c;
}

.badge-warning {
    background: #fff9c4;
    color: #f57f17;
}

.badge-danger {
    background: #ffebee;
    color: #c62828;
}

.badge-blocked {
    background: #fce4ec;
    color: #c2185b;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
}

/* Detail Pages */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.detail-left, .detail-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.detail-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.detail-card h3 {
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row strong {
    color: #666;
    min-width: 150px;
}

.description-text {
    color: #333;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.photo-item {
    text-align: center;
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.photo-item p {
    margin: 0.5rem 0 0.25rem;
    font-size: 0.85rem;
    color: #666;
}

.photo-item small {
    color: #999;
    font-size: 0.75rem;
}

.upload-section {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-text, .textarea-input, .select-input {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    width: 100%;
}

.textarea-input {
    min-height: 80px;
    resize: vertical;
}

.actions-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-secondary {
    padding: 0.5rem 1.5rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    padding: 0.5rem 1.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-success {
    padding: 0.5rem 1.5rem;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.btn-success:hover {
    background: #218838;
}

.compliance-badge {
    padding: 1rem;
    text-align: center;
    border-radius: 8px;
    margin: 1rem 0;
}

.loading-container, .error-container {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.error-container {
    color: #dc3545;
}

.data-table a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.data-table a:hover {
    text-decoration: underline;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.artisans-list {
    margin-top: 1rem;
}

.artisan-item {
    padding: 1rem;
    margin: 0.5rem 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.artisan-item:hover {
    background: #f5f5f5;
}

.artisan-details {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
}

.refresh-indicator {
    font-size: 0.85rem;
    z-index: 100;
}

.refresh-indicator.refreshing {
    color: #667eea;
}

.refresh-indicator.ok {
    color: #28a745;
}

.refresh-indicator.error {
    color: #dc3545;
}

.refresh-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ia-alert {
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-weight: 500;
}

.ia-alert.alert-critical {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ia-alert.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Responsive */
@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .filters {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

