/**
 * CDG16 - Formulaire Mandats Territoriaux
 * Styles principaux
 */

/* ========================================
   VARIABLES ET RESET
   ======================================== */

:root {
    --cdg16-primary: #2c5aa0;
    --cdg16-primary-dark: #1e4278;
    --cdg16-secondary: #6c757d;
    --cdg16-success: #28a745;
    --cdg16-danger: #dc3545;
    --cdg16-warning: #ffc107;
    --cdg16-info: #17a2b8;
    --cdg16-light: #f8f9fa;
    --cdg16-dark: #343a40;
    --cdg16-border: #dee2e6;
    --cdg16-border-radius: 4px;
    --cdg16-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --cdg16-shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
    --cdg16-transition: all 0.3s ease;
}

.cdg16-formulaire-mandats * {
    box-sizing: border-box;
}

/* ========================================
   CONTENEUR PRINCIPAL
   ======================================== */

.cdg16-formulaire-mandats {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--cdg16-dark);
}

/* ========================================
   BARRE DE PROGRESSION
   ======================================== */

.cdg16-progress-bar {
    background: white;
    border-radius: var(--cdg16-border-radius);
    box-shadow: var(--cdg16-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

.cdg16-progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.cdg16-progress-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.cdg16-progress-step .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--cdg16-light);
    border: 2px solid var(--cdg16-border);
    color: var(--cdg16-secondary);
    font-weight: 600;
    margin: 0 auto 0.5rem;
    transition: var(--cdg16-transition);
}

.cdg16-progress-step .step-label {
    display: block;
    font-size: 0.875rem;
    color: var(--cdg16-secondary);
    font-weight: 500;
}

.cdg16-progress-step.active .step-number {
    background: var(--cdg16-primary);
    border-color: var(--cdg16-primary);
    color: white;
    transform: scale(1.1);
}

.cdg16-progress-step.active .step-label {
    color: var(--cdg16-primary);
    font-weight: 600;
}

.cdg16-progress-step.completed .step-number {
    background: var(--cdg16-success);
    border-color: var(--cdg16-success);
    color: white;
}

.cdg16-progress-step.completed .step-number::after {
    content: "✓";
}

.cdg16-progress-fill {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    height: 4px;
    background: var(--cdg16-primary);
    transition: width 0.5s ease;
    z-index: 1;
}

/* ========================================
   MESSAGES
   ======================================== */

.cdg16-messages {
    margin-bottom: 1.5rem;
}

.cdg16-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--cdg16-border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.cdg16-alert-success {
    background-color: #d4edda;
    border-color: var(--cdg16-success);
    color: #155724;
}

.cdg16-alert-danger {
    background-color: #f8d7da;
    border-color: var(--cdg16-danger);
    color: #721c24;
}

.cdg16-alert-warning {
    background-color: #fff3cd;
    border-color: var(--cdg16-warning);
    color: #856404;
}

.cdg16-alert-info {
    background-color: #d1ecf1;
    border-color: var(--cdg16-info);
    color: #0c5460;
}

.cdg16-alert strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* ========================================
   CONTENU DES ÉTAPES
   ======================================== */

.cdg16-step-content {
    background: white;
    border-radius: var(--cdg16-border-radius);
    box-shadow: var(--cdg16-shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.cdg16-step-title {
    color: var(--cdg16-primary);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--cdg16-border);
}

/* ========================================
   BLOCS DE FORMULAIRE
   ======================================== */

.cdg16-form-bloc {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--cdg16-border);
}

.cdg16-form-bloc:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.cdg16-bloc-title {
    color: var(--cdg16-dark);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.cdg16-bloc-description {
    color: var(--cdg16-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* ========================================
   GRILLE DE FORMULAIRE
   ======================================== */

.cdg16-form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.5rem 1rem -0.5rem;
}

.cdg16-form-group {
    padding: 0 0.5rem;
    margin-bottom: 1rem;
}

.cdg16-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--cdg16-dark);
}

.cdg16-form-group label .required {
    color: var(--cdg16-danger);
    margin-left: 0.25rem;
}

/* Colonnes responsives */
.cdg16-col-12 { flex: 0 0 100%; max-width: 100%; }
.cdg16-col-6 { flex: 0 0 50%; max-width: 50%; }
.cdg16-col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.cdg16-col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.cdg16-col-3 { flex: 0 0 25%; max-width: 25%; }
.cdg16-col-9 { flex: 0 0 75%; max-width: 75%; }

@media (max-width: 768px) {
    .cdg16-col-6,
    .cdg16-col-4,
    .cdg16-col-8,
    .cdg16-col-3,
    .cdg16-col-9 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ========================================
   CHAMPS DE FORMULAIRE
   ======================================== */

.cdg16-input,
.cdg16-textarea,
.cdg16-select2 {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--cdg16-dark);
    background-color: white;
    border: 1px solid var(--cdg16-border);
    border-radius: var(--cdg16-border-radius);
    transition: var(--cdg16-transition);
}

