/* ============================================
   MOBILE-SPECIFIC STYLES — Mobile-First
   Design System v2.0 — Outfit + Stone + Teal
   ============================================ */

/* Prevent text selection on interactive elements */
.btn,
.nav-link,
.mobile-menu-toggle,
.mobile-menu-close,
.sidebar-link,
.payment-btn,
.product-row {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Smooth scrolling on mobile */
.content-wrapper,
.product-list,
.cart-items,
.product-list-container,
.cart-items-container,
.dashboard-grid {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* OPEN-014 — .table-responsive is a horizontal-only scroller (overflow-x:auto).
   Applying overscroll-behavior:contain here was swallowing vertical wheel events
   and preventing them from chaining to the page scroll (.content-wrapper). Keep
   iOS momentum scrolling but allow wheel to propagate for vertical page scroll. */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Fix iOS input zoom — base mobile rule */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="tel"],
input[type="password"],
textarea,
select {
    font-size: 16px;
}

@media (min-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        font-size: inherit;
    }
}

/* Better modals — base is full-screen on mobile */
.modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
}

.modal-content {
    height: 100%;
    border-radius: 0;
    border: none;
}

.modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
    .modal-dialog {
        margin: 1.75rem auto;
        max-width: 500px;
        height: auto;
    }

    .modal-content {
        height: auto;
        border-radius: var(--radius-lg, 16px);
        border: 1px solid var(--border-default, #e7e5e4);
    }
}

/* Form layouts — base mobile */
.form-row,
.row {
    margin-left: 0;
    margin-right: 0;
}

.form-row > [class*="col-"],
.row > [class*="col-"] {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-bottom: 0.75rem;
}

.input-group {
    flex-wrap: wrap;
}

.input-group .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

@media (min-width: 768px) {
    .input-group {
        flex-wrap: nowrap;
    }

    .form-row > [class*="col-"],
    .row > [class*="col-"] {
        margin-bottom: 0;
    }
}

/* Cards — base mobile */
.card {
    margin-bottom: 0.75rem;
    border-radius: var(--radius-md, 12px);
}

.card-header {
    padding: 0.75rem;
    font-size: 0.875rem;
}

.card-body {
    padding: 0.75rem;
}

.card-footer {
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .card-footer {
        padding: 1rem 1.25rem;
    }
}

/* Button groups — base mobile */
.btn-group-vertical {
    width: 100%;
}

.btn-group-vertical .btn {
    width: 100%;
    margin-bottom: 0.5rem;
}

.btn-toolbar {
    flex-direction: column;
}

.btn-toolbar .btn-group {
    width: 100%;
    margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
    .btn-group-vertical {
        width: auto;
    }

    .btn-group-vertical .btn {
        width: auto;
        margin-bottom: 0;
    }

    .btn-toolbar {
        flex-direction: row;
    }

    .btn-toolbar .btn-group {
        width: auto;
        margin-bottom: 0;
    }
}

/* Alerts — base mobile */
.alert {
    padding: 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm, 8px);
}

.alert-dismissible .btn-close {
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .alert {
        padding: 1rem 1.25rem;
        font-size: 0.875rem;
        border-radius: var(--radius-md, 12px);
    }
}

/* Loading bar */
.mobile-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--brand, #1e40af);
    z-index: 9999;
    animation: loading 1.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--stone-950, #0c0a09);
    color: white;
    padding: 1rem;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.pwa-install-banner.show { display: flex; }

.pwa-install-banner .banner-content { flex: 1; }

