/* Filhex — mobile & tablet responsive layer
   Breakpoints: 768px (tablet/mobile), 480px (small phone) */

:root {
    --fx-bp-mobile: 768px;
    --fx-bp-sm: 480px;
    --fx-bottom-nav-height: 64px;
}

/* ── Marketing mobile menu ── */
.fx-mobile-nav-check {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fx-mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: 0;
    padding: 0;
    border: 1px solid var(--fx-m-border, rgba(148, 163, 184, 0.12));
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--fx-m-text, #f1f5f9);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.fx-mobile-menu-btn:hover {
    background: rgba(232, 163, 23, 0.12);
    border-color: rgba(232, 163, 23, 0.3);
}

.fx-marketing-mobile-panel {
    display: none;
}

.fx-marketing-mobile-backdrop {
    display: none;
}

.fx-marketing-mobile-root {
    position: relative;
    z-index: 10000;
    height: 0;
    overflow: visible;
    pointer-events: none;
}

.fx-marketing-mobile-root .fx-marketing-mobile-backdrop,
.fx-marketing-mobile-root .fx-marketing-mobile-panel {
    pointer-events: none;
}

.fx-marketing-mobile-root .fx-mobile-nav-check:checked ~ .fx-marketing-mobile-backdrop,
.fx-marketing-mobile-root .fx-mobile-nav-check:checked ~ .fx-marketing-mobile-panel {
    pointer-events: auto;
}

.fx-marketing:has(.fx-mobile-nav-check:checked) .fx-marketing-main,
.fx-marketing:has(.fx-mobile-nav-check:checked) .fx-marketing-footer {
    visibility: hidden;
}

/* ── App bottom navigation (admin + garage) ── */
.fx-bottom-nav {
    display: none;
}