.cdg16-input:focus,
.cdg16-textarea:focus,
.cdg16-select2:focus {
    border-color: var(--cdg16-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

.cdg16-input.cdg16-readonly {
    background-color: var(--cdg16-light);
    cursor: not-allowed;
}

.cdg16-textarea {
    min-height: 100px;
    resize: vertical;
}

.cdg16-input-time {
    width: auto;
    display: inline-block;
    padding: 0.375rem 0.625rem;
}

.cdg16-input-year {
    width: 100px;
    margin-top: 0.5rem;
}

/* Aide contextuelle */
.cdg16-field-help {
    display: block;
    font-size: 0.875rem;
    color: var(--cdg16-secondary);
    margin-top: 0.25rem;
}

/* Erreurs de validation */
.cdg16-field-error {
    display: none;
    color: var(--cdg16-danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.cdg16-form-group.has-error .cdg16-input,
.cdg16-form-group.has-error .cdg16-textarea,
.cdg16-form-group.has-error .cdg16-select2 {
    border-color: var(--cdg16-danger);
}

.cdg16-form-group.has-error .cdg16-field-error {
    display: block;
}

/* ========================================
   RADIO & CHECKBOX
   ======================================== */

.cdg16-radio-group,
.cdg16-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cdg16-radio-label,
.cdg16-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
}

.cdg16-radio-label input[type="radio"],
.cdg16-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
}

.cdg16-checkbox-label.cdg16-checkbox-large {
    padding: 1rem;
    background: var(--cdg16-light);
    border-radius: var(--cdg16-border-radius);
    border: 2px solid var(--cdg16-border);
    transition: var(--cdg16-transition);
}

.cdg16-checkbox-label.cdg16-checkbox-large:hover {
    border-color: var(--cdg16-primary);
    background: white;
}

.cdg16-checkbox-label.cdg16-checkbox-large input[type="checkbox"] {
    width: 24px;
    height: 24px;
}

.cdg16-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .cdg16-checkbox-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   HORAIRES
   ======================================== */

.cdg16-horaires-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.cdg16-horaires-table th,
.cdg16-horaires-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--cdg16-border);
}

.cdg16-horaires-table th {
    background-color: var(--cdg16-light);
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .cdg16-horaires-table {
        font-size: 0.875rem;
    }
    
    .cdg16-horaires-table th,
    .cdg16-horaires-table td {
        padding: 0.5rem;
    }
}

/* ========================================
   REPEATER (STRUCTURES, RESTAURATION, ETC.)
   ======================================== */

.cdg16-repeater-item {
    background: var(--cdg16-light);
    padding: 1rem;
    border-radius: var(--cdg16-border-radius);
    margin-bottom: 1rem;
    border: 1px solid var(--cdg16-border);
}

.cdg16-btn-remove-structure,
.cdg16-btn-remove-item {
    background: var(--cdg16-danger);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--cdg16-border-radius);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: var(--cdg16-transition);
}

.cdg16-btn-remove-structure:hover,
.cdg16-btn-remove-item:hover {
    background: #c82333;
}

/* ========================================
   MÉDAILLES
   ======================================== */

.cdg16-medailles-group {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--cdg16-light);
    border-radius: var(--cdg16-border-radius);
}

.cdg16-medailles-group h4 {
    margin: 0 0 1rem 0;
    color: var(--cdg16-dark);
    font-size: 1.125rem;
}

/* ========================================
   TÉLÉCHARGEMENT ET UPLOAD
   ======================================== */

.cdg16-download-box {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--cdg16-light);
    border: 2px dashed var(--cdg16-border);
    border-radius: var(--cdg16-border-radius);
    margin: 1rem 0;
}

.cdg16-download-icon {
    font-size: 3rem;
    line-height: 1;
}

.cdg16-download-info h4,
.cdg16-download-info h5 {
    margin: 0 0 0.5rem 0;
    color: var(--cdg16-dark);
}

.cdg16-download-info p {
    margin: 0 0 1rem 0;
    color: var(--cdg16-secondary);
}

.cdg16-upload-zone {
    position: relative;
    border: 2px dashed var(--cdg16-border);
    border-radius: var(--cdg16-border-radius);
    padding: 2rem;
    text-align: center;
    background: var(--cdg16-light);
    transition: var(--cdg16-transition);
}

.cdg16-upload-zone:hover {
    border-color: var(--cdg16-primary);
    background: white;
}

.cdg16-upload-zone.dragging {
    border-color: var(--cdg16-primary);
    background: rgba(44, 90, 160, 0.05);
}

.cdg16-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

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

.cdg16-upload-text {
    font-weight: 600;
    color: var(--cdg16-dark);
    margin-bottom: 0.5rem;
}

.cdg16-upload-info {
    color: var(--cdg16-secondary);
    font-size: 0.875rem;
}

.cdg16-upload-progress {
    padding: 2rem;
}

.cdg16-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--cdg16-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.cdg16-progress-fill {
    height: 100%;
    background: var(--cdg16-primary);
    transition: width 0.3s ease;
}

.cdg16-progress-text {
    text-align: center;
    font-weight: 600;
    color: var(--cdg16-primary);
}

