/* /var/www/html/iaScan/public/assets/css/app.css */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

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

.debug-info {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
    padding: 0.5rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    border-radius: 5px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

/* Sections */
.section {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Capture Tabs */
.capture-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 0.25rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

/* Camera */
.capture-mode {
    animation: fadeIn 0.3s ease;
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 350px;
    margin: 0 auto 1rem;
    border-radius: 15px;
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
}

#videoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#canvasElement {
    display: none;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    margin: 10px;
    border-radius: 10px;
    pointer-events: none;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 1rem;
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

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

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.upload-subtext {
    font-size: 0.9rem;
    opacity: 0.7;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Controls */
.controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 140px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(45deg, #4f46e5, #7c3aed);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

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

.btn-success {
    background: linear-gradient(45deg, #10b981, #34d399);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* File Preview */
.file-preview {
    margin-top: 1rem;
}

.preview-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.preview-thumbnail {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.preview-info {
    flex: 1;
    text-align: left;
}

.preview-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.preview-details {
    font-size: 0.85rem;
    opacity: 0.8;
}

.preview-remove {
    padding: 0.5rem;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Upload Form */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    opacity: 0.9;
}

.form-group select {
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
}

/* Analysis Section */
.analysis-section {
    margin-top: 1rem;
}

.analysis-tabs {
    display: flex;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 0.25rem;
}

.analysis-tab {
    flex: 1;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
}

.analysis-tab.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.analysis-content {
    min-height: 200px;
}

.expert-report {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.5rem;
    line-height: 1.6;
    font-size: 0.95rem;
}

.technical-data {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
}

.data-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.data-label {
    font-weight: 600;
    opacity: 0.8;
}

.data-value {
    text-align: right;
    max-width: 60%;
}

.analysis-meta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Progress & Status */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #34d399);
    width: 0%;
    transition: width 0.3s ease;
}

.status-message {
    text-align: center;
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 10px;
    font-weight: 600;
}

.status-success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #10b981;
}

.status-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #ffffff;
}

.file-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* === AMÉLIORATIONS INTERFACE === */

/* Miniatures photos sur une ligne */
#previewContainer {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.preview-item {
    flex: 0 0 80px;
    position: relative;
}

.preview-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
}

/* Masquer nom et détails des fichiers */
.preview-info {
    display: none;
}

/* Bouton supprimer plus petit */
.preview-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ef4444;
    color: white;
    border: none;
    font-size: 12px;
    cursor: pointer;
}

/* Masquer détails fichiers */
#fileDetails,
#fileTimestamp {
    display: none;
}

/* Style pour les boutons disabled */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animation pendant génération PDF */
.generating-pdf {
    position: relative;
    overflow: hidden;
}

.generating-pdf::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Utilities */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 1rem; }
.mt-1 { margin-top: 1rem; }

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

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

.analyzing {
    animation: pulse 2s infinite;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .header {
        padding: 0.75rem;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .main-content {
        padding: 0.75rem;
    }
    
    .section {
        padding: 1rem;
        border-radius: 15px;
    }
    
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
        min-width: 120px;
    }
    
    .controls {
        gap: 0.75rem;
    }
    
    .preview-item {
        flex-direction: column;
        text-align: center;
    }
    
    .data-item {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .data-value {
        text-align: left;
        max-width: 100%;
    }
}

/* iOS Safari fixes */
@supports (-webkit-touch-callout: none) {
    .app-container {
        height: 100vh;
        height: -webkit-fill-available;
    }
}

@media (min-width: 768px) {
    /* Masquer complètement les tabs */
    .capture-tabs {
        display: none;
    }
    
    /* Masquer le mode caméra */
    #cameraMode {
        display: none !important;
    }
    
    /*fileMode est géré par css/*
    
    /* Ajouter un titre propre 
    .section:first-child::before {
        content: "📁 Sélection de fichiers";
        display: block;
        font-size: 1.3rem;
        font-weight: 600;
        text-align: center;
        margin-bottom: 1.5rem;
        color: white;
    }
        */

    /* === STYLES MODE EXTENSION === */

.extension-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.extension-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.source-info {
    font-size: 0.9rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    margin-top: 0.75rem;
}

.extension-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.image-container {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.context-info {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.context-info label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.75rem;
    color: white;
    font-size: 1rem;
}

.context-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
    max-height: 120px;
    overflow-y: auto;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

/* Responsive extension */
@media (max-width: 640px) {
    .extension-preview {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .extension-header {
        padding: 1rem;
    }
    
    .context-info {
        padding: 1rem;
    }
}
}