/* Mobil Responsive İyileştirmeleri */

/* Mobil için touch-friendly butonlar */
@media (max-width: 768px) {

    /* Minimum touch target 44x44px */
    .btn,
    button,
    a.btn {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
        /* iOS zoom önleme */
    }

    /* Input'lar touch-friendly */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    textarea,
    select {
        min-height: 44px;
        font-size: 16px !important;
        /* iOS zoom önleme */
        padding: 12px;
    }

    /* Card padding azalt */
    .card-body {
        padding: 1rem !important;
    }

    .card-header {
        padding: 0.75rem 1rem !important;
    }

    /* Modal mobilde tam ekran */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
    }

    /* Tablo responsive */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 14px;
    }

    /* KPI kartları stack */
    .main-stat-number {
        font-size: 2rem !important;
    }

    /* Sidebar tam genişlik ve görünürlük */
    .sidebar {
        width: 85%;
        max-width: 300px;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        background-color: #ffffff !important;
        margin-left: 0 !important;
        /* Reset margin from custom.css */
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 99999;
        overflow-y: auto;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
        display: block !important;
    }

    /* Use 'active' class to match custom.css logic if needed, or just standardize on it */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Add an overlay when sidebar is active */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99998;
    }

    .sidebar.active~.sidebar-overlay {
        display: block;
    }

    /* Sidebar içindeki linkleri görünür yap */
    .sidebar .nav-link {
        display: flex !important;
        color: #333 !important;
        opacity: 1 !important;
    }

    .sidebar .nav-link:hover,
    .sidebar .nav-link.active {
        background-color: #f8f9fa !important;
        color: #0d6efd !important;
    }

    /* Navbar burger menu */
    .navbar-toggler {
        display: block !important;
        border: none;
        background: transparent;
    }

    /* Spacing optimizasyonu */
    .row.g-4 {
        row-gap: 1rem !important;
    }

    /* Font boyutları */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    h4 {
        font-size: 1.1rem;
    }

    h5 {
        font-size: 1rem;
    }

    /* Badge'ler daha okunabilir */
    .badge {
        font-size: 0.85rem;
        padding: 0.5em 0.75em;
    }

    /* Dropdown menüler */
    .dropdown-menu {
        font-size: 16px;
    }

    .dropdown-item {
        padding: 0.75rem 1rem;
    }
}

/* Tablet için optimizasyon */
@media (min-width: 769px) and (max-width: 1024px) {
    .container-fluid {
        padding: 1rem;
    }

    .sidebar {
        width: 200px;
    }

    .card-body {
        padding: 1.25rem;
    }
}

/* Landscape mod (yatay telefon) */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }

    .modal-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Touch optimizasyonu */
@media (hover: none) and (pointer: coarse) {

    /* Touch cihazlar için */
    .btn:hover {
        transform: scale(1.02);
    }

    .list-group-item:active,
    .card:active {
        background-color: rgba(0, 0, 0, 0.02);
    }

    /* Scrollbar gizle (touch cihazlarda) */
    ::-webkit-scrollbar {
        width: 3px;
        height: 3px;
    }
}

/* Dark mode media query desteği */
@media (prefers-color-scheme: dark) {
    /* İleride dark mode eklenirse burası kullanılır */
}

/* Ekran boyutu uyarısı (çok küçük cihazlar) */
@media (max-width: 320px) {
    body {
        font-size: 14px;
    }

    .btn {
        font-size: 14px;
        padding: 10px 16px;
    }
}

/* =========================================
   BOTTOM NAVIGATION BAR (App Experience)
   ========================================= */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 20px 0;
    /* iOS safe area için alttan boşluk */
    z-index: 9999;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

.mobile-bottom-nav .nav-item.active {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.05);
}

/* Nav bar varken içerik altta kalmasın */
@media (max-width: 768px) {
    body {
        padding-bottom: 80px;
    }
}

/* =========================================
   MOBILE CARD TABLES (No More Tables)
   ========================================= */
@media (max-width: 768px) {
    .table-mobile-card {
        background: transparent !important;
        box-shadow: none !important;
    }

    .table-mobile-card thead {
        display: none;
    }

    .table-mobile-card tbody tr {
        display: block;
        background: #ffffff;
        margin-bottom: 1rem;
        border-radius: 12px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        padding: 1rem;
        border: 1px solid #e2e8f0;
    }

    .table-mobile-card td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 0.75rem 0;
        border-bottom: 1px solid #f1f5f9;
        text-align: right;
    }

    .table-mobile-card td:last-child {
        border-bottom: none;
    }

    .table-mobile-card td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        margin-right: 1rem;
        text-align: left;
        font-size: 0.85rem;
        flex: 1;
    }

    /* Tablo içindeki butonları hizala */
    .table-mobile-card td .btn-group {
        display: flex;
        justify-content: flex-end;
    }
}

/* Mobil Iyileştirmeler */
@media (max-width: 768px) {
    .navbar {
        padding: 15px !important;
    }

    .btn-toplu-ekle span {
        display: none;
    }

    .sidebar {
        z-index: 1060;
    }
}