/* =============================================
   RESET & BASE
   ============================================= */
* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    overflow: hidden;
    background-color: #000;
    color: #fff;
}

#map { width: 100%; height: 100%; cursor: crosshair; }


/* =============================================
   HEADER GLASSMORPHISM
   ============================================= */
#top-header {
    position: absolute; top: 0; left: 0; width: 100%; height: 70px;
    background-color: rgba(15, 15, 15, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000; display: flex; justify-content: space-between; align-items: center;
    padding: 0 30px; box-shadow: 0 4px 30px rgba(0,0,0,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
#top-header img { max-height: 32px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }

.header-actions { display: flex; gap: 12px; }
.header-btn {
    background-color: rgba(255, 255, 255, 0.05); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15); padding: 10px 16px;
    border-radius: 8px; font-family: 'Montserrat', sans-serif; font-weight: 600;
    font-size: 12px; cursor: pointer; text-transform: uppercase;
    letter-spacing: 0.5px; transition: all 0.3s ease;
}
.header-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.3);
}

.leaflet-top { margin-top: 85px !important; }


/* =============================================
   BOUTONS DE DESSIN CUSTOM
   ============================================= */
#custom-draw-tools {
    position: absolute; top: 85px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; gap: 10px;
}
.draw-btn {
    background-color: rgba(20, 20, 20, 0.85); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 18px; border-radius: 8px; font-family: 'Inter', sans-serif;
    font-weight: 600; font-size: 13px; cursor: pointer;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4); display: flex; align-items: center;
    gap: 8px; transition: all 0.2s ease;
}
.draw-btn:hover {
    background-color: rgba(40, 40, 40, 0.95);
    transform: translateY(-2px);
    border-color: #fff;
}
.draw-btn.active { background-color: #fff; color: #000; }

.leaflet-draw-toolbar { display: none !important; }

.leaflet-draw-actions {
    left: 50% !important; transform: translateX(-50%) !important;
    top: 135px !important; right: auto !important;
    background: transparent !important;
}
.leaflet-draw-actions a {
    background-color: rgba(0, 0, 0, 0.8) !important; color: #fff !important;
    font-family: 'Inter', sans-serif !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    border-radius: 4px !important;
}
.leaflet-draw-actions a:hover { background-color: #333 !important; }


/* =============================================
   PANNEAU DE COMMANDE (DROITE)
   ============================================= */
#order-panel {
    position: absolute; bottom: 20px; right: 20px; z-index: 1000;
    background-color: rgba(18, 18, 18, 0.65);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    color: #fff; padding: 20px; border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7); width: 380px; display: none;
    max-height: calc(100vh - 110px); overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.12);
}
#order-panel::-webkit-scrollbar { width: 6px; }
#order-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }


/* =============================================
   BANDEAU DES ZONES (GAUCHE)
   ============================================= */
#zone-list-panel {
    position: absolute; bottom: 20px; left: 20px; z-index: 1000;
    background-color: rgba(18, 18, 18, 0.65);
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    color: #fff; padding: 15px; border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7); display: none;
    flex-direction: column; gap: 10px;
    max-width: calc(100% - 440px);
    border: 1px solid rgba(255,255,255,0.12);
}
.zone-cards-container {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px;
}
.zone-cards-container::-webkit-scrollbar { height: 6px; }
.zone-cards-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

