/* Responsive Design for All Pages */

/* Mobile Only - Force Items to Display */

/* Global Mobile Improvements */
@media (max-width: 991.98px) {
    /* Mobile Filter Improvements - Compact */
    .filter-sidebar .form-check,
    .map-sidebar .form-check {
        padding: 8px 4px; /* เพิ่ม padding สำหรับ touch target */
        margin-bottom: 2px;
        border-bottom: 1px solid #f0f0f0;
        border-radius: 4px;
        transition: background-color 0.2s ease;
        min-height: 44px; /* ขนาดขั้นต่ำสำหรับ touch target */
        display: flex;
        align-items: center;
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.1);
        touch-action: manipulation;
    }

    .filter-sidebar .form-check:last-child,
    .map-sidebar .form-check:last-child {
        border-bottom: none;
    }

    .filter-sidebar .form-check:hover,
    .filter-sidebar .form-check:focus-within,
    .map-sidebar .form-check:hover,
    .map-sidebar .form-check:focus-within {
        background-color: rgba(0, 123, 255, 0.05);
    }

    /* Enhanced scrollable areas for mobile */
    .filter-sidebar .border.rounded,
    .map-sidebar .border.rounded {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .filter-sidebar .form-check-input {
        width: 20px; /* เพิ่มขนาดสำหรับ mobile */
        height: 20px;
        margin-top: 0;
        margin-right: 10px;
        cursor: pointer;
        transform: scale(1);
        flex-shrink: 0;
    }

    .filter-sidebar .form-check-label {
        font-size: 14px;
        line-height: 1.4;
        cursor: pointer;
        padding-left: 0;
        display: block;
        min-height: 20px;
        color: #333;
        font-weight: 400;
        flex: 1;
        padding: 4px 0; /* เพิ่ม padding สำหรับ touch area */
    }

    .filter-sidebar .filter-options {
        max-height: 200px; /* เพิ่มความสูงสำหรับ mobile */
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #e9ecef;
        background: #f8f9fa;
        overflow-y: auto;
        overflow-x: hidden;
        /* ปรับปรุง scrolling สำหรับ mobile */
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        /* เพิ่ม visual indicators */
        position: relative;
        /* ป้องกัน touch events จากการรบกวนแผนที่ */
        touch-action: pan-y;
        /* เพิ่ม momentum scrolling สำหรับ iOS */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }

    /* เพิ่ม custom scrollbar สำหรับ mobile */
    .filter-sidebar .filter-options::-webkit-scrollbar {
        width: 6px;
    }

    .filter-sidebar .filter-options::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 3px;
    }

    .filter-sidebar .filter-options::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2);
        border-radius: 3px;
    }

    .filter-sidebar .filter-options::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.3);
    }

    /* เพิ่ม fade effect ที่ด้านล่างเพื่อบอกว่าเลื่อนได้ */
    .filter-sidebar .filter-options::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 20px;
        background: linear-gradient(transparent, rgba(248, 249, 250, 0.8));
        pointer-events: none;
        border-radius: 0 0 6px 6px;
    }

    .filter-sidebar .card-header {
        padding: 10px 15px;
        background: #fff;
        border-bottom: 1px solid #e9ecef;
    }

    .filter-sidebar .card-header h5 {
        font-size: 16px;
        margin-bottom: 0;
    }

    .filter-sidebar .card-body {
        padding: 15px;
    }

    .filter-sidebar .form-label {
        font-size: 14px;
        font-weight: 600;
        color: #495057;
        margin-bottom: 6px;
    }

    .filter-sidebar .mb-3 {
        margin-bottom: 12px !important;
    }

    .filter-sidebar .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* Container adjustments */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Table responsive */
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .table {
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 8px 12px;
        vertical-align: middle;
    }

    /* Pagination mobile */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 3px;
    }

    .pagination .page-item .page-link {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 32px;
        text-align: center;
    }

    /* Filter section mobile */
    .filter-section {
        padding: 15px;
        margin-bottom: 20px;
    }

    .filter-row {
        flex-direction: column;
        gap: 12px;
    }

    .filter-group {
        width: 100%;
    }

    .filter-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .filter-buttons .btn {
        width: 100%;
    }

    /* Mobile Dropdown Improvements */
    .navbar-nav .dropdown-toggle {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        padding: 12px 16px !important;
        border-radius: 8px !important;
        transition: all 0.3s ease !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2) !important;
        text-decoration: none !important;
        position: relative !important;
        z-index: 1000 !important;
    }

    /* Force dropdown to be clickable on mobile */
    .navbar-nav .dropdown-toggle::after {
        pointer-events: none !important;
    }

    .navbar-nav .dropdown-toggle:hover,
    .navbar-nav .dropdown-toggle:focus,
    .navbar-nav .dropdown-toggle:active {
        background-color: rgba(0, 123, 255, 0.1) !important;
        color: inherit !important;
        text-decoration: none !important;
    }

    .navbar-nav .dropdown-menu {
        border: none !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        border-radius: 8px !important;
        margin-top: 8px !important;
        padding: 8px 0 !important;
        min-width: 200px !important;
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        transform: none !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
    }

    /* Alternative: Show dropdown on hover for mobile if click doesn't work */
    .navbar-nav .dropdown:hover .dropdown-menu {
        display: block !important;
    }

    .navbar-nav .dropdown-item {
        padding: 12px 20px !important;
        font-size: 14px !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        transition: all 0.2s ease !important;
        border-radius: 0 !important;
        white-space: nowrap !important;
    }

    .navbar-nav .dropdown-item:hover,
    .navbar-nav .dropdown-item:focus {
        background-color: rgba(0, 123, 255, 0.1) !important;
        color: #333 !important;
    }

    .navbar-nav .dropdown-item i {
        width: 20px !important;
        text-align: center !important;
        margin-right: 8px !important;
    }

    .navbar-nav .dropdown-item button {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        color: inherit !important;
        font-size: inherit !important;
        width: 100% !important;
        text-align: left !important;
        display: flex !important;
        align-items: center !important;
    }

    /* Mobile Navigation - handled by modern-navbar.css */



    /* Admin Search Box Mobile Improvements */
    .admin-search-container {
        width: 100% !important;
        max-width: none !important;
    }

    .admin-search-container .input-group {
        width: 100% !important;
        max-width: none !important;
        flex-wrap: nowrap !important;
    }

    .admin-search-container .form-control {
        font-size: 16px !important;
        min-height: 50px !important;
        padding: 14px 18px !important;
        border-radius: 10px 0 0 10px !important;
        border: 2px solid #e9ecef !important;
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .admin-search-container .input-group-text {
        min-height: 50px !important;
        padding: 12px 16px !important;
        border-radius: 0 10px 10px 0 !important;
        border: 2px solid #e9ecef !important;
        background-color: #f8f9fa !important;
        flex: 0 0 auto !important;
        border-left: none !important;
    }

    .admin-search-container .btn {
        min-height: 50px !important;
        padding: 14px 18px !important;
        border-radius: 0 10px 10px 0 !important;
        border: 2px solid #0d6efd !important;
        flex: 0 0 auto !important;
    }
}

