/*
 * PropFirmMap Mobile Responsive Fixes
 * Comprehensive mobile styles for 375px and 768px breakpoints.
 * Loaded after all other stylesheets to override where needed.
 */

/* ── Mobile Menu Overlay ── */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
}

.mobile-menu-overlay.active {
    display: block;
}

/* ── Tablet (max 768px) ── */
@media (max-width: 768px) {

    /* Header: make it relative so children can position against it */
    header.pt-5 {
        padding-top: 1.5rem !important;
    }

    header .container-fluid > .row {
        position: relative;
    }

    /* Logo: remove hacky negative top positioning */
    .logo {
        position: static !important;
        top: auto !important;
        z-index: 1001 !important;
        display: block;
        text-align: center;
        margin-bottom: 0;
    }

    .logo img {
        width: 12rem !important;
    }

    /* Navbar: fixed hamburger position, proper stacking */
    .navbar {
        position: static !important;
        top: auto !important;
        right: auto !important;
        width: auto !important;
        padding: 0 !important;
        align-items: flex-end !important;
    }

    /* Hamburger icon: fixed position top-right */
    .hamburger {
        display: flex !important;
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 1002;
        padding: 8px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }

    /* Mobile menu: slide-down panel */
    .menu {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: linear-gradient(to bottom, #7A95F8 8%, #6453CA 92%);
        padding: 70px 20px 24px;
        gap: 6px;
        max-height: 100vh;
        overflow-y: auto;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .menu.active {
        display: flex !important;
    }

    .menu-item,
    .menu .dropdown {
        width: 100%;
    }

    .menu .menu-button {
        width: 100%;
        text-align: left;
        padding: 12px 16px !important;
        font-size: 15px;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        border-radius: 8px !important;
    }

    /* Dropdown content in mobile: static flow, not absolute */
    .menu .dropdown-content {
        position: static;
        border: none;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 0 0 8px 8px;
        margin-top: -4px;
    }

    .menu .dropdown:hover > .menu-button {
        border-radius: 8px 8px 0 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    }

    .menu .dropdown-content a {
        border-top-color: rgba(255, 255, 255, 0.1);
        padding: 10px 20px;
    }

    /* Search bar: clean positioning on inner pages */
    .col-lg-3 .search {
        margin-top: 8px !important;
        margin-right: 0 !important;
        width: 100% !important;
        padding: 6px 15px !important;
    }

    /* Search suggestions */
    .suggestions {
        width: 100% !important;
        left: 0 !important;
        top: 48px !important;
    }

    /* Page title: scale down for tablet */
    .page_title {
        font-size: 34px !important;
    }

    /* Homepage search title */
    .search-title {
        font-size: 34px !important;
    }

    /* Firm cards in index: 2 columns on tablet */
    .top_firm_tabs .row > .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Reduce footer spacer */
    .footer_height {
        height: 60px;
    }

    /* Tab pills: allow wrapping */
    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
    }

    li.nav-item > a.nav-link {
        padding: 6px 24px;
        font-size: 14px;
    }

    /* Sort controls: wrap nicely */
    .d-flex.justify-content-center.align-items-center.flex-wrap {
        gap: 8px !important;
    }
}

/* ── Mobile (max 576px) ── */
@media (max-width: 576px) {

    header.pt-5 {
        padding-top: 1rem !important;
    }

    .logo img {
        width: 10rem !important;
    }

    /* Hamburger tweak for smaller screens */
    .hamburger {
        top: 14px;
        right: 14px;
    }

    .menu {
        padding: 64px 16px 20px;
    }

    .menu .menu-button {
        padding: 10px 14px !important;
        font-size: 14px;
    }

    /* Hide search bar on mobile (homepage has its own) */
    .col-lg-3:has(.search) {
        display: none;
    }

    /* Page title: smaller for phones */
    .page_title {
        font-size: 26px !important;
        padding-top: 0.5rem !important;
    }

    .search-title {
        font-size: 26px !important;
    }

    /* Homepage popular firms: ensure readability */
    .popular-firm-chip {
        flex: 0 0 calc(50% - 4px);
    }

    /* Firm cards: single column on phone */
    .top_firm_tabs .row > .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Top rated cards: single column */
    .col-md-6.col-12.mb-3 .top-rated-card {
        padding: 12px;
    }

    /* Tab content: tighter padding */
    .tab-content {
        padding: 20px 10px;
    }

    .footer_div .div-56 {
        flex-direction: column;
    }

    .footer_div .div-56 a {
        font-size: 12px;
    }

    .footer_height {
        height: 40px;
    }

    /* Review tab cards: reduce padding */
    .review_tab {
        padding: 14px;
    }

    /* Rating bars: make progress title readable */
    span.progress_title {
        font-size: 11px;
        left: 40px;
    }

    span.progress_titles {
        font-size: 10px;
        margin-left: 8px;
        white-space: nowrap;
    }

    /* Tab pills: smaller on mobile */
    li.nav-item > a.nav-link {
        padding: 6px 16px !important;
        font-size: 13px;
    }

    /* Table responsiveness */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* Multi-step form: full width */
    #multiStepForm {
        width: 100% !important;
    }

    /* Checkbox labels: prevent text overflow */
    .form-check-label {
        font-size: 14px;
        padding: 8px 14px;
    }

    /* Search input on homepage: tighter */
    .search-input {
        padding: 14px 16px;
        font-size: 16px;
    }

    /* Firm detail promo button */
    .promo-btn {
        width: 80% !important;
    }

    /* Blog cards: full width */
    .col-md-6.mb-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ── Small phones (max 375px) ── */
@media (max-width: 375px) {

    .logo img {
        width: 9rem !important;
    }

    .page_title {
        font-size: 22px !important;
    }

    .search-title {
        font-size: 22px !important;
    }

    .section-label {
        font-size: 11px;
    }

    /* Top rated cards: tighter */
    .top-rated-card {
        padding: 10px;
        gap: 8px !important;
    }

    .top-rated-card .firm-logo-sm {
        width: 36px;
        height: 36px;
    }

    .top-rated-card .firm-name {
        font-size: 13px;
    }

    /* Score badge: smaller */
    .pfm-score-badge {
        padding: 3px 6px;
    }

    .pfm-score-value {
        font-size: 14px;
    }

    /* Cookie consent: tighter */
    .cookie-consent__inner {
        padding: 12px 14px;
        margin: 0 6px 6px;
    }

    .cookie-consent__text {
        font-size: 12px;
    }

    .cookie-consent__btn {
        font-size: 12px;
        padding: 6px 16px;
    }
}