.zone-card {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px; padding: 10px 15px; display: flex; align-items: center;
    gap: 15px; min-width: 160px; justify-content: space-between; flex-shrink: 0;
}
.zone-info {
    display: flex; flex-direction: column; gap: 2px; font-size: 13px;
    font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 150px;
}
.zone-info span { color: #aaa; font-size: 11px; font-weight: 400; }
.zone-actions { display: flex; gap: 5px; }
.zone-actions button {
    background: rgba(255,255,255,0.1); border: none; color: #fff; border-radius: 4px;
    cursor: pointer; padding: 6px; transition: 0.2s; font-size: 12px;
}
.zone-actions button:hover { background: rgba(255,255,255,0.25); transform: translateY(-1px); }


/* =============================================
   TYPOGRAPHIE PANNEAU
   ============================================= */
h3 {
    margin: 0 0 5px 0; font-family: 'Montserrat', sans-serif;
    font-size: 18px; font-weight: 700; letter-spacing: -0.5px;
}
h4 { margin: 0; font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; color: #ccc; }

.surface-info {
    color: #aaa; font-size: 13px; font-weight: 400; margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 10px; line-height: 1.6;
}

.client-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.client-form input {
    padding: 8px 10px;
    background-color: rgba(0, 0, 0, 0.4); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 6px;
    font-size: 13px; font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}
.client-form input:focus {
    border-color: rgba(255, 255, 255, 0.5); outline: none;
    background-color: rgba(0, 0, 0, 0.7);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
}
.client-form input::placeholder { color: #666; }

.section-title {
    font-size: 10px; font-weight: 700; color: #999; margin: 15px 0 10px 0;
    text-transform: uppercase; letter-spacing: 1px;
}


/* =============================================
   GRILLE DE PRODUITS
   ============================================= */
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.product-card { cursor: pointer; display: block; user-select: none; }
.product-card input { display: none; }
.card-content {
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px; padding: 12px 8px; text-align: center; transition: all 0.3s ease;
    height: 100%; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 8px;
}
.product-card:hover .card-content { background: rgba(255, 255, 255, 0.1); transform: translateY(-2px); }
.product-card input:checked + .card-content {
    background: rgba(255, 255, 255, 0.15); border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}
.product-icon { font-size: 24px; opacity: 0.7; transition: opacity 0.3s ease; }
.product-card input:checked + .card-content .product-icon { opacity: 1; }
.product-name {
    font-size: 11px; font-weight: 600; line-height: 1.3; color: rgba(255,255,255,0.7);
    transition: color 0.3s ease; display: flex; flex-direction: column;
    align-items: center; gap: 4px;
}
.product-card input:checked + .card-content .product-name { color: #fff; }


/* =============================================
   TOOLTIPS
   ============================================= */
.tooltip {
    display: inline-block; width: 14px; height: 14px; background: rgba(255,255,255,0.15);
    border-radius: 50%; text-align: center; line-height: 14px; font-size: 9px;
    font-weight: bold; position: relative; cursor: help; color: #ddd; transition: 0.2s;
}
.tooltip:hover { background: #007bff; color: #fff; }
.tooltip .tooltip-text {
    visibility: hidden; width: 180px; background-color: rgba(20,20,20,0.95);
    color: #fff; text-align: center; border-radius: 6px; padding: 8px 10px;
    position: absolute; z-index: 9999; bottom: 150%; left: 50%;
    transform: translateX(-50%); opacity: 0; transition: opacity 0.2s;
    font-size: 10px; font-weight: 400; border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.6); pointer-events: none; line-height: 1.4;
}
.tooltip .tooltip-text::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid;
    border-color: rgba(20,20,20,0.95) transparent transparent transparent;
}
.tooltip:hover .tooltip-text { visibility: visible; opacity: 1; }


/* =============================================
   AVERTISSEMENTS & MESSAGES
   ============================================= */
.alert-box {
    display: none; padding: 10px; border-radius: 8px; font-size: 12px;
    font-weight: 600; margin-bottom: 15px; text-align: center;
}
#area-limit-warning {
    background-color: rgba(255, 77, 77, 0.15); color: #ff7675;
    border: 1px solid rgba(255, 77, 77, 0.3);
}

.cgv-group {
    font-size: 11px; color: #888; margin-bottom: 15px;
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.4;
}
.cgv-group:hover { color: #bbb; }
.cgv-group input { margin-top: 2px; accent-color: #fff; transform: scale(1.1); }

.btn-submit {
    background: #ffffff; color: #000; border: none; padding: 12px; cursor: pointer;
    border-radius: 8px; font-family: 'Montserrat', sans-serif; font-weight: 700;
    width: 100%; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px;
    transition: all 0.3s ease;
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 8px 15px rgba(255,255,255,0.2); background: #f0f0f0; }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { background: rgba(255,255,255,0.1); color: #555; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-clear {
    background: none; color: #ff7675; border: none; padding: 8px; cursor: pointer;
    width: 100%; margin-top: 5px; font-size: 12px; font-weight: 600;
    text-decoration: underline; transition: 0.3s; opacity: 0.8;
}
.btn-clear:hover { color: #ff4d4d; opacity: 1; }


/* =============================================
   STYLES CARTOGRAPHIQUES (LEAFLET)
   ============================================= */
.leaflet-bar, .leaflet-control-geocoder {
    background-color: rgba(25, 25, 25, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(10px) !important; -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 8px !important; overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5) !important;
}
.leaflet-bar a, .leaflet-control-geocoder-icon {
    background-color: transparent !important; color: #fff !important;
    border: none !important; border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 34px !important; height: 34px !important; line-height: 34px !important;
    text-align: center; transition: 0.2s ease !important; font-size: 16px !important;
}
.leaflet-bar a:last-child { border-bottom: none !important; }
.leaflet-control-locate { filter: none !important; color: #fff !important; }
.leaflet-control-zoom-in:hover, .leaflet-control-zoom-out:hover { background-color: rgba(255, 255, 255, 0.15) !important; }
.leaflet-control-geocoder-form input {
    color: #fff !important; background-color: transparent !important;
    font-family: 'Inter', sans-serif !important; font-size: 14px !important;
    padding-left: 10px !important;
}
.leaflet-control-geocoder-form input::placeholder { color: #999 !important; }
.leaflet-control-geocoder-form { background-color: transparent !important; }

.leaflet-editing-icon {
    border-radius: 50% !important; width: 14px !important; height: 14px !important;
    margin-left: -7px !important; margin-top: -7px !important;
    background-color: #ffffff !important; border: 1px solid #000 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6) !important;
}
.leaflet-editing-icon.leaflet-interactive { opacity: 0.9 !important; cursor: pointer !important; }
.leaflet-interactive { cursor: pointer !important; }

.zone-label {
    background: transparent !important; border: none !important; box-shadow: none !important;
    color: #ffffff !important; font-family: 'Inter', sans-serif; font-weight: 700; font-size: 13px;
    text-shadow: 0px 0px 4px #000000, 0px 0px 8px #000000; text-align: center; pointer-events: none;
}


/* =============================================
   RESPONSIVE MOBILE
   ============================================= */
@media (max-width: 768px) {
    #top-header { padding: 0 15px; height: 60px; }
    .header-btn { padding: 8px 12px; font-size: 10px; }
    #custom-draw-tools { top: 75px; width: 90%; justify-content: center; }
    .draw-btn { font-size: 11px; padding: 8px 12px; }
    #order-panel {
        right: 0; bottom: 0; width: 100%; border-radius: 20px 20px 0 0;
        max-height: 55vh; padding: 20px; box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
    }
    #zone-list-panel { top: 125px; bottom: auto; left: 10px; right: 10px; max-width: 100%; padding: 10px; }
    .leaflet-top { margin-top: 170px !important; }
    .leaflet-draw-actions { top: 115px !important; }
}