@media (max-width: 767.98px) {
    /* Mobile Navigation - handled by modern-navbar.css */

    /* Enhanced Mobile Table View for smaller screens */
    .table tbody td img {
        width: 70px !important;
        height: 70px !important;
        border-radius: 10px !important;
    }

    .table thead th:first-child {
        width: 80px !important;
    }

    .table tbody td {
        padding: 15px 10px !important;
    }

    .table tbody td a {
        font-size: 1rem !important;
        line-height: 1.3 !important;
    }

    /* Item Cards - Enhanced for tablet */
    .item-img {
        height: 220px !important;
    }

    .item-info {
        padding: 18px !important;
    }

    .item-info h3 {
        font-size: 1.3rem !important;
        margin-bottom: 10px !important;
    }

    .item-meta {
        padding: 15px 18px !important;
    }

    /* Admin Items Search - Full width on mobile */
    .admin-search-container {
        width: 100% !important;
    }

    .admin-search-container .input-group {
        width: 100% !important;
        display: flex !important;
        flex-wrap: nowrap !important;
    }

    .admin-search-container .form-control {
        flex: 1 1 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        font-size: 16px !important;
        min-height: 52px !important;
        padding: 15px 20px !important;
        border-radius: 26px !important; /* Full rounded on mobile when no icon */
        border: 2px solid #e9ecef !important;
    }

    /* Hide icon on mobile, so input gets full rounded corners */
    .admin-search-container .input-group-text {
        display: none !important;
    }

    /* Tablet and Desktop - when icon is visible */
    @media (min-width: 768px) {
        .admin-search-container .form-control {
            border-radius: 10px 0 0 10px !important;
        }

        .admin-search-container .input-group-text {
            display: flex !important;
        }
    }

    /* Typography mobile */
    h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }

    h2 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    h3 {
        font-size: 1.3rem;
        line-height: 1.3;
    }

    h4 {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    /* Container mobile */
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Cards mobile */
    .card {
        margin-bottom: 15px;
        border-radius: 10px;
    }

    .card-body {
        padding: 15px;
    }

    .card-header {
        padding: 12px 15px;
        font-size: 1rem;
        font-weight: 600;
    }

    /* Buttons mobile */
    .btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 6px !important;
        margin-bottom: 5px;
    }

    /* Forms mobile */
    .form-control,
    .form-select {
        padding: 16px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 52px;
        border-radius: 12px;
        border: 2px solid #e9ecef;
        transition: all 0.3s ease;
    }

    .form-control:focus,
    .form-select:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
        transform: translateY(-1px);
    }

    .form-label {
        font-weight: 600;
        margin-bottom: 10px;
        font-size: 1rem;
        color: #495057;
    }

    /* Search Input Groups - Keep horizontal on mobile for search */
    .input-group.input-group-lg .form-control {
        padding: 18px 24px;
        font-size: 17px;
        min-height: 56px;
        border-radius: 16px 0 0 16px;
    }

    .input-group.input-group-lg .btn {
        padding: 18px 24px;
        font-size: 17px;
        min-height: 56px;
        border-radius: 0 16px 16px 0;
        min-width: 120px;
    }

    /* Filter forms - Stack vertically */
    .filter-section .input-group,
    .card-body .input-group:not(.input-group-lg) {
        flex-direction: column;
    }

    .filter-section .input-group .form-control,
    .filter-section .input-group .btn,
    .card-body .input-group:not(.input-group-lg) .form-control,
    .card-body .input-group:not(.input-group-lg) .btn {
        border-radius: 12px !important;
        margin-bottom: 10px;
        min-height: 52px;
    }

    .filter-section .input-group .btn,
    .card-body .input-group:not(.input-group-lg) .btn {
        margin-bottom: 0;
    }

    /* Items List Layout Mobile */
    .item-main {
        order: 2;
    }

    .filter-sidebar {
        order: 1;
        margin-bottom: 20px;
    }

    .items-header-card {
        margin-bottom: 15px !important;
    }

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

    .items-header-card .row {
        flex-direction: column;
        gap: 10px;
    }

    .items-header-card .col-md-6 {
        margin-bottom: 10px;
    }

    /* Mobile Items List - Enhanced UX with better image display */

    /* Mobile Table View Improvements */
    .table-responsive {
        border-radius: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    }

    .table {
        margin-bottom: 0 !important;
        font-size: 0.9rem !important;
    }

    .table thead th {
        background-color: #f8f9fa !important;
        border-bottom: 2px solid #dee2e6 !important;
        font-weight: 600 !important;
        color: #495057 !important;
        padding: 12px 8px !important;
        font-size: 0.85rem !important;
    }

    .table tbody td {
        padding: 12px 8px !important;
        vertical-align: middle !important;
        border-bottom: 1px solid #f0f0f0 !important;
    }

    .table tbody tr:hover {
        background-color: rgba(0, 123, 255, 0.03) !important;
    }

    /* Enhanced Image Display in Table */
    .table tbody td img {
        width: 60px !important;
        height: 60px !important;
        object-fit: cover !important;
        border-radius: 8px !important;
        border: 2px solid #e9ecef !important;
        transition: all 0.3s ease !important;
        cursor: pointer !important;
        background-color: #f8f9fa !important;
        position: relative !important;
    }

    .table tbody td img:hover {
        transform: scale(1.1) !important;
        border-color: #007bff !important;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2) !important;
        z-index: 10 !important;
    }

    /* Loading state for images */
    .table tbody td img[src*="loading"] {
        background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%) !important;
        background-size: 200% 100% !important;
        animation: loading 1.5s infinite !important;
    }

    @keyframes loading {
        0% { background-position: 200% 0; }
        100% { background-position: -200% 0; }
    }

    /* Error state for images */
    .table tbody td img[alt*="error"],
    .table tbody td img[src*="default"] {
        background-color: #f8f9fa !important;
        border-color: #dee2e6 !important;
        opacity: 0.8 !important;
    }

    /* Touch feedback for mobile */
    .table tbody td a {
        -webkit-tap-highlight-color: rgba(0, 123, 255, 0.1) !important;
        tap-highlight-color: rgba(0, 123, 255, 0.1) !important;
    }

    .table tbody td:active {
        background-color: rgba(0, 123, 255, 0.05) !important;
    }

    /* Item Title Links */
    .table tbody td a {
        color: #333 !important;
        text-decoration: none !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        display: block !important;
        transition: color 0.2s ease !important;
    }

    .table tbody td a:hover {
        color: #007bff !important;
    }

    /* Year Column */
    .table tbody td:last-child {
        color: #6c757d !important;
        font-size: 0.85rem !important;
        font-weight: 500 !important;
    }

    /* Item Grid Mobile - 1 item per row - Force Display */
    .item-grid {
        width: 100% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
    }

    .item-grid .row {
        margin: 0 -10px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .item-grid .col-12,
    .item-grid .col-lg-6,
    .item-grid .col-xl-4,
    .item-grid [class*="col-"] {
        padding: 0 10px !important;
        margin-bottom: 20px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        position: relative !important;
        height: auto !important;
        overflow: visible !important;
    }

    .item-card {
        height: auto !important;
        min-height: 320px !important;
        display: flex !important;
        flex-direction: column !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
        transition: all 0.3s ease !important;
        background: white !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1 !important;
    }

    .item-card:hover {
        transform: translateY(-2px) !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    }

    .item-card a {
        color: inherit !important;
        text-decoration: none !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .item-img {
        height: 200px !important;
        width: 100% !important;
        object-fit: cover !important;
        flex-shrink: 0 !important;
        display: block !important;
        transition: transform 0.3s ease !important;
    }

    .item-card:hover .item-img {
        transform: scale(1.02) !important;
    }

    .item-info {
        padding: 15px !important;
        flex-grow: 1 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .item-info h3 {
        font-size: 1.2rem !important;
        margin-bottom: 8px !important;
        line-height: 1.3 !important;
        font-weight: 600 !important;
        color: #333 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .item-info p {
        font-size: 0.9rem !important;
        color: #6c757d !important;
        margin: 0 !important;
    }

    .item-meta {
        padding: 12px 15px !important;
        border-top: 1px solid #f0f0f0 !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        margin-top: auto !important;
    }

    .item-meta .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
        border-radius: 6px;
        font-weight: 500;
    }

    /* Filter Sidebar Mobile */
    .filter-sidebar .card {
        margin-bottom: 15px;
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .filter-sidebar .card-header {
        padding: 12px 15px;
        background-color: #f8f9fa;
        border-bottom: 1px solid #dee2e6;
    }

    .filter-sidebar .card-body {
        padding: 15px;
    }

    .filter-sidebar .form-label {
        font-weight: 600;
        margin-bottom: 8px;
        font-size: 0.9rem;
    }

    .filter-sidebar .form-control,
    .filter-sidebar .form-select {
        padding: 10px 12px;
        font-size: 0.9rem;
        min-height: 44px;
        border-radius: 8px;
    }

    .filter-sidebar .input-group {
        width: 100% !important;
        display: flex !important;
    }

    .filter-sidebar .input-group .form-control {
        border-radius: 8px 0 0 8px;
        flex: 1 !important;
        width: 100% !important;
    }

    .filter-sidebar .input-group .btn {
        border-radius: 0 8px 8px 0;
        padding: 10px 12px;
        min-height: 44px;
        flex-shrink: 0 !important;
        min-width: 44px;
    }

    .filter-sidebar .filter-options {
        max-height: 250px; /* เพิ่มความสูงสำหรับ mobile screens */
        padding: 8px;
        border-radius: 8px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        position: relative;
    }

    /* ปรับปรุง scrollbar สำหรับ mobile */
    .filter-sidebar .filter-options::-webkit-scrollbar {
        width: 8px;
    }

    .filter-sidebar .filter-options::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.05);
        border-radius: 4px;
    }

    .filter-sidebar .filter-options::-webkit-scrollbar-thumb {
        background: rgba(0, 123, 255, 0.3);
        border-radius: 4px;
    }

    .filter-sidebar .filter-options::-webkit-scrollbar-thumb:active {
        background: rgba(0, 123, 255, 0.5);
    }

    /* เพิ่ม gradient fade effect */
    .filter-sidebar .filter-options::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 25px;
        background: linear-gradient(transparent, rgba(248, 249, 250, 0.9));
        pointer-events: none;
        border-radius: 0 0 8px 8px;
    }

    /* Touch feedback และ scrolling indicators */
    .filter-sidebar .filter-options.touching {
        background: rgba(248, 249, 250, 0.95);
        transform: scale(0.995);
        transition: all 0.1s ease;
    }

    .filter-sidebar .filter-options.scrolling {
        box-shadow: inset 0 0 10px rgba(0, 123, 255, 0.1);
    }

    .filter-sidebar .filter-options.scrolling::-webkit-scrollbar-thumb {
        background: rgba(0, 123, 255, 0.6);
    }

    .filter-sidebar .form-check {
        padding: 6px 0;
    }

    .filter-sidebar .form-check-input {
        margin-top: 0.2em;
    }

    .filter-sidebar .form-check-label {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    /* Table View Mobile */
    .item-table {
        margin-top: 20px;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .item-table .table {
        margin-bottom: 0;
        font-size: 0.85rem;
    }

    .item-table .table th {
        background-color: #f8f9fa;
        border-bottom: 2px solid #dee2e6;
        font-weight: 600;
        padding: 12px 8px;
        font-size: 0.8rem;
    }

    .item-table .table td {
        padding: 12px 8px;
        vertical-align: middle;
        border-bottom: 1px solid #f0f0f0;
    }

    .item-table .table td img {
        border-radius: 6px;
        width: 50px;
        height: 50px;
        object-fit: cover;
    }

    .item-table .table td .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .item-table .table tbody tr:hover {
        background-color: #f8f9fa;
    }

    /* View Mode Toggle Mobile */
    .items-header-card .d-flex {
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
    }

    .items-header-card .btn-group {
        width: 100%;
        justify-content: center;
    }

    .items-header-card .btn-group .btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 0.9rem;
        min-height: 44px;
    }

    .items-header-card select {
        width: auto;
        min-width: 80px;
    }

    /* Pagination Mobile */
    .pagination-wrapper {
        margin-top: 30px;
        display: flex;
        justify-content: center;
    }

    .pagination-wrapper .pagination {
        flex-wrap: wrap;
        gap: 5px;
        justify-content: center;
    }

    .pagination-wrapper .page-link {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-width: 40px;
        text-align: center;
        border-radius: 8px;
        margin: 2px;
    }

    /* Alert mobile */
    .alert {
        padding: 12px 15px;
        font-size: 0.9rem;
        border-radius: 8px;
    }

    /* Badge mobile */
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
        border-radius: 6px;
    }

    /* Modal mobile */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header {
        padding: 15px 20px;
        border-bottom: 1px solid #dee2e6;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 15px 20px;
        border-top: 1px solid #dee2e6;
    }

    /* Dropdown mobile */
    .dropdown-menu {
        border-radius: 10px;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
        border: none;
        padding: 8px;
    }

    .dropdown-item {
        padding: 10px 12px;
        border-radius: 6px;
        margin-bottom: 2px;
        font-size: 0.9rem;
    }

    /* Breadcrumb mobile */
    .breadcrumb {
        background-color: transparent;
        padding: 8px 0;
        margin-bottom: 15px;
        font-size: 0.85rem;
        flex-wrap: wrap;
    }

    .breadcrumb-item {
        margin-bottom: 5px;
    }

    /* List group mobile */
    .list-group-item {
        padding: 12px 15px;
        border-radius: 8px !important;
        margin-bottom: 5px;
        border: 1px solid #dee2e6 !important;
    }

    /* Progress mobile */
    .progress {
        height: 8px;
        border-radius: 4px;
    }

    /* Tabs mobile */
    .nav-tabs {
        flex-wrap: wrap;
        border-bottom: 2px solid #dee2e6;
    }

    .nav-tabs .nav-link {
        padding: 10px 15px;
        font-size: 0.9rem;
        border-radius: 8px 8px 0 0;
        margin-bottom: -2px;
        margin-right: 5px;
    }

    /* Accordion mobile */
    .accordion-button {
        padding: 15px 20px;
        font-size: 0.95rem;
        font-weight: 600;
    }

    .accordion-body {
        padding: 20px;
    }

    /* Offcanvas mobile */
    .offcanvas {
        width: 85% !important;
        max-width: 350px;
    }

    .offcanvas-header {
        padding: 20px;
        border-bottom: 1px solid #dee2e6;
    }

    .offcanvas-body {
        padding: 20px;
    }
}

