/* ============================
   TERRAIN DETAIL MODAL - Design Premium Amélioré
   ============================ */

/* ===== BASE MODAL ===== */
.terrain-detail-modal .modal-content {
    width: min(900px, 95vw) !important;
    max-width: 900px !important;
    max-height: min(680px, 92dvh) !important;
    padding: 0 !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    background: linear-gradient(145deg,
            rgba(15, 23, 42, 0.98) 0%,
            rgba(25, 35, 55, 0.97) 50%,
            rgba(15, 23, 42, 0.98) 100%) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 10px 30px rgba(59, 130, 246, 0.1) !important;
}

/* ===== HEADER ===== */
.td-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.5);
}

.td-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    letter-spacing: -0.02em;
}

.td-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.td-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    transform: rotate(90deg);
}

/* ===== BODY - 2 colonnes ===== */
.td-body {
    display: grid;
    grid-template-columns: 1fr 280px;
    height: calc(min(680px, 92dvh) - 72px);
}

.td-left {
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
}

.td-left::-webkit-scrollbar {
    width: 6px;
}

.td-left::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.td-left::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 3px;
}

.td-left::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.5);
}

.td-right {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.5);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===== LABELS DE SECTION ===== */
.td-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== PHOTOS - Carrousel avec slides empilées ===== */
.td-photos-section {
    margin-bottom: 1.75rem;
}

.td-photo-carousel {
    position: relative;
    width: 100%;
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Conteneur des slides */
.td-carousel-slides {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Chaque slide est positionnée en absolu pour empiler */
.td-carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.td-carousel-slide.active {
    opacity: 1;
    visibility: visible;
}

.td-carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Flèches de navigation positionnées sur les côtés */
.td-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.td-carousel-arrow:hover {
    background: rgba(59, 130, 246, 0.9);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-50%) scale(1.1);
}

.td-carousel-arrow:active {
    transform: translateY(-50%) scale(0.95);
}

.td-carousel-arrow svg {
    width: 20px;
    height: 20px;
}

.td-carousel-prev {
    left: 12px;
}

.td-carousel-next {
    right: 12px;
}

/* Compteur de photos */
.td-carousel-counter {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.8);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #ffffff;
    font-weight: 500;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.td-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: linear-gradient(135deg, #1e3a5f 0%, #3b5998 100%);
}

/* ===== DETAILS DU TERRAIN ===== */
.td-details-section {
    margin-bottom: 1.5rem;
}

.td-details-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.td-detail-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.td-detail-key {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.td-detail-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #ffffff;
}

.td-status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.td-status-badge.ouvert,
.td-status-badge.disponible {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.td-status-badge.ferme,
.td-status-badge.indisponible {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.td-status-badge.option {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* ===== INFORMATIONS (Summary) ===== */
.td-summary-section {
    margin-bottom: 1.5rem;
}

.td-summary-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.td-summary-row:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(59, 130, 246, 0.2);
}

.td-sum-num {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    min-width: 18px;
    font-weight: 600;
}

.td-sum-key {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    flex: 1;
}

.td-sum-val {
    font-size: 0.85rem;
    font-weight: 600;
    color: #60a5fa;
    word-break: break-word;
    text-align: right;
    max-width: 65%;
    line-height: 1.4;
}

/* ===== CONTACT (Checklist) ===== */
.td-checklist-section {
    margin-bottom: 0;
}

.td-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.td-check-row:hover {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(59, 130, 246, 0.2);
}

.td-chk-num {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    min-width: 18px;
    font-weight: 600;
}

.td-chk-key {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    min-width: 90px;
}

.td-chk-icon {
    font-size: 1rem;
    font-weight: bold;
}

.td-chk-icon.green {
    color: #34d399;
}

.td-chk-icon.red {
    color: #f87171;
}

.td-chk-link {
    font-size: 0.85rem;
    color: #60a5fa;
    text-decoration: none;
    margin-left: auto;
    font-weight: 500;
    word-break: break-word;
    text-align: right;
    max-width: 65%;
    line-height: 1.4;
}

.td-chk-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

/* Adresse non cliquable */
.td-check-row:last-child .td-chk-link {
    cursor: default;
}

.td-check-row:last-child .td-chk-link:hover {
    text-decoration: none;
}

/* ===== ACTIVITY CARD (droite) ===== */
.td-activity-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.td-activity-title-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin: 0 0 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.td-activity-list {
    flex: 1;
    overflow-y: auto;
}

.td-activity-list::-webkit-scrollbar {
    width: 4px;
}

.td-activity-list::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
    border-radius: 2px;
}

.td-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.td-activity-item:last-child {
    border-bottom: none;
}

.td-activity-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(52, 211, 153, 0.1);
    border-radius: 6px;
}

.td-activity-icon svg {
    width: 14px;
    height: 14px;
    stroke: #34d399;
}

.td-activity-content {
    flex: 1;
    min-width: 0;
}

.td-activity-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #60a5fa;
    margin: 0 0 3px;
    line-height: 1.3;
}

