/**
 * Calculator Search - Modern Design COMPACT
 * Fichier: /css/calculator-search.css
 */

/* ========================================
   FIX CRITIQUE - DROPDOWN NON COUPÉ
======================================== */

.home-calculator,
.home-calculator .calculator-card,
.home-calculator .calculator-form,
.home-calculator .form-group,
.calculator-section,
.calculator-container,
section.calculator-container {
    overflow: visible !important;
}

.destination-search-wrapper,
.form-group:has(.modern-search-container) {
    position: relative !important;
    overflow: visible !important;
    z-index: 100 !important;
}

/* ========================================
   OMBRAGE DU CONTAINER CALCULATOR - UNE LIGNE
======================================== */

section.calculator-container,
.calculator-container {
    box-shadow: 
        0 3px 5px rgba(0, 0, 0, 0.06),
        0 8px 15px rgba(0, 0, 0, 0.08),
        0 15px 30px rgba(0, 0, 0, 0.1) !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 10 !important;
    margin-bottom: 25px !important;
    max-width: 1150px !important;
    padding: 20px 35px !important;
    border-radius: 12px !important;
}

/* ========================================
   FORM LAYOUT - UNE SEULE LIGNE
======================================== */
.calculator-form {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-end !important;
    gap: 15px !important;
    overflow: visible !important;
}

.calculator-form .form-group {
    flex: 1 !important;
    min-width: 180px !important;
}

.calculator-form .form-group:first-child {
    flex: 2 !important;
    min-width: 280px !important;
}

.calculator-form .calculate-plan-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    height: 42px !important;
    align-self: flex-end !important;
    padding: 0 25px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

.calculator-form .form-group:first-child {
    width: 100% !important;
    max-width: 100% !important;
    flex: 2 !important;
}

.destination-search-wrapper {
    position: relative;
    width: 100%;
    overflow: visible !important;
}

.form-group > label[for="destination-search"] {
    display: none;
}

#destination-search {
    display: none !important;
}

.selected-destination {
    display: none !important;
}

/* ========================================
   DIMENSIONS FIXES - DURÉE & FORFAIT DATA - UNE LIGNE
======================================== */
.calculator-form .form-group {
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    flex: 1 !important;
}

.calculator-form .form-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 11px !important;
}

.calculator-form select,
#duration-select,
#data-select,
#usage-select,
select[name="duration"],
select[name="data"] {
    width: 100% !important;
    min-width: 180px !important;
    max-width: 100% !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 35px 0 14px !important;
    font-size: 0.9rem !important;
    line-height: 42px !important;
    box-sizing: border-box !important;
    border: 2px solid #ddd !important;
    border-radius: 8px !important;
    background-color: #fff !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    cursor: pointer !important;
}

.calculator-form select:disabled,
#duration-select:disabled,
#data-select:disabled {
    background-color: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

/* ========================================
   SEARCH CONTAINER - STYLE TURQUOISE - UNE LIGNE
======================================== */
.modern-search-container {
    display: flex;
    align-items: center;
    background: #fff !important;
    border: 2px solid #00bfa5 !important;
    border-radius: 25px !important;
    padding: 4px 4px 4px 18px !important;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 191, 165, 0.12) !important;
    width: 100%;
    min-height: 42px !important;
    height: 42px !important;
    cursor: text !important;
    opacity: 0;
    transform: translateY(-10px);
    animation: searchFadeIn 0.5s ease forwards;
    animation-delay: 0.1s;
}

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

.modern-search-container:focus-within {
    border-color: #00a896 !important;
    box-shadow: 0 3px 15px rgba(0, 191, 165, 0.25) !important;
}

.modern-search-container .modern-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    font-size: 0.9rem !important;
    color: #333;
    background: transparent !important;
    padding: 8px 0 !important;
    box-shadow: none !important;
    min-width: 0;
    width: 100%;
    cursor: text !important;
}

.modern-search-container .modern-search-input::placeholder {
    color: #999;
    font-size: 0.85rem;
}

.modern-search-container .clear-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 10px;
    display: none;
    flex-shrink: 0;
    transition: color 0.2s;
}

.modern-search-container .clear-btn.visible {
    display: block;
}

.modern-search-container .search-btn {
    background: linear-gradient(135deg, #f7931e 0%, #e8850a 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.modern-search-container .search-btn:hover {
    background: linear-gradient(135deg, #e8850a 0%, #d4780a 100%) !important;
    transform: scale(1.05);
}

.modern-search-container .search-btn svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: white;
    stroke-width: 2.5;
}

/* ========================================
   DROPDOWN SUGGESTIONS - COMPACT
======================================== */
#destination-suggestions,
.destination-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 99999 !important;
    display: none;
    border: 1px solid #e0e0e0;
}

#destination-suggestions.show,
.destination-suggestions.show {
    display: block !important;
    animation: dropdownSlide 0.25s ease;
}

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

