/* ========================================
   ARC Backend - Custom Responsive Styles
   Mobile-First Responsive Design
   ======================================== */

/* ========================================
   General Mobile Optimizations
   ======================================== */

/* Ensure all containers are responsive */
@media (max-width: 991px) {
    .app-container {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    /* Improve content spacing on mobile */
    #kt_app_content_container {
        padding: 15px !important;
    }

    /* Make page title more compact on mobile */
    .page-heading {
        font-size: 1.5rem !important;
    }
}

/* ========================================
   Sidebar Mobile Enhancements
   ======================================== */

@media (max-width: 991px) {
    /* Ensure sidebar is full height on mobile */
    #kt_app_sidebar {
        height: 100vh;
    }

    /* Improve sidebar menu spacing */
    .app-sidebar-menu {
        padding: 10px 0;
    }

    /* Better touch targets for mobile */
    .menu-link {
        min-height: 44px;
        padding: 10px 15px !important;
    }

    /* Nested menu items */
    .menu-sub .menu-link {
        min-height: 40px;
        padding: 8px 15px 8px 35px !important;
    }

    /* Nested nested menu items (Location Settings) */
    .menu-sub .menu-sub .menu-link {
        padding: 8px 15px 8px 50px !important;
    }

    /* Icon sizing for mobile */
    .menu-icon {
        margin-right: 10px;
        min-width: 30px;
    }

    .menu-icon i {
        font-size: 1.25rem !important;
    }

    /* Menu title text */
    .menu-title {
        font-size: 0.95rem;
    }

    /* Sidebar logo adjustments */
    .app-sidebar-logo {
        padding: 15px !important;
    }

    .app-sidebar-logo img {
        max-height: 40px !important;
    }
}

/* ========================================
   Header Mobile Enhancements
   ======================================== */

@media (max-width: 991px) {
    #kt_app_header {
        padding: 10px 0;
    }

    #kt_app_header_container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Mobile toggle button */
    #kt_app_sidebar_mobile_toggle {
        width: 40px !important;
        height: 40px !important;
    }
}

/* ========================================
   Tables and Data Grids Mobile
   ======================================== */

@media (max-width: 991px) {
    /* Make tables horizontally scrollable */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust table font size */
    .table {
        font-size: 0.875rem;
    }

    /* Table cell padding */
    .table td,
    .table th {
        padding: 8px 10px !important;
    }

    /* DataTables wrapper */
    .dataTables_wrapper {
        overflow-x: auto;
    }

    /* DataTables controls */
    .dataTables_length,
    .dataTables_filter {
        margin-bottom: 15px;
    }

    .dataTables_filter input {
        width: 100% !important;
        max-width: 300px;
    }
}

/* ========================================
   Forms Mobile Optimization
   ======================================== */

@media (max-width: 991px) {
    /* Form inputs full width on mobile */
    .form-control,
    .form-select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }

    /* Form groups spacing */
    .mb-10 {
        margin-bottom: 1.5rem !important;
    }

    /* Button groups stack on mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Action buttons */
    .card-toolbar {
        flex-wrap: wrap;
    }

    .card-toolbar .btn {
        margin-bottom: 10px;
    }
}

/* ========================================
   Cards and Modals Mobile
   ======================================== */

@media (max-width: 991px) {
    /* Card spacing */
    .card {
        margin-bottom: 20px;
    }

    .card-body {
        padding: 15px !important;
    }

    .card-header {
        padding: 15px !important;
        flex-wrap: wrap;
    }

    .card-title {
        font-size: 1.25rem !important;
        margin-bottom: 10px;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 10px;
    }

    .modal-body {
        padding: 20px 15px;
    }

    .modal-footer {
        flex-wrap: wrap;
        padding: 15px;
    }

    .modal-footer .btn {
        margin: 5px;
    }
}

/* ========================================
   Statistics and Dashboard Widgets
   ======================================== */

@media (max-width: 991px) {
    /* Stats cards */
    .card-xl-stretch {
        margin-bottom: 20px;
    }

    /* Chart containers */
    .chart-container {
        height: 250px !important;
    }

    /* Widget spacing */
    [class*="col-"] {
        margin-bottom: 20px;
    }
}

/* ========================================
   Toolbar and Action Bars
   ======================================== */

@media (max-width: 991px) {
    /* Toolbar responsive */
    #kt_app_toolbar {
        padding: 15px 0;
    }

    .toolbar-container {
        flex-wrap: wrap;
    }

    /* Search bars */
    .search-input {
        width: 100% !important;
        margin-bottom: 10px;
    }

    /* Filter dropdowns */
    .filter-dropdown {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* ========================================
   Footer Mobile
   ======================================== */

@media (max-width: 991px) {
    #kt_app_footer {
        padding: 15px;
    }

    .app-sidebar-footer {
        padding: 15px !important;
    }

    .app-sidebar-footer .btn {
        height: 35px !important;
        font-size: 0.875rem;
    }
}

/* ========================================
   Utility Classes for Mobile
   ======================================== */

@media (max-width: 991px) {
    /* Hide on mobile */
    .d-mobile-none {
        display: none !important;
    }

    /* Show only on mobile */
    .d-mobile-block {
        display: block !important;
    }

    /* Text alignment */
    .text-mobile-center {
        text-align: center !important;
    }

    /* Spacing utilities */
    .px-mobile-0 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .py-mobile-3 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* ========================================
   Small Mobile Devices (< 576px)
   ======================================== */

@media (max-width: 575px) {
    /* Further reduce spacing */
    .app-container {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    #kt_app_content_container {
        padding: 10px !important;
    }

    /* Smaller buttons on very small screens */
    .btn {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .btn-lg {
        padding: 10px 16px;
        font-size: 1rem;
    }

    /* Compact cards */
    .card-body {
        padding: 10px !important;
    }

    /* Smaller headings */
    h1, .h1 {
        font-size: 1.75rem !important;
    }

    h2, .h2 {
        font-size: 1.5rem !important;
    }

    h3, .h3 {
        font-size: 1.25rem !important;
    }

    /* Table adjustments */
    .table {
        font-size: 0.8125rem;
    }

    .table td,
    .table th {
        padding: 6px 8px !important;
    }
}

/* ========================================
   Landscape Orientation Optimizations
   ======================================== */

@media (max-width: 991px) and (orientation: landscape) {
    /* Reduce vertical spacing in landscape */
    .card {
        margin-bottom: 15px;
    }

    .mb-10 {
        margin-bottom: 1rem !important;
    }

    /* Compact header in landscape */
    #kt_app_header {
        padding: 5px 0;
    }
}

/* ========================================
   Touch Device Optimizations
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .menu-link,
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Remove hover effects on touch devices */
    .menu-link:hover {
        background-color: transparent;
    }

    /* Active state instead of hover */
    .menu-link:active {
        background-color: rgba(0, 0, 0, 0.05);
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    /* Hide navigation elements */
    #kt_app_sidebar,
    #kt_app_header,
    #kt_app_footer,
    .app-sidebar-footer,
    .btn,
    .card-toolbar {
        display: none !important;
    }

    /* Full width content */
    #kt_app_main {
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-container {
        max-width: 100% !important;
    }

    /* Optimize for print */
    body {
        background: white !important;
    }

    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
}

/* ========================================
   Accessibility Enhancements
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
