/**
 * HamamSpaAdvisor — Global Mobile Fixes
 * Scoped overrides; desktop layout preserved at ≥993px.
 */

/* ===== GLOBAL ===== */
.site-lang-compact {
    display: none;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.app-body,
body.admin-body,
body.business-body {
    overflow-x: hidden;
    max-width: 100vw;
}

img,
video,
iframe,
svg {
    max-width: 100%;
    height: auto;
}

/* Touch targets — mobil formlar & paneller */
@media (max-width: 992px) {
    button,
    .btn,
    .site-btn,
    .rezai-option,
    .rezai-btn-next,
    .site-lang-chip,
    .site-menu-list--mobile a,
    .profile-menu a,
    .sidebar-toggle,
    .site-nav-toggle,
    .site-lang-compact,
    input[type="submit"],
    input[type="button"],
    select,
    .custom-select-trigger,
    .app-datepicker-trigger {
        min-height: 44px;
    }

    input,
    textarea,
    select,
    .form-control,
    .custom-select-trigger,
    .app-datepicker-trigger {
        font-size: 16px;
    }
}

/* ===== DESKTOP HEADER (≥993px) — premium layout korunur ===== */
@media (min-width: 993px) {
    .site-topbar {
        display: block;
    }

    .site-topbar-inner {
        max-width: var(--home-shell, 1320px);
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .site-navbar-inner {
        max-width: var(--home-shell, 1320px);
        margin: 0 auto;
        height: 72px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
        gap: 16px;
    }

    .site-logo {
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    .site-menu-desktop {
        display: block;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 1;
    }

    .site-menu-desktop .site-menu-list {
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        gap: 20px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .site-menu-desktop .site-menu-list li {
        border-bottom: none;
    }

    .site-menu-desktop .site-menu-list a {
        display: inline;
        padding: 0;
        font-size: 14px;
        white-space: nowrap;
        min-height: auto;
    }

    .site-actions {
        display: flex !important;
        align-items: center;
        gap: 8px;
        flex-shrink: 0;
        margin-left: auto;
        position: relative;
        z-index: 2;
    }

    .site-nav-toggle,
    .site-lang-compact,
    .site-mobile-nav {
        display: none !important;
    }
}

/* ===== MOBILE HEADER (≤992px) ===== */
@media (max-width: 992px) {
    .site-topbar {
        display: none;
    }

    .site-navbar-inner {
        height: 58px;
        gap: 8px;
    }

    .site-logo-img {
        height: 30px;
    }

    .site-logo-icon {
        width: 30px;
        height: 30px;
        font-size: 13px;
    }

    .site-logo-text {
        font-size: 18px;
    }

    .site-nav-toggle {
        display: flex;
        order: 4;
        margin-left: 0;
    }

    .site-lang-compact {
        display: inline-flex;
        order: 3;
        align-items: center;
        gap: 5px;
        padding: 0 10px;
        min-height: 38px;
        border: 1px solid var(--home-border, #E5E7EB);
        border-radius: 8px;
        background: #fff;
        font-size: 12px;
        font-weight: 700;
        color: var(--home-navy, #101B33);
        cursor: pointer;
        font-family: Inter, sans-serif;
        flex-shrink: 0;
    }

    .site-actions {
        display: none;
    }

    .site-menu-desktop {
        display: none !important;
    }

    /* Mobile drawer — header flex dışında */
    .site-mobile-nav {
        position: fixed;
        inset: 0;
        z-index: 1300;
        display: none;
        pointer-events: none;
    }

    .site-mobile-nav.open {
        display: block;
        pointer-events: auto;
    }

    .site-mobile-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(16, 27, 51, 0.45);
        backdrop-filter: blur(2px);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .site-mobile-nav.open .site-mobile-backdrop {
        opacity: 1;
    }

    .site-mobile-drawer {
        position: absolute;
        top: 0;
        right: 0;
        width: min(340px, 92vw);
        height: 100%;
        background: #fff;
        display: flex;
        flex-direction: column;
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    }

    .site-mobile-nav.open .site-mobile-drawer {
        transform: translateX(0);
    }

    html[dir="rtl"] .site-mobile-drawer {
        right: auto;
        left: 0;
        transform: translateX(-100%);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.12);
    }

    html[dir="rtl"] .site-mobile-nav.open .site-mobile-drawer {
        transform: translateX(0);
    }

    .site-mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        border-bottom: 1px solid #eef0f3;
        flex-shrink: 0;
    }

    .site-mobile-drawer-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--home-navy, #101B33);
    }

    .site-mobile-drawer-close {
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 10px;
        background: #f3f4f6;
        color: var(--home-navy, #101B33);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }

    .site-mobile-drawer-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0 24px;
    }

    .site-menu-list--mobile {
        position: static;
        transform: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        height: auto;
        padding: 0 16px;
        gap: 0;
        background: transparent;
    }

    .site-menu-list--mobile li {
        border-bottom: 1px solid #eef0f3;
    }

    .site-menu-list--mobile a {
        padding: 14px 4px;
        display: block;
        font-size: 15px;
    }

    .site-mobile-section {
        padding: 16px;
        border-top: 8px solid #f8fafc;
    }

    .site-mobile-section-title {
        font-size: 13px;
        font-weight: 700;
        color: var(--home-muted, #6B7280);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin: 0 0 12px;
    }

    .site-mobile-quick {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .site-mobile-quick a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 8px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 500;
        color: var(--home-navy, #101B33);
        text-decoration: none;
    }

    .site-mobile-quick a i {
        color: var(--home-gold, #C9A84C);
        width: 18px;
        text-align: center;
    }

    .site-mobile-quick a:hover {
        background: #f8fafc;
    }

    .site-mobile-auth {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .site-mobile-auth-label {
        font-size: 14px;
        font-weight: 600;
        color: var(--home-navy, #101B33);
        margin: 0 0 8px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .site-mobile-auth a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 8px;
        border-radius: 10px;
        font-size: 14px;
        color: var(--home-navy, #101B33);
        text-decoration: none;
    }

    .site-mobile-auth a i {
        width: 18px;
        text-align: center;
        color: var(--home-gold, #C9A84C);
    }

    .site-mobile-logout {
        color: #dc2626 !important;
    }

    .site-mobile-logout i {
        color: #dc2626 !important;
    }

    .site-mobile-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 16px;
        border-radius: 10px;
        font-size: 14px;
        font-weight: 600;
        text-decoration: none;
        text-align: center;
    }

    .site-mobile-btn-ghost {
        border: 1px solid #e5e7eb;
        color: var(--home-navy, #101B33);
    }

    .site-mobile-btn-navy {
        background: var(--home-navy, #101B33);
        color: #fff;
    }

    .site-lang-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

    .site-lang-chip {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 10px 4px;
        min-height: 52px;
        border: 1.5px solid #e5e7eb;
        border-radius: 10px;
        text-decoration: none;
        color: var(--home-navy, #101B33);
        font-size: 11px;
        font-weight: 700;
        transition: border-color 0.15s, background 0.15s;
    }

    .site-lang-chip-flag {
        font-size: 16px;
        line-height: 1;
    }

    .site-lang-chip.is-active {
        background: var(--home-navy, #101B33);
        border-color: var(--home-gold, #C9A84C);
        color: #fff;
        box-shadow: 0 0 0 1px var(--home-gold, #C9A84C);
    }

    body.nav-open {
        overflow: hidden;
    }
}

@media (max-width: 576px) {
    .site-lang-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .site-lang-chip {
        padding: 8px 2px;
        min-height: 48px;
    }
}

@media (max-width: 420px) {
    .site-lang-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .site-logo-text {
        font-size: 16px;
    }
}

/* ===== PUBLIC HOME ===== */
@media (max-width: 992px) {
    .site-container {
        padding: 0 16px;
    }

    body.page-home main {
        padding-top: 0;
    }

    .home-hero-v2-copy h1 {
        font-size: clamp(1.375rem, 5vw, 1.75rem);
        line-height: 1.25;
    }

    .home-search-panel-v2,
    .home-search-wrap {
        margin-left: 0;
        margin-right: 0;
    }

    .home-search-btn,
    .home-hero-query-btn {
        width: 100%;
    }

    .home-popular-chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 6px;
        margin-left: -4px;
        margin-right: -4px;
    }

    .home-popular-chips::-webkit-scrollbar {
        display: none;
    }

    .home-quick-chip {
        flex-shrink: 0;
    }

    .home-category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 576px) {
    .home-category-grid,
    body.page-home .home-featured-grid,
    .home-why-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== LISTING MOBILE ===== */
.listing-filter-toggle {
    display: none;
}

.listing-filter-sheet-head,
.listing-filter-overlay {
    display: none;
}

@media (max-width: 992px) {
    .listing-filter-toggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-top: 12px;
        padding: 10px 16px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        background: #fff;
        font-size: 14px;
        font-weight: 600;
        color: #101B33;
        cursor: pointer;
    }

    .listing-filter-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(16, 27, 51, 0.45);
        z-index: 1250;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .listing-filter-overlay.is-open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .listing-filters {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1260;
        max-height: 85vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
        background: #fff;
        box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 16px 24px;
    }

    .listing-filters.is-open {
        transform: translateY(0);
    }

    .listing-filter-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        background: #fff;
        padding: 16px 0 12px;
        margin-bottom: 8px;
        border-bottom: 1px solid #eef0f3;
        z-index: 1;
    }

    .listing-filter-sheet-head h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 700;
    }

    .listing-filter-close {
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 10px;
        background: #f3f4f6;
        cursor: pointer;
    }

    body.listing-filters-open {
        overflow: hidden;
    }

    .listing-layout {
        grid-template-columns: 1fr !important;
    }

    .listing-results .business-card,
    .listing-results .listing-card {
        width: 100%;
    }

    .listing-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .listing-toolbar .sort-form {
        width: 100%;
    }

    .listing-toolbar .custom-select {
        width: 100%;
    }
}

/* ===== DETAIL MOBILE ===== */
@media (max-width: 992px) {
    .business-detail-page .detail-layout.detail-layout-v2 {
        grid-template-columns: 1fr;
    }

    .business-detail-page .detail-sidebar.detail-sidebar-sticky {
        position: static;
    }

    .business-detail-page .detail-cta-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 900;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0));
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08);
    }

    .business-detail-page .detail-cta-buttons {
        display: flex;
        gap: 8px;
    }

    .business-detail-page .detail-cta-buttons .btn-cta {
        flex: 1;
        min-height: 44px;
        justify-content: center;
    }

    body.page-detail main,
    .business-detail-page {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
    }

    .business-detail-page .detail-map-wrap iframe,
    .business-detail-page .detail-map iframe {
        width: 100%;
        max-width: 100%;
    }

    .business-detail-page .availability-slots,
    .business-detail-page .slot-chips {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 576px) {
    .business-detail-page .availability-slots,
    .business-detail-page .slot-chips {
        grid-template-columns: 1fr;
    }
}

/* ===== REZAI MOBILE ===== */
@media (max-width: 767px) {
    .rezai-floating-button {
        right: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0));
        padding: 10px 12px;
        max-width: calc(100vw - 24px);
        z-index: 99990;
    }

    .rezai-fab-content {
        max-width: 120px;
    }

    .rezai-drawer {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
    }

    .rezai-body,
    .rezai-chat {
        max-height: calc(90vh - 140px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .rezai-options {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .rezai-option {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        font-size: 13px;
        padding: 10px 8px;
        word-break: break-word;
    }

    .rezai-input-row {
        flex-wrap: wrap;
    }

    .rezai-input-row input,
    .rezai-input-row select {
        width: 100%;
        min-width: 0;
    }

    .rezai-result-card {
        flex-direction: column;
    }

    .rezai-result-img-wrap {
        width: 100%;
        height: 160px;
    }

    .rezai-actions {
        flex-direction: column;
        gap: 8px;
    }

    .rezai-btn-detail,
    .rezai-btn-book {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .rezai-close {
        min-width: 44px;
        min-height: 44px;
    }

    body.page-detail .rezai-floating-button {
        bottom: calc(80px + env(safe-area-inset-bottom, 0));
    }
}

/* ===== USER PANEL MOBILE ===== */
.user-panel-toggle {
    display: none;
}

@media (max-width: 992px) {
    .user-panel-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 10px;
        padding: 12px 16px;
        margin-bottom: 16px;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        background: #fff;
        font-size: 14px;
        font-weight: 600;
        color: #101B33;
        cursor: pointer;
    }

    .user-panel-toggle-chevron {
        transition: transform 0.2s;
    }

    .user-panel-toggle[aria-expanded="true"] .user-panel-toggle-chevron {
        transform: rotate(180deg);
    }

    .col-lg-4:has(.profile-sidebar) {
        width: 100%;
    }

    .profile-sidebar {
        display: none;
        margin-bottom: 20px;
    }

    .profile-sidebar.is-open {
        display: block;
    }

    .page-header-simple h1 {
        font-size: 1.35rem;
    }

    .reservation-card,
    .reservation-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .messages-layout {
        flex-direction: column;
    }

    .messages-sidebar {
        width: 100%;
        max-height: 240px;
        overflow-y: auto;
    }
}

/* ===== ADMIN / BUSINESS PANEL MOBILE ===== */
.panel-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
}

.panel-sidebar-overlay.is-open {
    display: block;
}

@media (max-width: 992px) {
    .admin-sidebar,
    .business-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1050;
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .business-sidebar {
        transform: translateX(-100%);
    }

    .business-sidebar.active {
        transform: translateX(0);
    }

    .admin-main,
    .business-main {
        margin-left: 0 !important;
        width: 100%;
    }

    .admin-topbar,
    .business-topbar {
        padding: 10px 12px;
    }

    .topbar-right {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .admin-content,
    .business-content {
        padding: 12px;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }

    .status-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== RESPONSIVE TABLES ===== */
.responsive-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .admin-table,
    .business-table,
    table.responsive-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mobile-card-list tbody,
    .mobile-card-list thead {
        display: block;
    }

    .mobile-card-list thead {
        display: none;
    }

    .mobile-card-list tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 12px;
    }

    .mobile-card-list tbody td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
        padding: 6px 0;
        border: none;
        font-size: 13px;
    }

    .mobile-card-list tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        flex-shrink: 0;
        max-width: 45%;
    }

    .mobile-card-list tbody td:last-child {
        border-top: 1px solid #f3f4f6;
        padding-top: 10px;
        margin-top: 4px;
    }
}

/* ===== FORMS / FOOTER ===== */
@media (max-width: 768px) {
    .site-footer .row {
        gap: 24px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .footer-bottom-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .auth-card,
    .auth-box {
        margin: 16px;
        padding: 24px 20px;
    }

    .container {
        padding-left: 16px;
        padding-right: 16px;
        max-width: 100%;
    }
}

/* Sticky header offset */
@media (max-width: 992px) {
    .site-header {
        box-shadow: 0 2px 12px rgba(16, 27, 51, 0.06);
    }

    main:not(.page-home main) {
        min-height: calc(100vh - 58px);
    }
}