#destination-suggestions::-webkit-scrollbar,
.destination-suggestions::-webkit-scrollbar {
    width: 6px;
}

#destination-suggestions::-webkit-scrollbar-track,
.destination-suggestions::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

#destination-suggestions::-webkit-scrollbar-thumb,
.destination-suggestions::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ========================================
   CATEGORY HEADERS - COMPACT
======================================== */
.ms-category {
    background: #f8f8f8;
    padding: 6px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #eee;
}

/* ========================================
   SUGGESTION ITEMS - COMPACT
======================================== */
.ms-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f5f5f5;
}

.ms-item:last-child {
    border-bottom: none;
}

.ms-item:hover,
.ms-item.highlighted {
    background: #f0f9f8;
}

.ms-item .ms-flag {
    width: 22px;
    height: 15px;
    margin-right: 10px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 1px 2px rgba(0,0,0,0.12);
}

.ms-item .ms-flag-text {
    font-size: 1.1rem;
    margin-right: 10px;
    min-width: 22px;
    text-align: center;
}

.ms-item .ms-content {
    flex: 1;
}

.ms-item .ms-name {
    font-weight: 500;
    color: #333;
    font-size: 0.85rem;
}

.ms-item .ms-chevron {
    color: #ccc;
    font-size: 1rem;
    margin-left: 8px;
}

.ms-item:hover .ms-chevron {
    color: #00bfa5;
}

/* ========================================
   RECENT SEARCHES - COMPACT
======================================== */
.ms-history {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f5f5f5;
}

.ms-history:hover {
    background: #f0f9f8;
}

.ms-history .ms-clock {
    color: #bbb;
    font-size: 1rem;
    margin-right: 10px;
}

.ms-history .ms-flag {
    width: 18px;
    height: 12px;
    margin-right: 6px;
    border-radius: 2px;
    object-fit: cover;
}

.ms-history .ms-name {
    flex: 1;
    font-size: 0.85rem;
    color: #333;
}

.ms-history .ms-remove {
    background: none;
    border: none;
    color: #ccc;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.ms-history .ms-remove:hover {
    color: #e74c3c;
}

/* ========================================
   NO RESULTS / LOADING - COMPACT
======================================== */
.ms-no-results {
    padding: 25px 15px;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
}

.ms-loading {
    padding: 25px 15px;
    text-align: center;
    color: #888;
}

.ms-loading .ms-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #f0f0f0;
    border-top-color: #f7931e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   BOUTON "VOIR MON FORFAIT" - ORANGE - UNE LIGNE
======================================== */
.calculate-plan-btn,
.btn-calculate {
    background: linear-gradient(135deg, #f7931e 0%, #e8850a 100%) !important;
    color: #fff !important;
    padding: 0 28px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    height: 42px !important;
    min-height: 42px !important;
    white-space: nowrap !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    line-height: 1 !important;
    border: none !important;
    cursor: pointer !important;
}

.calculate-plan-btn:hover,
.btn-calculate:hover {
    background: linear-gradient(135deg, #e8850a 0%, #d4780a 100%) !important;
}

/* ========================================
   RESPONSIVE - UNE LIGNE SUR DESKTOP, COLONNE SUR MOBILE
======================================== */
@media (max-width: 768px) {
    .modern-search-container {
        padding: 4px 4px 4px 14px !important;
        min-height: 38px !important;
    }
    
    .modern-search-container .modern-search-input {
        font-size: 0.85rem !important;
        padding: 6px 0 !important;
    }
    
    .modern-search-container .search-btn {
        width: 30px !important;
        height: 30px !important;
    }
    
    .modern-search-container .search-btn svg {
        width: 14px;
        height: 14px;
    }
    
    #destination-suggestions,
    .destination-suggestions {
        max-height: 280px;
        border-radius: 10px;
    }
    
    .calculator-form select,
    #duration-select,
    #data-select {
        min-width: 100% !important;
        height: 36px !important;
        min-height: 36px !important;
        font-size: 0.8rem !important;
    }
    
    section.calculator-container,
    .calculator-container {
        max-width: 100% !important;
        padding: 15px 18px !important;
        margin: 0 10px 20px !important;
    }
    
    /* Sur mobile: revenir en colonnes */
    .calculator-form {
        flex-direction: column !important;
        flex-wrap: wrap !important;
    }
    
    .calculator-form .form-group,
    .calculator-form .form-group:first-child {
        flex: 1 1 100% !important;
        width: 100% !important;
    }
    
    .calculator-form .calculate-plan-btn {
        width: 100% !important;
        margin-top: 5px !important;
    }
}

/* Tablette - 2 lignes */
@media (min-width: 769px) and (max-width: 1024px) {
    section.calculator-container,
    .calculator-container {
        max-width: 95% !important;
    }
    
    .calculator-form .form-group:first-child {
        flex: 1.5 !important;
    }
}