.cdg16-upload-success {
    padding: 2rem;
}

.cdg16-success-icon {
    font-size: 3rem;
    color: var(--cdg16-success);
    margin-bottom: 1rem;
}

.cdg16-success-text {
    font-weight: 600;
    color: var(--cdg16-dark);
    margin-bottom: 1rem;
}

/* ========================================
   RÉCAPITULATIF (ÉTAPE 6)
   ======================================== */

.cdg16-summary-container {
    border: 1px solid var(--cdg16-border);
    border-radius: var(--cdg16-border-radius);
    overflow: hidden;
}

.cdg16-summary-section {
    border-bottom: 1px solid var(--cdg16-border);
}

.cdg16-summary-section:last-child {
    border-bottom: none;
}

.cdg16-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--cdg16-light);
    border-bottom: 1px solid var(--cdg16-border);
}

.cdg16-summary-header h4 {
    margin: 0;
    font-size: 1.125rem;
    color: var(--cdg16-dark);
}

.cdg16-summary-content {
    padding: 1.5rem;
}

.cdg16-summary-content dl {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    margin: 0;
}

.cdg16-summary-content dt {
    font-weight: 600;
    color: var(--cdg16-dark);
}

.cdg16-summary-content dd {
    margin: 0;
    color: var(--cdg16-secondary);
}

@media (max-width: 768px) {
    .cdg16-summary-content dl {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.cdg16-rgpd-details {
    padding: 1.5rem;
    background: var(--cdg16-light);
    border-radius: var(--cdg16-border-radius);
    margin: 1rem 0;
}

.cdg16-rgpd-details h4 {
    margin-top: 0;
}

.cdg16-rgpd-details address {
    font-style: normal;
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: var(--cdg16-border-radius);
}

/* ========================================
   BOUTONS
   ======================================== */

.cdg16-btn {
    display: inline-block;
    padding: 0.625rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--cdg16-border-radius);
    cursor: pointer;
    transition: var(--cdg16-transition);
    line-height: 1.5;
}

.cdg16-btn-primary {
    background: var(--cdg16-primary);
    color: white;
}

.cdg16-btn-primary:hover {
    background: var(--cdg16-primary-dark);
}

.cdg16-btn-secondary {
    background: var(--cdg16-secondary);
    color: white;
}

.cdg16-btn-secondary:hover {
    background: #5a6268;
}

.cdg16-btn-danger {
    background: var(--cdg16-danger);
    color: white;
}

.cdg16-btn-danger:hover {
    background: #c82333;
}

.cdg16-btn-link {
    background: transparent;
    color: var(--cdg16-primary);
    padding: 0.375rem 0.75rem;
}

.cdg16-btn-link:hover {
    background: rgba(44, 90, 160, 0.1);
}

.cdg16-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========================================
   NAVIGATION DU FORMULAIRE
   ======================================== */

.cdg16-form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid var(--cdg16-border);
    gap: 1rem;
}

@media (max-width: 768px) {
    .cdg16-form-navigation {
        flex-direction: column;
    }
    
    .cdg16-form-navigation .cdg16-btn {
        width: 100%;
    }
}

/* ========================================
   BLOCS CONDITIONNELS
   ======================================== */

.cdg16-conditional-block {
    display: none;
    padding: 1rem;
    background: rgba(44, 90, 160, 0.05);
    border-left: 3px solid var(--cdg16-primary);
    border-radius: var(--cdg16-border-radius);
    margin: 1rem 0;
}

.cdg16-conditional-block.active {
    display: block;
}

/* ========================================
   INFO TEXT
   ======================================== */

.cdg16-info-text {
    padding: 0.75rem 1rem;
    background: var(--cdg16-light);
    border-left: 3px solid var(--cdg16-info);
    border-radius: var(--cdg16-border-radius);
    margin: 1rem 0;
    font-size: 0.9375rem;
}

.cdg16-template-help {
    background: white;
    padding: 1.5rem;
    border-radius: var(--cdg16-border-radius);
    margin: 1rem 0;
    border: 1px solid var(--cdg16-border);
}

.cdg16-template-help h5 {
    margin-top: 0;
    color: var(--cdg16-dark);
}

.cdg16-template-help ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.cdg16-template-help li {
    margin-bottom: 0.5rem;
}

/* ========================================
   LOADING SPINNER
   ======================================== */

.cdg16-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: cdg16-spin 0.8s linear infinite;
}

@keyframes cdg16-spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .cdg16-formulaire-mandats {
        padding: 0 0.5rem;
    }
    
    .cdg16-step-content {
        padding: 1rem;
    }
    
    .cdg16-progress-bar {
        padding: 1rem;
    }
    
    .cdg16-progress-steps {
        flex-wrap: wrap;
    }
    
    .cdg16-progress-step {
        flex: 0 0 33.333%;
        margin-bottom: 1rem;
    }
    
    .cdg16-download-box {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   PRINT
   ======================================== */

@media print {
    .cdg16-progress-bar,
    .cdg16-form-navigation,
    .cdg16-btn {
        display: none !important;
    }
}
