/* Variables CSS pour une cohérence des couleurs */
:root {
    --primary-color: #007cba;
    --primary-hover: #005a8a;
    --success-bg: #d4edda;
    --success-border: #c3e6cb;
    --error-bg: #f8d7da;
    --error-border: #f5c6cb;
    --error-text: #dc3545;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-dark: #333;
    --text-light: #666;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --- DESKTOP DESIGN (au-dessus de 992px) --- */
@media (min-width: 993px) {
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    body { 
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        overflow: hidden;
    }

    .container { 
        width: 95vw;
        max-width: 1400px;
        height: 95vh;
        background: white;
        border-radius: 16px;
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    /* Header avec titre */
    .header {
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
        color: white;
        padding: 20px 30px;
        text-align: center;
        position: relative;
        flex-shrink: 0;
    }

    .header h1 {
        font-size: 28px;
        font-weight: 300;
        letter-spacing: 1px;
        margin: 0;
    }

    /* Zone des messages */
    .message-zone {
        padding: 0 30px;
        flex-shrink: 0;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .success { 
        color: green;
        padding: 12px 20px;
        background: var(--success-bg);
        border: 1px solid var(--success-border);
        border-radius: 8px;
        width: 100%;
        text-align: center;
        font-weight: 500;
    }
    
    .error { 
        color: var(--error-text);
        padding: 12px 20px;
        background: var(--error-bg);
        border: 1px solid var(--error-border);
        border-radius: 8px;
        width: 100%;
        text-align: center;
        font-weight: 500;
    }

    /* Onglets */
    .tabs { 
        display: flex;
        background: var(--light-gray);
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    .tab { 
        flex: 1;
        padding: 16px 20px;
        cursor: pointer;
        border: none;
        background: transparent;
        font-size: 16px;
        text-decoration: none;
        color: var(--text-light);
        text-align: center;
        transition: all 0.3s ease;
        position: relative;
        font-weight: 500;
    }

    .tab:hover {
        background: rgba(0, 124, 186, 0.1);
        color: var(--primary-color);
    }

    .tab.active { 
        background: white;
        color: var(--primary-color);
        font-weight: 600;
    }

    .tab.active::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--primary-color);
    }

    /* Contenu principal */
    .content-area {
        flex: 1;
        display: flex;
        overflow: hidden;
    }

    .form-section { 
        display: none;
        width: 100%;
        overflow: hidden;
    }

    .form-section.active { 
        display: flex;
        flex-direction: column;
    }

    /* Container du formulaire avec scroll */
    .form-container {
        flex: 1;
        overflow-y: auto;
        padding: 30px;
    }

    /* Scrollbar personnalisée */
    .form-container::-webkit-scrollbar {
        width: 8px;
    }

    .form-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .form-container::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 10px;
    }

    .form-container::-webkit-scrollbar-thumb:hover {
        background: var(--primary-hover);
    }

    h2 { 
        color: var(--text-dark);
        font-size: 24px;
        font-weight: 600;
        margin-bottom: 30px;
        text-align: center;
        position: relative;
    }

    h2::after {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 3px;
        background: var(--primary-color);
        border-radius: 2px;
    }

    /* Grid layout pour les formulaires */
    .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 25px;
        max-width: 1000px;
        margin: 0 auto;
    }

    .form-group { 
        margin-bottom: 0;
    }

    .form-group.full-width {
        grid-column: 1 / -1;
    }

    label { 
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        color: var(--text-dark);
        font-size: 14px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    input, textarea, select { 
        width: 100%;
        padding: 12px 16px;
        border: 2px solid var(--border-color);
        border-radius: 8px;
        font-size: 15px;
        transition: all 0.3s ease;
        background: white;
    }

    input:focus, textarea:focus, select:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
        transform: translateY(-1px);
    }

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

    button { 
        background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
        color: white;
        padding: 14px 30px;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-size: 16px;
        font-weight: 600;
        transition: all 0.3s ease;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        box-shadow: var(--shadow);
        grid-column: 1 / -1;
        justify-self: center;
        max-width: 300px;
    }

    button:hover { 
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(0, 124, 186, 0.3);
    }

    button:active {
        transform: translateY(0);
    }

    .file-input { 
        padding: 8px 12px;
        background: var(--light-gray);
        border-style: dashed !important;
    }

    /* Prévisualisation d'images */
    .image-preview-container { 
        margin-top: 15px;
        text-align: center;
    }

    .image-preview { 
        max-width: 150px;
        max-height: 150px;
        border: 3px solid var(--border-color);
        border-radius: 12px;
        padding: 8px;
        display: none;
        object-fit: cover;
        box-shadow: var(--shadow);
    }

    .image-preview.show { 
        display: block;
        margin: 0 auto;
    }

    .preview-text { 
        color: var(--text-light);
        font-style: italic;
        margin-top: 10px;
        font-size: 13px;
    }

    .remove-image { 
        background: var(--error-text);
        color: white;
        border: none;
        padding: 6px 12px;
        border-radius: 6px;
        cursor: pointer;
        margin-top: 10px;
        font-size: 12px;
        text-transform: none;
        letter-spacing: normal;
        max-width: none;
        grid-column: auto;
        justify-self: auto;
        box-shadow: none;
    }

    .remove-image:hover { 
        background: #c82333;
        transform: none;
    }
}

