
/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --soil: #8B6914;
    --soil-light: #A0785A;
    --grass: #5D8A3C;
    --grass-light: #7CB342;
    --sky: #87CEEB;
    --wheat: #F5DEB3;
    --brown-dark: #3E2723;
    --cream: #FFF8E1;
    --shadow: rgba(0,0,0,0.2);
}

body {
    font-family: 'Georgia', serif;
    background-color: #E8F5E9;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(139,195,74,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,193,7,0.1) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--brown-dark);
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #33691E, #558B2F);
    color: white;
    padding: 16px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    font-size: 2.8rem;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
    animation: sway 3s ease-in-out infinite;
}

@keyframes sway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.header h1 {
    font-size: 1.8rem;
    font-weight: bold;
    text-shadow: 1px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.header p {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
}

.header-stats {
    display: flex;
    gap: 20px;
}

.stat-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.15);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.2s;
}

.stat-badge:hover { transform: scale(1.05); }

.stat-badge .stat-icon { font-size: 1.4rem; }
.stat-badge span:nth-child(2) { font-size: 1.5rem; font-weight: bold; }

.btn-add {
    background: linear-gradient(135deg, #F9A825, #F57F17);
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: bold;
    font-family: 'Georgia', serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s;
    letter-spacing: 0.5px;
}

.btn-add:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* ===== LÉGENDE ===== */
.legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 30px;
    background: rgba(255,255,255,0.7);
    border-bottom: 2px solid #C8E6C9;
    font-size: 0.82rem;
}

.legend-title { font-weight: bold; color: #33691E; margin-right: 8px; }

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.8);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #ddd;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.2);
}

/* ===== FILTRES ===== */
.filters {
    display: flex;
    gap: 10px;
    padding: 14px 30px;
    background: var(--cream);
    border-bottom: 2px solid #C8E6C9;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 18px;
    border: 2px solid #AED581;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    font-size: 0.88rem;
    color: #33691E;
    transition: all 0.25s;
}

