/**
 * 📱 GLOBAL MOBILE RESPONSIVE CSS
 * Tüm admin, POS, public sayfalar için mobil uyumluluk
 * Mobile-first approach
 */

/* ================================
   BASE MOBILE FIXES
   ================================ */

/* Mobile body fixes */
@media (max-width: 768px) {
    body {
        font-size: 14px !important;
        overflow-x: hidden;
    }
    
    html {
        font-size: 85% !important;
    }
}

/* ================================
   CONTAINER & LAYOUT
   ================================ */

@media (max-width: 768px) {
    .container,
    .container-fluid {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    
    .row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }
    
    .row > * {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

/* ================================
   SIDEBAR RESPONSIVE & MOBILE MENU
   ================================ */

@media (max-width: 991px) {
    /* Sidebar default gizli */
    .sidebar-sticky,
    .col-md-2.sidebar-sticky,
    .col-lg-2.sidebar-sticky {
        position: fixed !important;
        top: 0 !important;
        left: -280px !important;
        width: 280px !important;
        height: 100vh !important;
        z-index: 9999 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        background: #ffffff !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
    }
    
    /* Sidebar açıkken */
    .sidebar-sticky.mobile-menu-open {
        left: 0 !important;
    }
    
    /* Main content full width */
    .col-md-9.main-content,
    .col-md-10.main-content,
    .col-lg-9.main-content,
    .col-lg-10.main-content {
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 10px !important;
        padding-top: 60px !important;
    }
    
    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        position: fixed !important;
        top: 10px !important;
        left: 10px !important;
        z-index: 10000 !important;
        background: var(--kk-primary, #db3444) !important;
        color: white !important;
        border: none !important;
        width: 45px !important;
        height: 45px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.3rem !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
        cursor: pointer !important;
    }
    
    /* Mobile overlay */
    .mobile-menu-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.5) !important;
        z-index: 9998 !important;
        display: none !important;
    }
    
    .mobile-menu-overlay.active {
        display: block !important;
    }
    
    /* Sidebar close button */
    .mobile-sidebar-close {
        position: absolute !important;
        top: 10px !important;
        right: 10px !important;
        background: transparent !important;
        border: none !important;
        font-size: 1.5rem !important;
        color: #666 !important;
        cursor: pointer !important;
        z-index: 10001 !important;
    }
}

/* ================================
   TYPOGRAPHY RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    h1, .h1 { font-size: 1.75rem !important; }
    h2, .h2 { font-size: 1.5rem !important; }
    h3, .h3 { font-size: 1.25rem !important; }
    h4, .h4 { font-size: 1.1rem !important; }
    h5, .h5 { font-size: 1rem !important; }
    h6, .h6 { font-size: 0.9rem !important; }
    
    p, .text-muted { font-size: 0.9rem !important; }
    small, .small { font-size: 0.8rem !important; }
}

/* ================================
   BUTTONS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .btn {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .btn-lg {
        font-size: 1rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    .btn-sm {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.6rem !important;
    }
    
    /* Button groups stack */
    .btn-group {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    .btn-group > .btn {
        width: 100% !important;
        border-radius: 0.375rem !important;
        margin-bottom: 0.5rem !important;
    }
}

/* ================================
   CARDS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-header {
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem !important;
    }
    
    .card-footer {
        padding: 0.75rem 1rem !important;
    }
    
    /* Card grid fixes */
    .col-md-6,
    .col-md-4,
    .col-md-3,
    .col-lg-6,
    .col-lg-4,
    .col-lg-3 {
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* ================================
   TABLES RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .table {
        font-size: 0.85rem !important;
    }
    
    .table thead th {
        white-space: nowrap !important;
        font-size: 0.8rem !important;
        padding: 0.5rem !important;
    }
    
    .table tbody td {
        padding: 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Hide some columns on mobile */
    .table .d-none.d-md-table-cell,
    .table .d-none.d-lg-table-cell {
        display: none !important;
    }
}

/* ================================
   FORMS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
        margin-bottom: 0.35rem !important;
    }
    
    .input-group {
        flex-wrap: wrap !important;
    }
    
    .input-group-text {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
}

/* ================================
   MODALS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .modal-dialog {
        max-width: 95% !important;
        margin: 0.5rem auto !important;
    }
    
    .modal-content {
        border-radius: 0.5rem !important;
    }
    
    .modal-header {
        padding: 1rem !important;
    }
    
    .modal-body {
        padding: 1rem !important;
        max-height: calc(100vh - 200px) !important;
        overflow-y: auto !important;
    }
    
    .modal-footer {
        padding: 0.75rem 1rem !important;
        flex-wrap: wrap !important;
    }
    
    .modal-footer .btn {
        width: 100% !important;
        margin-bottom: 0.5rem !important;
    }
}

/* ================================
   NAVIGATION & HEADER
   ================================ */

@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 1rem !important;
    }
    
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.9rem !important;
    }
}

