/* Utility Classes */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.max-w-\[150px\] { max-width: 150px; }
.max-w-\[200px\] { max-width: 200px; }

.tags-container-premium {
    max-height: 48px;
    overflow: hidden;
}

/* Filter Bar Specific Styles - LEVEL 1 */

.filter-scroll-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    /* overflow must be visible so desktop absolute dropdowns are not clipped */
    overflow: visible;
}

/* Gradient Mask to indicate more filters on mobile */
.filter-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 60px;
    background: linear-gradient(to right, transparent, white);
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@media (max-width: 768px) {
    .filter-scroll-wrapper::after {
        opacity: 1; /* Always show hint on mobile if applicable */
    }
}

/* Desktop: overflow visible so absolute dropdowns show above the bar */
.filter-bar-container .hide-scrollbar {
    overflow: visible !important;
    flex-wrap: nowrap !important;
    display: flex;
    scroll-behavior: smooth;
}

/* Mobile: horizontal scroll is ok because dropdowns will be portaled to body */
@media (max-width: 768px) {
    .filter-bar-container .hide-scrollbar {
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-right: 40px;
    }
}

/* Hide scrollbar for Chrome, Safari and Opera */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* --- PREMIUM SEARCH CARD STYLES (MOBILE) --- */

.search-card-premium {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 4px 15px -3px rgba(26, 54, 93, 0.08);
    position: relative;
    overflow: hidden;
}

.badge-compativel-premium {
    background-color: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rating-box-premium {
    background: #1A365D;
    color: white;
    padding: 6px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(26, 54, 93, 0.25);
    transition: transform 0.2s;
}

.rating-box-premium:active {
    transform: scale(0.95);
}

.tag-compact-premium {
    border: 1px solid #f1f5f9;
    color: #475569;
    background: #f8fafc;
    font-size: 8px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* Membro PRO Badge (Search Card) */
.badge-pro-search {
    background-color: #0f172a;
    color: #ffffff;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    margin-top: 8px;
}

.badge-pro-search .dot {
    width: 6px;
    height: 6px;
    background-color: #fbbf24;
    border-radius: 50%;
}

.badge-pro-search i {
    font-size: 8px;
}

/* Mobile Optimizations for PRO Badge */
@media (max-width: 767px) {
    .badge-pro-search {
        padding: 3px 8px;
        gap: 4px;
        font-size: 8px;
        letter-spacing: 0.2px;
    }

    .badge-pro-search .dot {
        width: 5px;
        height: 5px;
    }

    .badge-pro-search i {
        font-size: 7px;
    }
}

.whatsapp-btn-premium {
    background-color: #ffffff;
    border: 2px solid #22c55e;
    color: #166534;
    border-radius: 14px;
    padding: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.whatsapp-btn-premium:active {
    transform: scale(0.97);
    background-color: #f0fdf4;
}

/* --- REPUTATION SEAL ELITE --- */
.reputation-seal-premium {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    gap: 2px;
}

.reputation-seal-premium .note-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.reputation-seal-premium .note-value {
    font-size: 42px;
    /* Destaque máximo */
    font-weight: 900;
    color: #1A365D;
    /* Navy Elite */
    letter-spacing: -1px;
    line-height: 1;
}

.reputation-seal-premium .star-icon {
    color: #FBBF24;
    /* Gold vibrante */
    font-size: 24px;
    /* Aumentado para acompanhar o peso da nota */
    margin-top: -4px;
    /* Pequeno ajuste fino de alinhamento axial com os números */
}

.reputation-seal-premium .opinions-count {
    color: #64748b;
    /* Slate discreto */
    font-size: 10px;
    /* Aumentado de 9px para melhor legibilidade no desktop */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    /* Espaço de segurança positivo */
    display: block;
}

/* --- CUSTOM SORT DROPDOWN --- */
.custom-sort-container {
    position: relative;
    display: inline-block;
}

#sort-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #0d9488;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 0;
    transition: opacity 0.2s;
}

#sort-dropdown-btn:hover {
    opacity: 0.8;
}

#sort-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 100;
    overflow: hidden;
    transform-origin: top right;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#sort-dropdown-menu.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.95);
}

.sort-item {
    padding: 10px 16px;
    font-size: 13px;
    color: #1a365d;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.sort-item:hover {
    background: #f1f5f9;
    color: #0d9488;
}

.sort-item.active {
    background: #f0fdfa;
    color: #0d9488;
    font-weight: 700;
}

/* --- SEARCH BAR REFINEMENT --- */
.search-input-premium {
    padding-right: 120px !important;
    /* Espaço para o botão */
}

#inPageSearchBtn {
    height: 100%;
    /* Removido o calc fixo para permitir centralização via container flex */
    box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.2);
}

@media (max-width: 768px) {
    .reputation-seal-premium .note-value {
        font-size: 24px;
    }

    .reputation-seal-premium .star-icon {
        font-size: 16px;
        margin-top: -2px;
    }

    .reputation-seal-premium .note-value {
        font-size: 28px;
    }

    .search-input-premium {
        padding-right: 100px !important;
    }

    #inPageSearchBtn {
        px: 4 !important;
        /* Menos padding lateral no mobile */
        font-size: 9px !important;
    }
}

/* --- CONTACT BUTTON ANIMATIONS & STYLES --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
    animation: fadeIn 0.4s ease-out forwards;
}

.phone-btn-search {
    background-color: #ffffff;
    border: 2px solid rgba(26, 54, 93, 0.3);
    color: #1A365D;
    border-radius: 14px;
    padding: 12px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.phone-btn-search i {
    color: #1A365D;
    transition: color 0.3s;
}

.phone-btn-search:hover {
    background-color: #1A365D;
    border-color: #1A365D;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.2);
}

.phone-btn-search:hover span,
.phone-btn-search:hover i {
    color: #ffffff !important;
    opacity: 1 !important;
}

.phone-btn-search:active {
    transform: scale(0.97);
}

/* Mobile specific adjustments for Phone button */
@media (max-width: 767px) {
    .phone-btn-search {
        padding: 10px;
        gap: 10px;
    }
}

/* --- LEVEL 1: PREMIUM FILTERS & BOTTOM SHEETS --- */

/* Active Filter Button State */
.filter-btn-active {
    background-color: #f0fdfa !important; /* OpineMed-teal 50 */
    border-color: #0d9488 !important;   /* OpineMed-teal */
    color: #0d9488 !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15) !important;
}

.filter-btn-active i,
.filter-btn-active svg {
    color: #0d9488 !important;
    opacity: 1 !important;
}

/* Mobile Bottom Sheet & Backdrop */
@media (max-width: 768px) {
    .bottom-sheet-mobile {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        border-radius: 24px 24px 0 0 !important;
        margin: 0 !important;
        z-index: 1000 !important;
        transform: translateY(100%) scale(1) !important;
        opacity: 1 !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2) !important;
        max-height: 80vh !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /* Active state for bottom sheet */
    .bottom-sheet-mobile.sheet-open {
        transform: translateY(0) !important;
    }

    .sheet-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5); /* OpineMed-navy tint */
        backdrop-filter: blur(4px);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sheet-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    /* Handle for Bottom Sheet */
    .bottom-sheet-mobile::before {
        content: '';
        width: 40px;
        height: 4px;
        background: #e2e8f0;
        border-radius: 2px;
        margin: 12px auto;
        flex-shrink: 0;
    }
    
    /* Ensure content inside bottom sheet is scrollable */
    .bottom-sheet-mobile > div {
        overflow-y: auto;
        flex: 1;
        padding-bottom: 2rem;
    }
}
