/* Mobile Responsive Enhancements for Pension Portal */

/* ============================================
   MOBILE SIDEBAR IMPROVEMENTS
   ============================================ */
@media only screen and (max-width: 1024px) {
    /* Sidebar animations and mobile behavior */
    .sidebar {
        width: 280px !important;
        max-width: 85vw;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    .sidebar.open {
        transform: translateX(0);
        z-index: 2300;
    }

    .sidebar .inner_sidebar .main_section .single_main .title {
        font-size: 13px;
        height: auto;
        min-height: 48px;
        padding: 12px 15px;
    }

    .sidebar .inner_sidebar .main_section .single_main .sub_menus {
        padding-left: 20px;
    }

    .sidebar .inner_sidebar .main_section .single_main .sub_menus .single_menu {
        height: auto;
        min-height: 44px;
        padding: 10px;
    }

    /* Mobile menu toggle button */
    .header_area .inner_header .top_email .small_screen_menu_open {
        display: flex !important;
        width: 60px;
        font-size: 1.5rem;
    }

    .sidebar .small_screen_menu_close {
        display: flex !important;
        position: absolute;
        top: 10px;
        right: 10px;
        z-index: 200;
        cursor: pointer;
        padding: 10px;
        background: var(--background-color-1);
        border-radius: 50%;
    }

    /* Touch-friendly tap targets */
    .sidebar .inner_sidebar .main_section .single_main .menu_link,
    .sidebar .inner_sidebar .main_section .single_main .sub_menus .single_menu a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
}

@media only screen and (max-width: 768px) {
    .sidebar {
        width: 280px !important;
        max-width: 75vw;
    }
}

@media only screen and (max-width: 520px) {
    .sidebar {
        width: 100vw !important;
        max-width: 100vw;
    }
}

/* ============================================
   MOBILE TABLE IMPROVEMENTS
   ============================================ */
@media only screen and (max-width: 768px) {
    /* Make tables responsive with horizontal scroll */
    .card_body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.table,
    table.dataTable {
        font-size: 12px;
        min-width: 600px; /* Allows horizontal scrolling */
    }

    table.table th,
    table.table td,
    table.dataTable th,
    table.dataTable td {
        padding: 8px 6px !important;
        white-space: nowrap;
    }

    /* DataTables mobile controls */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: center;
        margin-bottom: 10px;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: 250px;
    }

    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
        margin-top: 10px;
    }

    /* Button controls */
    .dt-buttons {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
        margin-bottom: 10px;
    }

    .dt-button {
        font-size: 11px !important;
        padding: 6px 10px !important;
    }

    /* Card header action buttons */
    .card_header .action_buttons {
        position: relative;
        right: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-left: auto;
    }

    .card_header .action_buttons a,
    .card_header .action_buttons .btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

@media only screen and (max-width: 520px) {
    table.table,
    table.dataTable {
        font-size: 11px;
        min-width: 500px;
    }

    table.table th,
    table.table td {
        padding: 6px 4px !important;
    }

    /* Stack DataTable controls vertically */
    .dataTables_wrapper > div {
        width: 100%;
    }
}

/* ============================================
   BENEFICIARIES LIST MOBILE STYLES
   ============================================ */
@media only screen and (max-width: 768px) {
    /* Beneficiaries table specific improvements */
    #example-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    #example-table thead tr th {
        font-size: 12px;
        padding: 10px 8px !important;
    }

    #example-table tbody tr td {
        font-size: 12px;
        padding: 10px 8px !important;
    }

    /* Action buttons in tables */
    .d-flex {
        flex-wrap: wrap;
        gap: 5px;
    }

    .badge {
        font-size: 10px;
        padding: 4px 6px;
    }

    .la, .font-large-1 {
        font-size: 18px !important;
    }
}

/* ============================================
   CLAIMS LIST MOBILE STYLES
   ============================================ */
@media only screen and (max-width: 768px) {
    /* Claims table */
    .main_content .inner_main .content .inner_content .card_body table {
        min-width: 700px;
    }

    /* Status badges */
    .main_content .inner_main .content .inner_content .card_body table tbody tr td span {
        font-size: 11px;
        padding: 3px 10px;
        display: inline-block;
    }

    /* Card header responsiveness */
    .card_header {
        flex-wrap: wrap;
        height: auto !important;
        min-height: 3.5rem;
        padding: 0.75rem !important;
    }

    .card_header .card-header-title {
        font-size: 16px;
        flex: 1 1 100%;
        margin-bottom: 8px;
    }

    .card_header .action_buttons {
        flex: 1 1 100%;
        justify-content: flex-start;
    }
}

