/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin: 0 -20px 2rem -20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.breadcrumb {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: white;
    text-decoration: none;
    opacity: 0.8;
}

.breadcrumb a:hover {
    opacity: 1;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.nav-btn {
    display: inline-block;
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.nav-btn.primary {
    background: #4CAF50;
    color: white;
}

.nav-btn.primary:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.nav-btn.secondary {
    background: #2196F3;
    color: white;
}

.nav-btn.secondary:hover {
    background: #1976D2;
    transform: translateY(-2px);
}

/* Main content */
main {
    flex: 1;
    margin-bottom: 2rem;
}

/* Stats section */
.stats-section {
    margin-bottom: 3rem;
}

.stats-section h2 {
    margin-bottom: 1rem;
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    color: #666;
    font-weight: 500;
}

/* Recent interventions */
.recent-section h2 {
    margin-bottom: 1rem;
    color: #333;
}

.interventions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.intervention-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.intervention-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.intervention-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.intervention-header h3 {
    color: #333;
    font-size: 1.3rem;
}

.intervention-date {
    color: #666;
    font-size: 0.9rem;
    background: #f0f0f0;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.intervention-details p {
    margin-bottom: 0.5rem;
    color: #555;
}

.intervention-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background: #2196F3;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-small:hover {
    background: #1976D2;
}

.btn-small.secondary {
    background: #FF9800;
}

.btn-small.secondary:hover {
    background: #F57C00;
}

/* Features section */
.features-section {
    margin-top: 3rem;
}

.features-section h2 {
    margin-bottom: 2rem;
    text-align: center;
    color: #333;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 1rem;
    color: #333;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
}

/* Forms */
.intervention-form {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 2rem;
}

.form-section h2 {
    margin-bottom: 1.5rem;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Camera section */
.camera-section {
    margin-bottom: 2rem;
}

.camera-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.btn-camera,
.btn-upload {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-camera {
    background: #4CAF50;
    color: white;
}

.btn-camera:hover {
    background: #45a049;
}

.btn-upload {
    background: #FF9800;
    color: white;
}

.btn-upload:hover {
    background: #F57C00;
}

.camera-container {
    position: relative;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

#cameraVideo {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
}

.btn-capture,
.btn-stop {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-capture {
    background: #2196F3;
    color: white;
}

.btn-capture:hover {
    background: #1976D2;
}

.btn-stop {
    background: #f44336;
    color: white;
}

.btn-stop:hover {
    background: #d32f2f;
}

/* Photos preview */
.photos-preview h3 {
    margin-bottom: 1rem;
    color: #333;
}

.photos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.photo-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.photo-info {
    padding: 1rem;
}

.photo-timestamp {
    font-size: 0.9rem;
    color: #666;
    display: block;
    margin-bottom: 0.5rem;
}

.btn-remove {
    background: #f44336;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-remove:hover {
    background: #d32f2f;
}

.no-photos {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.btn-primary,
.btn-secondary {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-secondary:hover {
    background: #555;
}

.btn-danger {
    background: #f44336;
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

/* Gallery controls */
.gallery-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    gap: 1rem;
}

.search-section {
    display: flex;
    gap: 1rem;
    flex: 1;
    min-width: 300px;
}

.search-input,
.date-filter {
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.search-input {
    flex: 1;
}

.btn-clear {
    padding: 0.8rem 1.5rem;
    background: #666;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-clear:hover {
    background: #555;
}

.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    padding: 0.8rem 1.2rem;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.view-btn:hover {
    border-color: #667eea;
}

/* Interventions container */
.interventions-container.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.interventions-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.intervention-row {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.intervention-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.row-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.row-info h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.row-info p {
    color: #666;
    font-size: 0.9rem;
}

.row-stats {
    color: #666;
    font-size: 0.9rem;
}

.row-description {
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.row-actions {
    display: flex;
    gap: 0.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h3 {
    color: #333;
}

.date {
    background: #f0f0f0;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
}

.card-body {
    margin-bottom: 1rem;
}

.card-body p {
    margin-bottom: 0.5rem;
    color: #555;
}

.description {
    line-height: 1.6;
}

.card-stats {
    margin-top: 1rem;
}

.photo-count {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.large {
    max-width: 800px;
}

.modal-content.photo-modal {
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: #333;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.intervention-details {
    line-height: 1.6;
}

.detail-row {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.detail-row strong {
    color: #333;
    margin-bottom: 0.5rem;
}

.description-full {
    background: #f9f9f9;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    line-height: 1.6;
}

.photos-section {
    margin-top: 2rem;
}

.photos-section h4 {
    margin-bottom: 1rem;
    color: #333;
}

.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.photo-thumbnail {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
}

#modalPhoto {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.photo-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    border-radius: 8px;
}

.photo-nav button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.photo-nav button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.photo-nav span {
    color: white;
    font-weight: 500;
}

/* Loading and states */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-size: 1.1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-data,
.error {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error {
    color: #f44336;
}

.no-results {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.no-results h3 {
    color: #333;
    margin-bottom: 1rem;
}

.no-results p {
    color: #666;
    margin-bottom: 2rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #666;
    border-top: 1px solid #eee;
    margin-top: auto;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    header {
        margin: 0 -15px 2rem -15px;
        padding: 1.5rem 0;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .main-nav {
        flex-direction: column;
        align-items: center;
    }
    
    .nav-btn {
        width: 100%;
        max-width: 300px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-section {
        min-width: auto;
        flex-direction: column;
    }
    
    .interventions-container.grid-view {
        grid-template-columns: 1fr;
    }
    
    .camera-controls {
        flex-direction: column;
    }
    
    .btn-camera,
    .btn-upload {
        width: 100%;
    }
    
    .camera-overlay {
        flex-direction: column;
        align-items: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    .photo-thumbnail {
        height: 80px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .intervention-form {
        padding: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .photos-list {
        grid-template-columns: 1fr;
    }
    
    .photo-item img {
        height: 200px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.intervention-card,
.feature-card,
.stat-card {
    animation: fadeIn 0.6s ease-out;
}

/* Print styles */
@media print {
    .camera-section,
    .form-actions,
    .gallery-controls,
    .modal,
    header,
    footer {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .intervention-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