.filter-btn:hover, .filter-btn.active {
    background: linear-gradient(135deg, #7CB342, #558B2F);
    color: white;
    border-color: #33691E;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}


/* ===== bouton import  export ===== */

.btn-import, .btn-export {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
    transition: all 0.3s;
}

.btn-import {
    background: #2196F3;
    color: white;
}

.btn-export {
    background: #4CAF50;
    color: white;
}

.btn-import:hover, .btn-export:hover {
    opacity: 0.9;
}
/* ===== FERME ===== */
.farm-container {
    padding: 30px;
    min-height: calc(100vh - 200px);
}

.farm-map {
    position: relative;
    background:
        repeating-linear-gradient(
            45deg,
            #C8E6C9 0px,
            #C8E6C9 2px,
            #DCEDC8 2px,
            #DCEDC8 30px
        );
    border-radius: 16px;
    border: 4px solid #8D6E63;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), inset 0 0 60px rgba(0,0,0,0.05);
    min-height: 600px;
    padding: 60px 20px 20px 20px;
    overflow: hidden;
}

/* Décorations ferme */
.farm-deco { position: absolute; pointer-events: none; z-index: 1; }
.farm-house { top: 10px; left: 20px; font-size: 2.5rem; }
.farm-tractor { top: 15px; right: 80px; font-size: 2rem; animation: drive 8s linear infinite; }

@keyframes drive {
    0% { transform: translateX(0); }
    45% { transform: translateX(-60px); }
    50% { transform: translateX(-60px) scaleX(-1); }
    95% { transform: translateX(0) scaleX(-1); }
    100% { transform: translateX(0); }
}

.farm-tree1 { bottom: 20px; left: 20px; font-size: 2.5rem; }
.farm-tree2 { bottom: 20px; right: 20px; font-size: 2.5rem; }
.farm-river {
    bottom: 60px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 1.2rem;
    color: #1565C0;
    letter-spacing: 4px;
    opacity: 0.6;
}

/* ===== GRILLE PARCELLES ===== */
.parcels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 2;
}

/* ===== PARCELLE / CARTE ===== */
.parcel {
    position: relative;
    border-radius: 12px;
    border: 3px solid var(--brown-dark);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    animation: plantIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes plantIn {
    from { transform: scale(0) rotate(-5deg); opacity: 0; }
    to { transform: scale(1) rotate(0deg); opacity: 1; }
}

.parcel:hover {
    transform: translateY(-8px) rotate(1deg);
    box-shadow: 6px 12px 24px rgba(0,0,0,0.3);
    z-index: 10;
}

/* Fond selon type */
.parcel[data-type="web"] {
    background: repeating-linear-gradient(
        90deg,
        #8BC34A 0px, #8BC34A 8px,
        #9CCC65 8px, #9CCC65 16px
    );
}
.parcel[data-type="design"] {
    background: repeating-linear-gradient(
        45deg,
        #FF9800 0px, #FF9800 8px,
        #FFB74D 8px, #FFB74D 16px
    );
}
.parcel[data-type="marketing"] {
    background: repeating-linear-gradient(
        135deg,
        #9C27B0 0px, #9C27B0 8px,
        #AB47BC 8px, #AB47BC 16px
    );
}
.parcel[data-type="data"] {
    background: repeating-linear-gradient(
        90deg,
        #2196F3 0px, #2196F3 8px,
        #42A5F5 8px, #42A5F5 16px
    );
}
.parcel[data-type="autre"] {
    background: repeating-linear-gradient(
        90deg,
        #66BB6A 0px, #66BB6A 8px,
        #81C784 8px, #81C784 16px
    );
}
.parcel[data-status="pause"] {
    background: repeating-linear-gradient(
        45deg,
        #795548 0px, #795548 8px,
        #8D6E63 8px, #8D6E63 16px
    );
    filter: saturate(0.6);
}
.parcel[data-status="termine"] {
    background: repeating-linear-gradient(
        90deg,
        #4CAF50 0px, #4CAF50 8px,
        #66BB6A 8px, #66BB6A 16px
    );
    border-color: #1B5E20;
}

/* Contenu parcelle */
.parcel-inner {
    background: rgba(255,255,255,0.88);
    margin: 6px;
    border-radius: 8px;
    padding: 14px;
    backdrop-filter: blur(2px);
}

.parcel-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.parcel-emoji { font-size: 2rem; line-height: 1; }

.parcel-status-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-en-cours { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.badge-pause    { background: #EFEBE9; color: #4E342E; border: 1px solid #BCAAA4; }
.badge-termine  { background: #F3E5F5; color: #4A148C; border: 1px solid #CE93D8; }

.parcel-name {
    font-size: 0.95rem;
    font-weight: bold;
    color: #1B0000;
    margin-bottom: 6px;
    line-height: 1.3;
}

.parcel-type-label {
    font-size: 0.72rem;
    color: #666;
    font-style: italic;
    margin-bottom: 10px;
}

/* Barre de progression */
.progress-track {
    background: #e0e0e0;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 4px;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::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 2s infinite;
}

@keyframes shimmer {
    to { left: 100%; }
}

.progress-fill.green  { background: linear-gradient(90deg, #4CAF50, #8BC34A); }
.progress-fill.orange { background: linear-gradient(90deg, #FF9800, #FFC107); }
.progress-fill.purple { background: linear-gradient(90deg, #9C27B0, #E040FB); }
.progress-fill.blue   { background: linear-gradient(90deg, #2196F3, #03DAC6); }
.progress-fill.gray   { background: linear-gradient(90deg, #795548, #A1887F); }
.progress-fill.done   { background: linear-gradient(90deg, #4CAF50, #00C853); }

.progress-text {
    font-size: 0.72rem;
    color: #555;
    text-align: right;
    margin-bottom: 8px;
}

.parcel-deadline {
    font-size: 0.7rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 4px;
}

.parcel-deadline.urgent { color: #D32F2F; font-weight: bold; }

/* Boutons parcelle */
.parcel-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.2s;
}

.parcel:hover .parcel-actions {
    opacity: 1;
    transform: translateY(0);
}

.btn-edit, .btn-delete {
    flex: 1;
    padding: 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Georgia', serif;
    transition: all 0.2s;
}

.btn-edit { background: #FFF9C4; color: #F57F17; border: 1px solid #F9A825; }
.btn-delete { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }
.btn-edit:hover { background: #F9A825; color: white; }
.btn-delete:hover { background: #C62828; color: white; }

/* Badge "Terminé" overlay */
.parcel-done-stamp {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    font-size: 3rem;
    opacity: 0.15;
    pointer-events: none;
    z-index: 5;
}

/* Message vide */
.empty-farm {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.empty-farm .empty-icon { font-size: 5rem; margin-bottom: 16px; }
.empty-farm h3 { font-size: 1.4rem; margin-bottom: 8px; color: #33691E; }
.empty-farm p { font-style: italic; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

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

.modal {
    background: linear-gradient(160deg, #FFFDE7, #F9FBE7);
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 480px;
    border: 3px solid #8D6E63;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: modalIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from { transform: scale(0.8) translateY(-20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 2px dashed #C8E6C9;
}

.modal-header h2 { font-size: 1.3rem; color: #33691E; }

.modal-close {
    background: #FFEBEE;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    color: #C62828;
    transition: all 0.2s;
}
.modal-close:hover { background: #C62828; color: white; transform: rotate(90deg); }

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: bold;
    color: #33691E;
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #C8E6C9;
    border-radius: 10px;
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    background: white;
    color: var(--brown-dark);
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #7CB342;
    box-shadow: 0 0 0 3px rgba(124,179,66,0.2);
}

.form-group input[type="range"] {
    padding: 6px 0;
    accent-color: #7CB342;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-cancel, .btn-save {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Georgia', serif;
    font-size: 0.95rem;
    font-weight: bold;
    transition: all 0.25s;
}

.btn-cancel {
    background: #EFEBE9;
    color: #5D4037;
    border: 2px solid #BCAAA4;
}

.btn-save {
    background: linear-gradient(135deg, #7CB342, #33691E);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-cancel:hover { background: #D7CCC8; }
.btn-save:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.3); }

/* ===== TOOLTIP ===== */
.tooltip {
    position: fixed;
    background: rgba(33,33,33,0.95);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    pointer-events: none;
    z-index: 500;
    display: none;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .header { padding: 12px 16px; }
    .header h1 { font-size: 1.3rem; }
    .header-stats { gap: 10px; }
    .stat-badge { padding: 6px 10px; }
    .farm-container { padding: 16px; }
    .filters { padding: 10px 16px; }
    .legend { padding: 10px 16px; }
    .parcels-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}