.td-activity-desc {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.4;
}

.td-activity-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

.td-activity-empty {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
    margin: 0;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
    .terrain-detail-modal {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 16px !important;
    }

    .terrain-detail-modal .modal-content {
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        height: auto !important;
        max-height: calc(100dvh - 120px) !important;
        border-radius: 20px !important;
        margin: 0 !important;
        position: static !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
    }

    .td-body {
        grid-template-columns: 1fr;
        height: auto;
        max-height: calc(100dvh - 180px);
        overflow-y: auto;
    }

    .td-left {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        overflow: visible;
        padding: 16px;
    }

    .td-right {
        padding: 16px;
    }

    .td-header {
        padding: 14px 18px;
        text-align: center;
    }

    .td-title {
        font-size: 1rem;
        text-align: center;
        flex: 1;
    }

    .td-close-btn {
        position: absolute;
        right: 14px;
        top: 14px;
    }

    .td-label {
        text-align: center;
        font-size: 0.7rem;
    }

    .td-photos-section {
        margin-bottom: 1.25rem;
    }

    .td-photo-carousel {
        height: 220px;
    }

    .td-carousel-arrow {
        width: 34px;
        height: 34px;
    }

    .td-carousel-arrow svg {
        width: 16px;
        height: 16px;
    }

    .td-carousel-prev {
        left: 8px;
    }

    .td-carousel-next {
        right: 8px;
    }

    .td-carousel-counter {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .td-details-section,
    .td-summary-section,
    .td-checklist-section {
        margin-bottom: 1.25rem;
    }

    .td-details-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .td-detail-col {
        min-width: 45%;
        text-align: center;
    }

    .td-detail-key {
        font-size: 0.65rem;
    }

    .td-detail-val {
        font-size: 0.85rem;
    }

    .td-summary-row,
    .td-check-row {
        padding: 10px 12px;
        border-radius: 10px;
        margin-bottom: 6px;
    }

    .td-sum-key,
    .td-chk-key {
        font-size: 0.8rem;
    }

    .td-sum-val,
    .td-chk-link {
        font-size: 0.8rem;
        max-width: 55%;
    }

    .td-activity-card {
        max-height: 250px;
        padding: 14px;
        border-radius: 14px;
    }

    .td-activity-title-header {
        font-size: 0.8rem;
        text-align: center;
    }

    .td-activity-item {
        padding: 10px 0;
    }

    .td-activity-icon {
        width: 28px;
        height: 28px;
    }

    .td-activity-icon svg {
        width: 14px;
        height: 14px;
    }

    .td-activity-title {
        font-size: 0.75rem;
    }

    .td-activity-desc,
    .td-activity-time {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .terrain-detail-modal {
        padding: 12px !important;
    }

    .terrain-detail-modal .modal-content {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        max-height: calc(100dvh - 100px) !important;
        border-radius: 16px !important;
    }

    .td-header {
        padding: 12px 16px;
    }

    .td-title {
        font-size: 0.9rem;
    }

    .td-close-btn {
        width: 32px;
        height: 32px;
        right: 12px;
        top: 12px;
    }

    .td-left,
    .td-right {
        padding: 12px;
    }

    .td-photo-carousel {
        height: 170px;
    }

    .td-carousel-arrow {
        width: 30px;
        height: 30px;
    }

    .td-carousel-arrow svg {
        width: 14px;
        height: 14px;
    }

    .td-carousel-prev {
        left: 6px;
    }

    .td-carousel-next {
        right: 6px;
    }

    .td-carousel-counter {
        font-size: 0.7rem;
        padding: 4px 8px;
        bottom: 8px;
        right: 8px;
    }

    .td-detail-col {
        min-width: 100%;
    }

    .td-summary-row,
    .td-check-row {
        flex-wrap: wrap;
        padding: 8px 10px;
    }

    .td-chk-link,
    .td-sum-val {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
        text-align: left;
        max-width: 100%;
        padding-left: 22px;
    }

    .td-activity-card {
        max-height: 200px;
        padding: 12px;
    }

    .td-activity-item {
        padding: 8px 0;
    }

    .td-activity-icon {
        width: 24px;
        height: 24px;
    }

    .td-activity-icon svg {
        width: 12px;
        height: 12px;
    }
}