@media (max-width: 575.98px) {
    /* Mobile Navigation Dropdown Styles - Extra small screens */
    body:not(.home-page) .navbar-collapse {
        margin-top: 12px !important;
        padding: 20px !important;
        border-radius: 12px !important;
    }

    body:not(.home-page) .navbar-nav .nav-link {
        padding: 12px 16px !important;
        font-size: 1rem !important;
    }

    /* Enhanced Mobile Table View for extra small screens */
    .table-responsive {
        border-radius: 10px !important;
        margin: 0 -5px !important;
    }

    .table tbody td img {
        width: 55px !important;
        height: 55px !important;
        border-radius: 8px !important;
        border-width: 1px !important;
    }

    .table thead th {
        padding: 10px 6px !important;
        font-size: 0.8rem !important;
    }

    .table thead th:first-child {
        width: 65px !important;
    }

    .table tbody td {
        padding: 10px 6px !important;
        font-size: 0.85rem !important;
    }

    .table tbody td a {
        font-size: 0.9rem !important;
        line-height: 1.2 !important;
    }

    .table tbody td:last-child {
        font-size: 0.8rem !important;
    }

    /* Item Cards - Optimized for small mobile */
    .item-card {
        min-height: 280px !important;
        border-radius: 10px !important;
    }

    .item-img {
        height: 180px !important;
    }

    .item-info {
        padding: 12px !important;
    }

    .item-info h3 {
        font-size: 1.1rem !important;
        margin-bottom: 6px !important;
        -webkit-line-clamp: 2 !important;
    }

    .item-info p {
        font-size: 0.85rem !important;
    }

    .item-meta {
        padding: 10px 12px !important;
        gap: 6px !important;
    }

    .item-meta .badge {
        font-size: 0.7rem !important;
        padding: 3px 6px !important;
    }

    /* Extra small mobile */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Admin Mobile Extra Small */
    .navbar {
        height: 65px !important;
        padding: 0.4rem 0.6rem !important;
    }

    .navbar-brand {
        font-size: 1.1rem !important;
        font-weight: 600 !important;
    }

    .navbar-brand img {
        max-height: 32px !important;
    }

    .navbar-brand span {
        font-size: 0.95rem !important;
        margin-left: 6px !important;
        font-weight: 600 !important;
    }

    .dropdown button img {
        width: 28px !important;
        height: 28px !important;
    }

    .sidebar {
        top: 65px !important;
        width: 240px !important;
    }

    .main-content {
        margin-top: 65px !important;
        min-height: calc(100vh - 65px) !important;
    }

    #toggleSidebarMobile {
        min-height: 40px !important;
        min-width: 40px !important;
        padding: 6px !important;
        background-color: #343a40 !important;
        color: white !important;
        border: none !important;
    }

    #toggleSidebarMobile:hover,
    #toggleSidebarMobile:focus {
        background-color: #495057 !important;
        color: white !important;
    }

    #toggleSidebarMobile i {
        color: white !important;
        font-size: 1rem !important;
    }

    /* Typography extra small */
    h1 {
        font-size: 1.6rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    /* Cards extra small */
    .card-body {
        padding: 12px;
    }

    .card-header {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    /* Buttons extra small */
    .btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        min-height: 42px !important;
    }

    /* Admin Search Extra Small */
    .admin-search-container .form-control,
    .admin-search-container .input-group-text,
    .admin-search-container .btn {
        min-height: 46px !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
    }

    /* Forms extra small */
    .form-control,
    .form-select {
        padding: 14px 18px;
        font-size: 16px;
        min-height: 50px;
        border-radius: 10px;
    }

    .input-group.input-group-lg .form-control {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 52px;
        border-radius: 14px 0 0 14px;
    }

    .input-group.input-group-lg .btn {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 52px;
        border-radius: 0 14px 14px 0;
        min-width: 100px;
    }

    /* Modal extra small */
    .modal-dialog {
        margin: 5px;
        max-width: calc(100% - 10px);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px;
    }

    /* Table extra small */
    .table {
        font-size: 0.8rem;
    }

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

    /* Pagination extra small */
    .pagination .page-item .page-link {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 36px;
    }

    /* Items List Extra Small Mobile */
    .item-grid .col-12,
    .item-grid .col-lg-6,
    .item-grid .col-xl-4 {
        padding: 0 8px;
        margin-bottom: 16px;
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .item-card {
        min-height: 280px;
        border-radius: 10px;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .item-img {
        height: 180px;
        display: block !important;
    }

    .item-info {
        padding: 12px;
        display: flex !important;
        flex-direction: column;
    }

    .item-info h3 {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .item-meta {
        padding: 10px 12px;
        gap: 6px;
        display: flex !important;
    }

    .item-meta .badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }

    .items-header-card .card-body {
        padding: 12px !important;
    }

    .items-header-card .badge {
        font-size: 0.8rem;
        padding: 4px 8px;
    }

    /* Filter Sidebar Extra Small */
    .filter-sidebar .input-group {
        width: 100% !important;
        display: flex !important;
    }

    .filter-sidebar .input-group .form-control {
        flex: 1 !important;
        width: 100% !important;
        font-size: 16px !important;
        min-height: 50px !important;
    }

    .filter-sidebar .input-group .btn {
        flex-shrink: 0 !important;
        min-width: 50px !important;
        font-size: 16px !important;
        min-height: 50px !important;
    }





    /* Mobile Table View Responsive - Clean Version */
    @media (max-width: 1199.98px) {
        .d-xl-none .item-table {
            margin-top: 20px;
        }

        .d-xl-none .table {
            margin-bottom: 0;
            font-size: 0.9rem;
        }

        .d-xl-none .table th {
            font-weight: 600;
            padding: 12px 8px;
            font-size: 0.85rem;
            white-space: nowrap;
        }

        .d-xl-none .table td {
            padding: 12px 8px;
            vertical-align: middle;
        }

        .d-xl-none .table td img {
            border-radius: 6px;
            width: 50px;
            height: 50px;
            object-fit: cover;
        }

        .d-xl-none .table td h6 {
            font-size: 1rem;
            margin-bottom: 4px;
            line-height: 1.3;
            font-weight: 600;
        }

        .d-xl-none .table td .badge {
            font-size: 0.7rem;
            padding: 3px 6px;
            margin-right: 4px;
            margin-bottom: 2px;
        }
    }

    /* Extra small mobile specific */
    @media (max-width: 575.98px) {
        .d-xl-none .item-table .table th {
            padding: 8px 6px !important;
            font-size: 0.8rem !important;
        }

        .d-xl-none .item-table .table td {
            padding: 8px 6px !important;
        }

        .d-xl-none .item-table .table td img {
            width: 40px !important;
            height: 40px !important;
        }

        .d-xl-none .item-table .table td h6 {
            font-size: 0.9rem !important;
            margin-bottom: 2px !important;
        }

        .d-xl-none .item-table .table td .badge {
            font-size: 0.65rem !important;
            padding: 2px 4px !important;
        }
    }

    /* Fix Livewire Loading Issues */
    .content-loading {
        opacity: 0.7 !important;
        pointer-events: none !important;
    }

    .opacity-50 {
        opacity: 0.5 !important;
    }

    /* Force items to be visible - Override any hiding CSS */
    .item-grid {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        overflow: visible !important;
        position: relative !important;
    }

    .item-grid .row {
        display: flex !important;
        flex-wrap: wrap !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .item-grid .col-12,
    .item-grid .col-lg-6,
    .item-grid .col-xl-4,
    .item-grid [class*="col-"] {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        height: auto !important;
        overflow: visible !important;
    }

    .item-card {
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        height: auto !important;
        min-height: 280px !important;
        overflow: visible !important;
        background: white !important;
        border: 1px solid #ddd !important;
    }

    .item-card a {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        text-decoration: none !important;
        color: inherit !important;
    }

    .item-img {
        display: block !important;
        width: 100% !important;
        height: 180px !important;
        object-fit: cover !important;
    }

    .item-info {
        display: block !important;
        padding: 12px !important;
        flex-grow: 1 !important;
    }

    .item-info h3 {
        display: block !important;
        margin-bottom: 8px !important;
        font-size: 1.1rem !important;
        color: #333 !important;
    }

    .item-meta {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 10px 12px !important;
        border-top: 1px solid #eee !important;
    }

    .item-table {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .item-table .table {
        display: table !important;
        width: 100% !important;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 40vh !important;
        padding: 80px 0 30px !important;
    }

    .modal-dialog {
        margin: 5px auto;
        max-height: calc(100vh - 10px);
    }

    .modal-content {
        max-height: 100%;
        overflow-y: auto;
    }
}