/* ── Tablet / mobile ── */
@media (max-width: 768px) {
    .fx-marketing:has(.fx-mobile-nav-check:checked) {
        overflow: hidden;
    }

    /* Marketing header */
    .fx-marketing-header-wrap {
        padding: 12px 12px 0;
    }

    .fx-marketing-header {
        height: auto;
        min-height: 52px;
        padding: 8px 12px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .fx-marketing-nav--desktop,
    .fx-marketing-header-actions--desktop {
        display: none !important;
    }

    .fx-marketing-header-actions--mobile {
        display: flex !important;
    }

    .fx-marketing-header-start,
    .fx-marketing-header-end {
        flex: 0 0 auto;
    }

    .fx-marketing-header-start {
        flex: 1 1 auto;
        min-width: 0;
    }

    .fx-marketing-header-end {
        flex: 0 0 auto;
    }

    .fx-mobile-menu-btn {
        display: flex;
        min-width: 40px;
        min-height: 40px;
        align-items: center;
        justify-content: center;
    }

    .fx-marketing-header-actions--mobile .fx-lang-menu-trigger {
        min-width: 40px;
        height: 40px;
        padding: 0 8px;
    }

    .fx-marketing-header-actions--mobile .fx-lang-menu-caret {
        display: none;
    }

    .fx-marketing-header-actions--mobile .fx-lang-menu-panel {
        right: 0;
        left: auto;
    }

    .fx-marketing-header-actions--mobile {
        gap: 8px;
        align-items: center;
    }

    .fx-marketing-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .fx-marketing-footer-grid {
        gap: 32px;
        padding-bottom: 8px;
    }

    .fx-marketing-footer-bottom {
        padding-left: 0;
        padding-right: 0;
        text-align: center;
    }

    .fx-m-pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .fx-m-pricing-card {
        max-width: 420px;
        margin-left: auto;
        margin-right: auto;
    }

    .fx-marketing-mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1;
        background: #07080c;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    .fx-mobile-nav-check:checked ~ .fx-marketing-mobile-backdrop {
        opacity: 0.92;
        pointer-events: auto;
    }

    .fx-marketing-mobile-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100vw;
        z-index: 2;
        padding: max(16px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
        background-color: #07080c;
        background-image: linear-gradient(180deg, #0c0f16 0%, #07080c 100%);
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .fx-mobile-nav-check:checked ~ .fx-marketing-mobile-panel {
        transform: translateX(0);
    }

    .fx-marketing-mobile-panel-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 28px;
        padding-bottom: 20px;
        border-bottom: 1px solid var(--fx-m-border, rgba(148, 163, 184, 0.12));
    }

    .fx-marketing-mobile-panel-head .fx-marketing-logo,
    .fx-marketing-mobile-panel-head .fx-brand-word {
        font-size: 18px;
    }

    .fx-mobile-menu-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: 1px solid var(--fx-m-border, rgba(148, 163, 184, 0.12));
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.04);
        color: var(--fx-m-text, #f1f5f9);
        font-size: 20px;
        cursor: pointer;
    }

    .fx-marketing-mobile-nav {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 32px;
        flex: 1;
    }

    .fx-marketing-mobile-nav a {
        display: block;
        padding: 18px 20px;
        color: #f1f5f9;
        text-decoration: none;
        font-size: 18px;
        font-weight: 600;
        border-radius: 14px;
        background: #121820;
        border: 1px solid rgba(148, 163, 184, 0.18);
        transition: background 0.15s, color 0.15s, border-color 0.15s;
    }

    .fx-marketing-mobile-nav a:hover,
    .fx-marketing-mobile-nav a:active {
        background: rgba(232, 163, 23, 0.14);
        border-color: rgba(232, 163, 23, 0.3);
        color: var(--fx-m-accent, #e8a317);
    }

    .fx-marketing-mobile-actions {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: auto;
        padding-top: 16px;
    }

    .fx-marketing-mobile-actions .fx-lang-switch--inline {
        align-self: stretch;
        margin-bottom: 4px;
    }

    .fx-marketing-mobile-actions .fx-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
        min-height: 52px;
        font-size: 16px;
    }

    .fx-m-hero h1 {
        font-size: clamp(28px, 8vw, 40px);
    }

    /* App shell — mobile header + bottom nav */
    .fx-desktop-only {
        display: none !important;
    }

    .fx-app-header-inner {
        padding: 0 12px;
        min-height: 52px;
        gap: 10px;
    }

    .fx-app-header-start,
    .fx-app-header-end {
        flex: 0 0 auto;
    }

    .fx-app-header-start {
        flex: 1 1 auto;
        min-width: 0;
    }

    .fx-app-brand {
        font-size: 13px;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fx-app-header-end {
        gap: 6px;
        flex-shrink: 0;
    }

    .fx-header-search.is-expanded {
        position: static;
    }

    .fx-header-search-field {
        width: min(200px, 52vw);
    }

    .fx-header-search-panel {
        position: fixed;
        top: 56px;
        left: 12px;
        right: 12px;
        width: auto;
        max-height: min(60vh, 420px);
    }

    .fx-user-menu-trigger {
        padding: 2px;
        border-color: rgba(232, 163, 23, 0.35);
        background: rgba(232, 163, 23, 0.12);
    }

    .fx-user-menu-trigger .fx-user-pill-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }

    .fx-header-search-toggle {
        width: 34px;
        height: 34px;
        border-color: rgba(232, 163, 23, 0.35);
        background: rgba(232, 163, 23, 0.12);
        color: var(--fx-accent, #e8a317);
    }

    .fx-user-menu-dropdown {
        right: 0;
        left: auto;
        min-width: min(240px, calc(100vw - 24px));
        z-index: 220;
    }

    /* Must beat filhex-app.css .fx-app-main (loaded later via layout HeadContent). */
    .fx-admin-shell .fx-app-main,
    .fx-garage-shell .fx-app-main,
    .fx-app-main {
        padding: 16px 12px calc(var(--fx-bottom-nav-height) + 28px + env(safe-area-inset-bottom, 0px));
        text-align: left;
    }

    .fx-app-container {
        max-width: 100%;
        text-align: left;
    }

    .fx-admin-badge {
        display: none;
    }

    .fx-garage-forge .fx-garage-brand .fx-admin-badge,
    .fx-garage-brand span {
        display: none;
    }

    /* bottom nav — viewport’a sabit; shell’deki relative override kaldırıldı */
    .fx-admin-shell > .fx-bottom-nav.fx-mobile-only,
    .fx-garage-shell > .fx-bottom-nav.fx-mobile-only,
    .fx-mobile-only.fx-bottom-nav {
        display: flex !important;
        position: fixed !important;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        height: calc(var(--fx-bottom-nav-height) + env(safe-area-inset-bottom));
        padding: 0 4px env(safe-area-inset-bottom);
        align-items: center;
        justify-content: space-around;
        gap: 0;
        flex-wrap: nowrap;
        background: rgba(12, 15, 22, 0.96);
        backdrop-filter: blur(16px);
        border-top: 1px solid rgba(148, 163, 184, 0.14);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    }

    .fx-bottom-nav a,
    .fx-bottom-nav button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        height: 52px;
        padding: 4px 1px;
        border: none;
        border-radius: 12px;
        background: transparent;
        color: var(--fx-text-dim, #94a3b8);
        text-decoration: none;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
    }

    .fx-bottom-nav .fx-tab-icon {
        font-size: 20px;
        line-height: 1;
    }

    .fx-bottom-nav .fx-tab-label,
    .fx-bottom-nav .fx-bottom-nav-label {
        font-size: 9px;
        font-weight: 600;
        margin-top: 2px;
        letter-spacing: 0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .fx-bottom-nav a:hover,
    .fx-bottom-nav button:hover {
        color: var(--fx-text, #f1f5f9);
        background: rgba(255, 255, 255, 0.04);
    }

    .fx-bottom-nav a.active {
        color: var(--fx-accent, #e8a317);
        background: var(--fx-accent-muted, rgba(232, 163, 23, 0.14));
    }

    .fx-bottom-nav .fx-bottom-nav-signout {
        color: var(--fx-text-dim, #94a3b8);
    }

    .fx-bottom-nav .fx-bottom-nav-signout:hover {
        color: #fca5a5;
        background: rgba(248, 113, 113, 0.12);
    }

    @media (max-width: 380px) {
        .fx-bottom-nav .fx-tab-label,
        .fx-bottom-nav .fx-bottom-nav-label {
            display: none;
        }

        .fx-bottom-nav a,
        .fx-bottom-nav button {
            height: 48px;
        }
    }

    /* Legacy sidebar hidden */
    .fx-icon-sidebar {
        display: none !important;
    }

    /* Tables — horizontal scroll */
    .fx-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .fx-table {
        min-width: 520px;
    }

    /* Toolbars & page chrome — sola hizala (yalnızca mobil) */
    .fx-app-page-header,
    .fx-page-header,
    .fx-app-toolbar,
    .fx-toolbar,
    .fx-vehicle-filters {
        flex-direction: column;
        align-items: stretch !important;
        justify-content: flex-start !important;
        text-align: left;
    }

    .fx-app-toolbar-actions,
    .fx-app-page-actions,
    .fx-toolbar > .fx-command-bar-search,
    .fx-toolbar > select,
    .fx-toolbar > .fx-btn,
    .fx-toolbar > a {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .fx-app-toolbar-actions,
    .fx-app-page-actions {
        flex-direction: column;
        align-items: stretch !important;
        justify-content: flex-start !important;
    }

    .fx-app-toolbar-actions .fx-btn,
    .fx-app-page-actions .fx-btn,
    .fx-toolbar .fx-btn {
        width: 100%;
        justify-content: center;
    }

    .fx-app-toolbar-actions .fx-command-bar-search,
    .fx-toolbar .fx-command-bar-search,
    .fx-list-page .fx-command-bar-search,
    .fx-app-toolbar .fx-command-bar-search {
        flex: none !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        align-self: stretch !important;
    }

    .fx-app-toolbar-actions .fx-command-bar-search input,
    .fx-toolbar .fx-command-bar-search input,
    .fx-list-page .fx-command-bar-search input {
        width: 100%;
        text-align: left;
    }

    .fx-select {
        width: 100%;
        text-align: left;
    }

    .fx-field--compact {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .fx-vehicle-filters .fx-field,
    .fx-vehicle-filters .fx-btn {
        width: 100%;
    }

    /* Detail lists: keep side-by-side rows; alignment lives in filhex-app.css
       (app CSS loads after this file via layout HeadContent). */

    /* Page header */
    .fx-app-page-header {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .fx-app-page-header-main,
    .fx-app-page-header h1,
    .fx-app-page-header p {
        text-align: left;
        max-width: none;
    }

    .fx-app-page-actions .fx-btn {
        flex: 1 1 auto;
    }

    .fx-list-page,
    .fx-detail-page,
    .fx-entity-list-item,
    .fx-entity-list-side {
        text-align: left;
        align-items: stretch;
    }

    .fx-entity-list-side {
        align-self: stretch !important;
    }

    .fx-file-list-actions {
        justify-content: flex-start !important;
    }

    .fx-pager {
        margin-top: 12px;
        padding: 8px 12px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }

    .fx-pager-meta {
        font-size: 12px;
    }

    .fx-pager-controls {
        gap: 4px;
    }

    .fx-pager-btn {
        width: 34px;
        height: 34px;
        flex: none;
        font-size: 20px;
    }

    /* Auth */
    .fx-auth-forge {
        padding: 20px 16px;
        align-items: flex-start;
        padding-top: max(20px, env(safe-area-inset-top));
    }

    .fx-auth-forge .fx-auth-card {
        max-width: 100%;
        width: 100%;
        padding: 28px 22px;
        border-radius: 16px;
    }

    /* System pages */
    .fx-system-page {
        padding: 20px 16px;
    }

    .fx-system-card {
        padding: 32px 24px;
        width: 100%;
    }

    /* Legacy MainLayout */
    .fx-shell {
        flex-direction: column;
    }

    .fx-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--fx-border, rgba(148, 163, 184, 0.12));
    }

    .fx-main {
        min-height: 0;
    }
}

@media (max-width: 480px) {
    .fx-marketing-header-actions--desktop .fx-btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }

    .fx-kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .fx-kpi-value {
        font-size: 22px;
    }

    .fx-stat-grid {
        grid-template-columns: 1fr;
    }

    .fx-marketing-topbar-inner span {
        font-size: 11px;
    }

    .fx-lang-switch-mini {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Tablet — keep app header from wrapping/breaking between mobile and desktop */
@media (min-width: 769px) and (max-width: 1099px) {
    .fx-app-header-inner {
        padding: 0 12px;
        gap: 8px;
        min-height: 56px;
    }

    .fx-top-nav.fx-tab-nav {
        gap: 2px;
        flex: 1 1 auto;
        min-width: 0;
        overflow-x: auto;
    }

    .fx-top-nav.fx-tab-nav a {
        min-width: 56px;
        max-width: 72px;
        padding: 6px 6px;
    }

    .fx-top-nav.fx-tab-nav .fx-tab-label {
        font-size: 9px;
    }

    .fx-top-nav.fx-tab-nav .fx-tab-icon {
        font-size: 16px;
    }

    .fx-app-header-end {
        gap: 4px;
        flex: 0 0 auto;
    }

    .fx-app-brand {
        font-size: 13px;
    }
}