@media only screen and (max-width: 520px) {
    .card_header .card-header-title {
        font-size: 14px;
    }

    .card_header .action_buttons a {
        font-size: 0.7rem;
        padding: 5px 8px;
    }
}

/* ============================================
   MOBILE CONTENT AREA IMPROVEMENTS
   ============================================ */
@media only screen and (max-width: 1024px) {
    .main_content {
        left: 0;
        width: 100%;
    }

    .main_content .inner_main {
        padding: 1rem 0.75rem;
    }

    /* Breadcrumb improvements */
    .main_content ul.breadcrumb {
        font-size: 12px;
        padding: 8px;
        margin: 0 0 10px 0;
    }

    .main_content ul.breadcrumb li {
        display: inline;
        word-break: break-word;
    }
}

/* ============================================
   FORMS MOBILE OPTIMIZATION
   ============================================ */
@media only screen and (max-width: 768px) {
    form .form_group.col {
        flex: 100%;
        padding: 0;
        margin-top: 10px;
    }

    form .form_group label {
        font-size: 13px;
    }

    form .form_group input.form_control,
    form .form_group select.form_control,
    form .form_group textarea.form_control {
        font-size: 14px;
        padding: 10px;
    }

    form .form_group input[type=submit],
    form .form_control button {
        padding: 12px;
        font-size: 14px;
    }
}

/* ============================================
   TOUCH-FRIENDLY INTERACTIONS
   ============================================ */
@media only screen and (max-width: 1024px) {
    /* Increase tap target sizes */
    button,
    .btn,
    a[role="button"],
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 15px;
    }

    /* Touch-friendly checkboxes and radios */
    .radio_container,
    .checkbox_container {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Icon buttons */
    .la, .icon {
        padding: 8px;
        cursor: pointer;
    }
}

/* ============================================
   MODAL IMPROVEMENTS
   ============================================ */
@media only screen and (max-width: 768px) {
    .my_modal-content {
        width: 95% !important;
        margin: 5% auto;
    }

    .my_modal {
        padding-top: 50px;
    }

    .swal2-popup {
        width: 90% !important;
        padding: 20px !important;
    }
}

/* ============================================
   PILLS AND DASHBOARD CARDS
   ============================================ */
@media only screen and (max-width: 1024px) {
    .main_content .inner_main .pills_area {
        flex-direction: column;
    }

    .main_content .inner_main .pills_area .pill {
        width: 100%;
        margin: 0 0 10px 0;
        padding: 15px 20px;
    }

    .main_content .inner_main .chart_area,
    .main_content .inner_main .summary_history_area {
        width: 100%;
        padding: 0 5px;
        float: none;
    }

    .main_content .inner_main .content.charts {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   SCROLLBAR IMPROVEMENTS FOR MOBILE
   ============================================ */
@media only screen and (max-width: 768px) {
    /* Better scrollbars for touch devices */
    .card_body::-webkit-scrollbar {
        height: 8px;
    }

    .card_body::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }

    .card_body::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 10px;
    }

    .card_body::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
@media only screen and (max-width: 1024px) {
    /* Focus states for keyboard navigation */
    button:focus,
    a:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline: 2px solid var(--theme-green);
        outline-offset: 2px;
    }

    /* Skip to main content link */
    .skip-to-main {
        position: absolute;
        top: -100px;
        left: 0;
        background: var(--theme-green);
        color: white;
        padding: 10px;
        z-index: 10000;
    }

    .skip-to-main:focus {
        top: 0;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */
@media only screen and (max-width: 768px) {
    .loading_content .loader {
        width: 180px;
        padding: 15px;
    }

    .loading_content .loader img {
        height: 40px;
    }

    .loading_content .loader p {
        font-size: 12px;
    }
}

/* ============================================
   NOTIFICATION IMPROVEMENTS
   ============================================ */
@media only screen and (max-width: 768px) {
    .notifications_container {
        width: 90vw;
        max-width: 90vw;
        right: 5vw;
    }
}

/* ============================================
   TABLE RESPONSIVE HELPER CLASSES
   ============================================ */
@media only screen and (max-width: 768px) {
    .table-responsive-scroll {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide non-essential columns on mobile */
    .table-hide-mobile {
        display: none !important;
    }

    /* Show scroll hint */
    .card_body table::after {
        content: "Swipe to see more →";
        display: block;
        text-align: right;
        font-size: 11px;
        color: #999;
        padding: 5px;
        font-style: italic;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
@media only screen and (max-width: 768px) {
    .mobile-hidden {
        display: none !important;
    }

    .mobile-visible {
        display: block !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

    .mobile-full-width {
        width: 100% !important;
    }
}
