/* Reset et base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

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

/* Login */
.login-form {
    max-width: 420px;
    margin: 50px auto;
    padding: 40px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.login-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
    font-weight: 600;
}

/* User Info */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-info strong {
    color: #2c3e50;
}

/* Navigation */
.nav-tabs {
    display: flex;
    background: white;
    border-radius: 15px;
    margin-bottom: 2rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

.nav-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    color: #666;
    text-align: center;
    cursor: pointer;
    border: none;
    background: none;
    min-width: 180px;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-tab:hover {
    background-color: #f8f9fa;
    color: #2c3e50;
}

.nav-tab.active {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-weight: 600;
}

/* Content */
.tab-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-height: 600px;
}

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

.content-header h2 {
    color: #2c3e50;
    font-weight: 600;
}

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

/* Cards */
.card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

.card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h3::before {
    content: "📋";
    font-size: 1.2rem;
}

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

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

input:invalid {
    border-color: #e74c3c;
}

textarea {
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
}

/* Buttons */
button, .btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-primary {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.btn-secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.btn-danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
}

.btn-danger-small {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Date rows */
.date-row {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

.date-row:not(:first-child) .remove-date {
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 600;
    color: #2c3e50;
}

.table tr:hover {
    background-color: #f8f9fa;
}

.table input {
    margin: 0;
    padding: 0.5rem;
}

/* Signature */
.signature-container {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    background: white;
}

.signature-canvas {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: crosshair;
    display: block;
    margin: 1rem auto;
    background: white;
    touch-action: none;
}

.signature-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Photo preview */
.photo-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.photo-preview {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #dee2e6;
}

/* Intervention cards */
.intervention-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.intervention-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

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

.intervention-header h3 {
    color: #2c3e50;
    margin: 0;
}

.intervention-date {
    background: #3498db;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

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

.intervention-detail {
    display: flex;
    flex-direction: column;
}

.intervention-detail strong {
    color: #2c3e50;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

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

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
    margin-top: 2rem;
}

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

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

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #3498db;
    display: block;
}

.stat-label {
    color: #666;
    margin-top: 0.5rem;
    font-weight: 500;
}

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

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header {
        padding: 1.5rem 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .nav-tabs {
        flex-direction: column;
    }
    
    .nav-tab {
        min-width: auto;
    }
    
    .content-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .filters {
        width: 100%;
        flex-direction: column;
    }
    
    .user-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .intervention-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .intervention-actions {
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .signature-controls {
        flex-direction: column;
    }
    
    .signature-canvas {
        width: 100%;
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .login-form {
        margin: 20px auto;
        padding: 20px;
    }
    
    .card {
        padding: 1rem;
    }
    
    .intervention-details {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .nav-tabs, .form-actions, .btn, button {
        display: none;
    }
    
    .tab-content {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .intervention-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a1a;
        --bg-secondary: #2d2d2d;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #404040;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
