/* ============================================
   STYLES POUR LA PAGE PLANS CADASTRAUX
   ============================================ */

:root {
    --primary-color: #f88c05;
    --primary-dark: #e67e00;
    --secondary-color: #333;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --border-color: #e0e0e0;
}

/* ========== BOUTONS ========== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(248, 140, 5, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

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

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

/* ========== CANVAS CONTAINER ========== */
.canvas-container {
    position: relative;
    overflow: auto;
    background: #f5f5f5;
}

.canvas-wrapper {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== HERO PLAN DÉTAIL - DIMENSIONS EN % ========== */
.plan-detail-hero-fullwidth {
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
    position: relative;
    background: #111;
    overflow: hidden;
}

.plan-detail-hero-fullwidth .canvas-container-hero {
    width: 100%;
    height: 70vh;
    min-height: 40vh;
    overflow: auto;
    background: #111;
    border: none;
    border-radius: 0;
}

.plan-detail-hero-fullwidth .canvas-wrapper {
    width: 100%;
    min-height: 100%;
    justify-content: flex-start;
    align-items: flex-start;
}

/* Conteneur commun : image + canvas au même endroit */
#publicImageCanvasContainer {
    position: relative;
    display: block;
    width: 100%;
}

/* Image du plan */
#publicPlanImage {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    margin: 0;
}

/* Canvas superposé sur l’image : position et taille appliquées en JS (px) pour recouvrir exactement l’image */
#publicPlanCanvas {
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    z-index: 1;
}

.plan-hero-zoom-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(255,255,255,0.95);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

.plan-hero-zoom-controls #publicZoomLevel {
    font-weight: 600;
    min-width: 48px;
    text-align: center;
    font-size: 14px;
}

.plan-hero-astuce {
    margin: 0;
    padding: 12px 20px;
    background: #fff3e0;
    border-left: 4px solid var(--primary-color);
    color: #666;
    font-size: 14px;
    text-align: center;
}

.plan-hero-astuce i {
    color: var(--primary-color);
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    max-width: 700px;
    max-height: 90vh;
    width: 100%;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: white;
}

.modal-close {
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    color: white;
    transition: transform 0.2s;
}

.modal-close:hover {
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Scrollbar personnalisée pour le modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Modale "Détails de la parcelle" : ouverture avec effet de zoom */
#publicPortionModal .modal-content {
    animation: none;
}
#publicPortionModal:not(.portion-modal-open) .modal-content {
    transform: scale(0.7);
    opacity: 0;
}
#publicPortionModal.portion-modal-open .modal-content {
    animation: portionModalZoomIn 0.5s ease-out forwards;
}
@keyframes portionModalZoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
#publicPortionModal {
    transition: opacity 0.4s ease-out;
}
#publicPortionModal:not(.portion-modal-open) {
    opacity: 0;
}
#publicPortionModal.portion-modal-open {
    opacity: 1;
}

/* ========== PORTIONS CARDS ========== */
.portion-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.portion-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

/* ========== PLANS GRID ========== */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.plan-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.plan-card-image {
    height: 200px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plan-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.plan-card-content {
    padding: 20px;
}

.plan-card-content h3 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 20px;
}

.plan-card-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.plan-card-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #666;
}

.plan-card-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.plan-card-info i {
    color: var(--primary-color);
}

/* ========== INFO SECTIONS ========== */
.plan-info-section,
.search-filters-section,
.plan-canvas-section,
.portions-list-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.info-item {
    padding: 10px 0;
}

.info-item strong {
    display: block;
    color: #666;
    margin-bottom: 5px;
    font-size: 13px;
}

.info-item span {
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* ========== ZOOM CONTROLS ========== */
.zoom-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.zoom-indicator {
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    color: var(--primary-color);
}

/* ========== PAGINATION ========== */
.pagination-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .search-filters-section > div {
        grid-template-columns: 1fr !important;
    }
    
    .plan-info-section > div {
        grid-template-columns: 1fr !important;
    }
    
    .plans-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        margin: 20px;
        max-width: 100%;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-body > div > div {
        grid-template-columns: 1fr !important;
    }
    
    .canvas-container {
        height: 50vh !important;
    }
}

/* ========== SCROLLBAR PERSONNALISÉE ========== */
.canvas-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

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

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

/* ========== LOADING ========== */
.loading-message {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading-message i {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

/* ========== BADGES ========== */
.badge-disponible {
    background: var(--success-color);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

.badge-vendu {
    background: var(--danger-color);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

.badge-reserve {
    background: var(--warning-color);
    color: white;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

/* ========== INPUTS ========== */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(248, 140, 5, 0.1);
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* ========== CONTAINER ========== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== UTILITIES ========== */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

.p-20 {
    padding: 20px;
}
