/* === AUDIT FORM STYLES === */

/* Conteneur principal */
.audit-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* En-tête d'exploitation */
.audit-header {
    background: var(--light-gray, #f5f5f5);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.audit-header-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary-green, #2c7a31);
    margin-bottom: 10px;
}

.audit-header-info {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.95rem;
    color: #555;
}

.audit-header-info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.audit-header-info-item strong {
    color: #333;
}

/* Barre de progression */
.progress-container {
    width: 100%;
    height: 30px;
    background: #e0e0e0;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2c7a31 0%, #4caf50 100%);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.progress-text {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

/* Onglets de navigation */
.audit-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 25px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.audit-tab-btn {
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.audit-tab-btn:hover {
    background: rgba(44, 122, 49, 0.05);
    color: var(--primary-green, #2c7a31);
}

.audit-tab-btn.active {
    background: var(--primary-green, #2c7a31);
    color: white;
    font-weight: 600;
}

.audit-tab-btn::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.2s ease;
}

.audit-tab-btn.active::after {
    background: var(--primary-green, #2c7a31);
}

/* Contenu des onglets */
.audit-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.audit-tab-content.active {
    display: block;
}

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

/* Sections de sous-groupes */
.audit-sous-groupe {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid var(--primary-green, #2c7a31);
}

.audit-sous-groupe-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-green, #2c7a31);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Questions */
.audit-question {
    margin-bottom: 20px;
    padding: 15px;
    background: #fafafa;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
    transition: all 0.2s ease;
}

.audit-question:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.audit-question-label {
    display: block;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    font-size: 1rem;
}

/* Inputs génériques */
.audit-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.audit-input:focus {
    outline: none;
    border-color: var(--primary-green, #2c7a31);
    box-shadow: 0 0 0 3px rgba(44, 122, 49, 0.1);
}

.audit-input:disabled,
.audit-input[readonly] {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Textarea */
textarea.audit-input {
    min-height: 100px;
    resize: vertical;
}

/* Select */
select.audit-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

/* Chips (checkboxes multiples) */
.audit-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.audit-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.95rem;
}

.audit-chip:hover {
    border-color: var(--primary-green, #2c7a31);
    background: rgba(44, 122, 49, 0.05);
}

.audit-chip input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-green, #2c7a31);
}

.audit-chip input[type="checkbox"]:checked + span {
    font-weight: 600;
}

.audit-chip.checked {
    background: var(--primary-green, #2c7a31);
    color: white;
    border-color: var(--primary-green, #2c7a31);
}

.audit-chip.checked input[type="checkbox"] {
    filter: brightness(2);
}

/* Actions en bas */
.bottom-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    margin-top: 30px;
}

.bottom-actions .btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.btn-success {
    background: var(--primary-green, #2c7a31);
    color: white;
}

.btn-success:hover {
    background: #236122;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 122, 49, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .audit-content {
        padding: 15px;
    }

    .audit-tabs {
        gap: 5px;
    }

    .audit-tab-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .audit-sous-groupe {
        padding: 15px;
    }

    .audit-header-info {
        flex-direction: column;
        gap: 8px;
    }

    .bottom-actions {
        flex-direction: column-reverse;
    }

    .bottom-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* États d'erreur */
.audit-input.error {
    border-color: #dc3545;
}

.audit-input.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* États de validation */
.audit-input.valid {
    border-color: #28a745;
}

/* Empty state */
.audit-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.audit-empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.audit-empty-state-text {
    font-size: 1.2rem;
    color: #666;
}

/* === MODAL ASSOLEMENT === */

.assolement-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.assolement-modal.active {
    display: flex;
}

.assolement-modal-content {
    background: white;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.assolement-header {
    padding: 20px 30px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-green, #2c7a31);
    color: white;
    border-radius: 12px 12px 0 0;
}

.assolement-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.assolement-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: grid;
    grid-template-columns: 200px 250px 1fr;
    gap: 25px;
    align-items: start;
}

.cultures-reelles,
.cultures-virtuelles,
.assignation-parcelles {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
}

.cultures-reelles h3,
.cultures-virtuelles h3,
.assignation-parcelles h3 {
    margin: 0 0 15px 0;
    font-size: 1.1rem;
    color: var(--primary-green, #2c7a31);
    border-bottom: 2px solid var(--primary-green, #2c7a31);
    padding-bottom: 8px;
}

.culture-reelle-item {
    padding: 10px;
    background: white;
    border-radius: 4px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    font-size: 0.9rem;
}

.culture-virtuelle-item {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

.culture-virtuelle-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.culture-virtuelle-input:focus {
    outline: none;
    border-color: var(--primary-green, #2c7a31);
    box-shadow: 0 0 0 2px rgba(44, 122, 49, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.assolement-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 4px;
    overflow: hidden;
}

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

.assolement-table th {
    background: var(--primary-green, #2c7a31);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.assolement-table tr:hover {
    background: #f5f5f5;
}

.assolement-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
}

.assolement-select:focus {
    outline: none;
    border-color: var(--primary-green, #2c7a31);
    box-shadow: 0 0 0 2px rgba(44, 122, 49, 0.1);
}

.assolement-footer {
    padding: 20px 30px;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    background: #f9f9f9;
    border-radius: 0 0 12px 12px;
}

.assolement-summary {
    margin-top: 15px;
}

/* Tableaux avec groupement parent-enfant */
.parent-row {
    background: #f5f5f5;
    font-weight: bold;
}

.enfant-row {
    background: white;
}

.enfant-row td:first-child {
    padding-left: 30px;
    position: relative;
}

.enfant-row td:first-child::before {
    content: '└─ ';
    position: absolute;
    left: 15px;
    color: #999;
}

/* Notes éditables */
.notes-editable {
    width: 100%;
    min-height: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.notes-editable:focus {
    outline: none;
    border-color: var(--primary-green, #2c7a31);
    box-shadow: 0 0 0 2px rgba(44, 122, 49, 0.1);
}

/* Responsive */
@media (max-width: 1200px) {
    .assolement-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .assolement-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .assolement-header {
        border-radius: 0;
    }

    .assolement-body {
        padding: 15px;
    }

    .assolement-footer {
        flex-direction: column-reverse;
        border-radius: 0;
    }

    .assolement-footer .btn {
        width: 100%;
    }
}