/* ================================
   BREADCRUMBS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .breadcrumb {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .breadcrumb-item + .breadcrumb-item {
        padding-left: 0.35rem !important;
    }
}

/* ================================
   ALERTS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .alert {
        font-size: 0.85rem !important;
        padding: 0.75rem 1rem !important;
    }
}

/* ================================
   BADGES & PILLS
   ================================ */

@media (max-width: 768px) {
    .badge {
        font-size: 0.75rem !important;
        padding: 0.35em 0.6em !important;
    }
}

/* ================================
   PAGINATION RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .pagination {
        font-size: 0.85rem !important;
    }
    
    .page-link {
        padding: 0.4rem 0.7rem !important;
    }
}

/* ================================
   PROGRESS BARS
   ================================ */

@media (max-width: 768px) {
    .progress {
        height: 1.2rem !important;
        font-size: 0.75rem !important;
    }
}

/* ================================
   STATS CARDS / DASHBOARD
   ================================ */

@media (max-width: 768px) {
    .stat-card,
    .btm,
    .kk-card {
        margin-bottom: 1rem !important;
        padding: 1rem !important;
    }
    
    .stat-number,
    .btm-number {
        font-size: 1.5rem !important;
    }
    
    .stat-label,
    .btm-title {
        font-size: 0.85rem !important;
    }
}

/* ================================
   DROPDOWN MENUS
   ================================ */

@media (max-width: 768px) {
    .dropdown-menu {
        font-size: 0.9rem !important;
        max-width: 90vw !important;
    }
    
    .dropdown-item {
        padding: 0.5rem 1rem !important;
    }
}

/* ================================
   TABS RESPONSIVE
   ================================ */

@media (max-width: 768px) {
    .nav-tabs .nav-link {
        font-size: 0.85rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ================================
   ACCORDIONS
   ================================ */

@media (max-width: 768px) {
    .accordion-button {
        font-size: 0.9rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    .accordion-body {
        padding: 1rem !important;
        font-size: 0.85rem !important;
    }
}

/* ================================
   IMAGES & MEDIA
   ================================ */

@media (max-width: 768px) {
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    .img-thumbnail {
        padding: 0.25rem !important;
    }
}

/* ================================
   UTILITY CLASSES MOBILE
   ================================ */

@media (max-width: 768px) {
    /* Spacing adjustments */
    .mb-4 { margin-bottom: 1.5rem !important; }
    .mb-5 { margin-bottom: 2rem !important; }
    .mt-4 { margin-top: 1.5rem !important; }
    .mt-5 { margin-top: 2rem !important; }
    .p-4 { padding: 1.5rem !important; }
    .p-5 { padding: 2rem !important; }
    
    /* Text alignment mobile */
    .text-md-start { text-align: start !important; }
    .text-md-center { text-align: center !important; }
    .text-md-end { text-align: end !important; }
    
    /* Display utilities */
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
}

/* ================================
   POS SPECIFIC MOBILE
   ================================ */

@media (max-width: 768px) {
    /* POS grid items */
    .pos-grid .col-6 {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    /* POS buttons */
    .pos-item-card {
        padding: 0.75rem !important;
        font-size: 0.85rem !important;
    }
    
    /* POS tables */
    .table-card {
        min-height: 80px !important;
        font-size: 0.85rem !important;
    }
}

/* ================================
   PRINT MEDIA
   ================================ */

@media print {
    .sidebar-sticky,
    .btn,
    .modal,
    .navbar,
    .no-print {
        display: none !important;
    }
    
    .col-md-10,
    .col-lg-10 {
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}

/* ================================
   LANDSCAPE MOBILE
   ================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .modal-body {
        max-height: calc(100vh - 150px) !important;
    }
}

/* ================================
   VERY SMALL SCREENS (< 400px)
   ================================ */

@media (max-width: 400px) {
    body {
        font-size: 13px !important;
    }
    
    .btn {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.6rem !important;
    }
    
    .card-body {
        padding: 0.75rem !important;
    }
}