/* --- Responsive tablette (max 992px) --- */
@media (max-width: 992px) {
    body { 
        font-family: Arial, sans-serif; 
        margin: 20px; 
        background-color: #f5f5f5; 
    }
    .container { 
        max-width: 800px; 
        margin: 0 auto; 
        background: white; 
        padding: 20px; 
        border-radius: 8px; 
        box-shadow: 0 2px 10px rgba(0,0,0,0.1); 
    }
    .tabs { 
        display: flex; 
        border-bottom: 1px solid #ddd; 
        margin-bottom: 20px; 
        flex-wrap: wrap;
    }
    .tab { 
        padding: 10px 20px; 
        cursor: pointer; 
        border: none; 
        background: none; 
        font-size: 16px; 
        text-decoration: none;
        color: #333;
        flex: 1;
        text-align: center;
    }
    .tab.active { 
        border-bottom: 2px solid #007cba; 
        color: #007cba; 
        font-weight: bold;
    }
    .form-section { 
        display: none; 
    }
    .form-section.active { 
        display: block; 
    }
    .form-group { 
        margin-bottom: 15px; 
    }
    label { 
        display: block; 
        margin-bottom: 5px; 
        font-weight: bold; 
    }
    input, textarea, select { 
        width: 100%; 
        padding: 8px; 
        border: 1px solid #ddd; 
        border-radius: 4px; 
        box-sizing: border-box; 
    }
    textarea { 
        height: 80px; 
        resize: vertical; 
    }
    button { 
        background: #007cba; 
        color: white; 
        padding: 10px 20px; 
        border: none; 
        border-radius: 4px; 
        cursor: pointer; 
    }
    button:hover { 
        background: #005a8a; 
    }
    .success { 
        color: green; 
        margin: 15px 0;
        padding: 10px;
        background: #d4edda;
        border: 1px solid #c3e6cb;
        border-radius: 4px;
    }
    .error { 
        color: #dc3545; 
        margin: 15px 0;
        padding: 10px;
        background: #f8d7da;
        border: 1px solid #f5c6cb;
        border-radius: 4px;
    }
    .file-input { 
        padding: 5px; 
    }
    h2 { 
        color: #333; 
        border-bottom: 2px solid #007cba; 
        padding-bottom: 10px; 
    }
    .image-preview-container { 
        margin-top: 10px; 
    }
    .image-preview { 
        max-width: 200px; 
        max-height: 200px; 
        border: 2px dashed #ddd; 
        border-radius: 8px; 
        padding: 10px;
        display: none;
        object-fit: cover;
    }
    .image-preview.show { 
        display: block; 
    }
    .preview-text { 
        color: #666; 
        font-style: italic; 
        margin-top: 5px; 
        font-size: 14px;
    }
    .remove-image { 
        background: #dc3545; 
        color: white; 
        border: none; 
        padding: 5px 10px; 
        border-radius: 4px; 
        cursor: pointer; 
        margin-top: 10px;
        font-size: 12px;
    }
    .remove-image:hover { 
        background: #c82333; 
    }

    .container {
        padding: 15px;
    }
    .tab {
        font-size: 15px;
        padding: 8px 12px;
    }
    h1 {
        font-size: 22px;
    }
    h2 {
        font-size: 18px;
    }
}

/* --- Responsive mobile (max 768px) --- */
@media (max-width: 768px) {
    body {
        margin: 10px;
    }
    .container {
        padding: 10px;
        border-radius: 6px;
    }
    .tabs {
        flex-direction: column;
        align-items: stretch;
    }
    .tab {
        padding: 12px;
        border-bottom: 1px solid #ddd;
        font-size: 14px;
    }
    .form-group {
        margin-bottom: 12px;
    }
    label {
        font-size: 14px;
    }
    input, textarea, select, button {
        font-size: 14px;
        padding: 8px;
    }
    .image-preview {
        max-width: 100%;
        height: auto;
    }
    button {
        width: 100%;
    }
}

/* --- Responsive très petits écrans (max 480px) --- */
@media (max-width: 480px) {
    h1 {
        font-size: 20px;
        text-align: center;
    }
    h2 {
        font-size: 16px;
        text-align: center;
    }
    .tab {
        font-size: 13px;
        padding: 10px;
    }
    .form-group label {
        font-size: 13px;
    }
    input, textarea, select {
        font-size: 13px;
    }
}