.pwa-install-banner .banner-content h6 {
    margin: 0 0 0.25rem;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.pwa-install-banner .banner-content p {
    margin: 0;
    font-size: 0.8125rem;
    opacity: 0.7;
}

.pwa-install-banner .banner-actions {
    display: flex;
    gap: 0.5rem;
}

.pwa-install-banner .btn {
    white-space: nowrap;
    min-width: 80px;
}

/* Landscape orientation */
@media (orientation: landscape) and (max-height: 500px) {
    .navbar-container { padding: 0.4rem 1rem; }
    .content-wrapper { padding: 0.75rem; }
    .mobile-menu-sidebar { width: 260px; }
}

/* Dashboard mobile base */
.row .col-md-3 { margin-bottom: 0.75rem; }

.card .card-body h3 { font-size: 1.375rem; }
.card .card-body h5 { font-size: 0.875rem; margin-bottom: 0.5rem; }

.chart-container {
    margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
    .row .col-md-3 { margin-bottom: 0; }
}

/* Print */
@media print {
    .top-navbar,
    .sidebar-nav,
    .mobile-menu-toggle,
    .mobile-menu-overlay,
    .mobile-menu-sidebar {
        display: none !important;
    }

    .content-wrapper { padding: 0; }
}

/* ============================================
   REPORTS PAGE
   S24-3 (01.12.2026) — eski rapor sayfası kuralları (reports-page-container, reports-card*, reports-btn, reports-button-row, reports-date-row,
   reports-summary, reports-charts-row, reports-chart-*, reports-table-responsive, reports-tabs) emekli edildi: bütün rapor sayfaları rapor
   iskeletinde (hs.css hs-report-*). DZ-S24-C (C5): son kural "body.reports-page .content-wrapper" (overflow-y auto, overflow-x hidden,
   dokunmatik kaydırma) da silindi: aynı üç değeri site.css ".content-wrapper" her sayfada veriyor ve hiçbir kural bunları ezmiyor (etkisizdi).
   Okuyanı kalmayan "reports-page" gövde sınıfını MainLayout tur sonunda (TS-5, 02.12.2026) vermeyi bıraktı.
   ============================================ */

/* ============================================
   LIST PAGE — Mobile-First
   ============================================ */
.list-page-container {
    padding: 0.25rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-page-container h3 {
    flex: 0 0 auto;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.list-page-actions { flex: 0 0 auto; margin-bottom: 0.5rem; }
.list-page-actions .btn { min-height: 44px; }

.list-page-filters { flex: 0 0 auto; margin-bottom: 0.5rem; }
.list-page-filters .form-select { min-height: 44px; font-size: 16px; }

.list-page-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.list-page-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0.5rem;
}

.list-page-table-responsive {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    font-size: 0.8125rem;
}

.list-page-table-responsive table { font-size: 0.75rem; }
.list-page-table-responsive th, .list-page-table-responsive td { padding: 0.4rem 0.3rem; font-size: 0.75rem; }

@media (min-width: 768px) {
    .list-page-container { padding: 0.5rem; }
    .list-page-container h3 { font-size: 1.25rem; }
    .list-page-card-body { padding: 1rem; }
    .list-page-table-responsive { font-size: 0.875rem; }
    .list-page-table-responsive table { font-size: 0.8125rem; }
    .list-page-table-responsive th, .list-page-table-responsive td { padding: 0.5rem 0.75rem; font-size: 0.8125rem; }
}

/* ============================================
   ADMIN PAGES — Mobile-First
   ============================================ */
.admin-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table-responsive table {
    font-size: 0.75rem;
    min-width: 600px;
}

@media (min-width: 768px) {
    .admin-table-responsive table {
        font-size: 0.8125rem;
        min-width: auto;
    }
}

/* ============================================
   ORDERS CREATE — Mobile-First
   ============================================ */
.order-create-layout {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 992px) {
    .order-create-layout {
        flex-direction: row;
        gap: 1rem;
    }
}

/* ============================================
   TRANSACTIONS — Mobile-First
   ============================================ */
.transaction-filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .transaction-filters {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* ============================================
   SAFE AREA INSETS (notch devices)
   ============================================ */
@supports (padding: max(0px)) {
    .pwa-install-banner {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .content-wrapper {
        padding-left: max(0.5rem, env(safe-area-inset-left));
        padding-right: max(0.5rem, env(safe-area-inset-right));
    }

    @media (min-width: 768px) {
        .content-wrapper {
            padding-left: max(0.75rem, env(safe-area-inset-left));
            padding-right: max(0.75rem, env(safe-area-inset-right));
        }
    }
}

/* ============================================
   375px KÜCÜK TELEFON DESTEĞİ (iPhone SE/8)
   ============================================ */
@media (max-width: 480px) {
    /* Ana içerik padding'i minimize et — safe area korumalı */
    .content-wrapper {
        padding: 0.25rem;
        padding-left: max(0.25rem, env(safe-area-inset-left));
        padding-right: max(0.25rem, env(safe-area-inset-right));
    }

    /* Sayfa toolbar sıkışıklığı gider */
    .page-toolbar {
        gap: 0.5rem;
        margin-bottom: 0.75rem;
    }

    .page-toolbar h3 {
        font-size: 1rem;
    }

    /* Toolbar butonları tam genişlik */
    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.5rem 0.625rem;
        min-height: 44px;
    }

    /* Kartlar daha kompakt */
    .card-body {
        padding: 0.5rem;
    }

    .card-header {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }

    .card-footer {
        padding: 0.5rem 0.625rem;
    }

    /* Tablo responsive — yatay scroll garanti */
    .table-card .card-body,
    .list-page-table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .list-page-table-responsive table,
    .table-card table {
        font-size: 0.6875rem;
        min-width: 500px;
    }

    .list-page-table-responsive th,
    .list-page-table-responsive td,
    .table-card th,
    .table-card td {
        padding: 0.3rem 0.25rem;
        font-size: 0.6875rem;
        white-space: nowrap;
    }

    /* Liste sayfası başlık */
    .list-page-container h3 {
        font-size: 1rem;
    }

    /* Form düzenleri */
    .form-control,
    .form-select {
        font-size: 14px;
        padding: 0.375rem 0.5rem;
    }

    .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.25rem;
    }

    /* Buton minimum touch target */
    .btn {
        min-height: 44px;
    }

    /* Modal kompakt */
    .modal-body {
        padding: 0.75rem;
    }

    .modal-header {
        padding: 0.625rem 0.75rem;
    }

    .modal-footer {
        padding: 0.5rem 0.75rem;
    }

    /* Alert kompakt */
    .alert {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    /* Sayfa tab'ları */
    .nav-tabs .nav-link {
        font-size: 0.75rem;
        padding: 0.5rem 0.625rem;
        min-height: 44px;
    }

    /* Admin tabloları */
    .admin-table-responsive table {
        font-size: 0.6875rem;
        min-width: 500px;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
