/* Mobile Responsive Enhancements for Item Manager */

/* ===== Base Responsive Improvements ===== */
body {
    font-size: 16px; /* Prevent iOS zoom on input focus */
}

/* ===== Navigation Enhancements ===== */
@media (max-width: 991.98px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .navbar-collapse {
        margin-top: 0.5rem;
    }
    
    /* Make dropdowns full width on mobile */
    .navbar-nav .dropdown-menu {
        width: 100%;
        border: none;
        box-shadow: none;
        background-color: rgba(255, 255, 255, 0.05);
    }
    
    .navbar-nav .dropdown-item {
        color: rgba(255, 255, 255, 0.9);
        padding: 0.75rem 1.5rem;
    }
    
    .navbar-nav .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
    
    .navbar-nav .dropdown-header {
        color: rgba(255, 255, 255, 0.6);
    }
}

/* ===== Card Improvements ===== */
@media (max-width: 767.98px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Dashboard stats cards */
    .col-md-3 {
        margin-bottom: 1rem;
    }
    
    .col-md-3:last-child {
        margin-bottom: 0;
    }
}

/* ===== Table Responsiveness ===== */
@media (max-width: 767.98px) {
    /* Hide less important columns on mobile */
    .table th:nth-child(3),
    .table td:nth-child(3),
    .table th:nth-child(4),
    .table td:nth-child(4),
    .table th:nth-child(5),
    .table td:nth-child(5) {
        display: none;
    }
    
    /* Make remaining columns more spacious */
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .table th:first-child,
    .table td:first-child {
        padding-left: 0.75rem;
    }
    
    .table th:last-child,
    .table td:last-child {
        padding-right: 0.75rem;
    }
    
    /* Stack item name and description */
    .table td small {
        display: block;
        margin-top: 0.25rem;
    }
}

/* ===== Form Improvements ===== */
@media (max-width: 767.98px) {
    /* Stack filter inputs vertically on mobile */
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0.75rem;
    }
    
    .row.g-3 > [class*="col-"]:last-child {
        margin-bottom: 0;
    }
    
    /* Make buttons full width on mobile */
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Form inputs */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* ===== Button Improvements ===== */
@media (max-width: 575.98px) {
    /* Make action buttons more touch-friendly */
    .btn-sm {
        min-width: 40px;
        min-height: 40px;
        padding: 0.5rem;
    }
    
    /* Stack buttons vertically when needed */
    .d-inline {
        display: block !important;
        margin-top: 0.25rem;
    }
    
    .d-inline:first-child {
        margin-top: 0;
    }
}

/* ===== Header Improvements ===== */
@media (max-width: 767.98px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .d-flex.justify-content-between h2 {
        margin-bottom: 1rem;
        font-size: 1.5rem;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
}

/* ===== Alert Improvements ===== */
@media (max-width: 575.98px) {
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem;
    }
    
    .alert h5 {
        font-size: 1rem;
    }
}

/* ===== Dashboard Specific ===== */
@media (max-width: 767.98px) {
    /* Make dashboard stats cards stack nicely */
    .dashboard .col-md-3,
    .dashboard .col-md-6 {
        margin-bottom: 1rem;
    }
    
    /* Quick actions */
    .d-grid.gap-2 {
        gap: 0.75rem !important;
    }
    
    .d-grid.gap-2 .btn {
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* ===== Touch-Friendly Improvements ===== */
@media (max-width: 767.98px) {
    /* Increase tap target size */
    .nav-link,
    .dropdown-item,
    .btn {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Better spacing for icons */
    .bi {
        margin-right: 0.25rem;
    }
}

/* ===== Container Padding ===== */
@media (max-width: 575.98px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    main.container {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}

/* ===== Footer ===== */
@media (max-width: 575.98px) {
    footer {
        font-size: 0.85rem;
        padding: 1rem 0;
    }
}

/* ===== Card List View (Alternative to Tables) ===== */
@media (max-width: 767.98px) {
    /* Add a mobile-friendly card view class */
    .mobile-card-view {
        display: none;
    }
    
    @media (max-width: 767.98px) {
        .table-responsive {
            display: none;
        }
        
        .mobile-card-view {
            display: block;
        }
        
        .mobile-card-view .card {
            margin-bottom: 1rem;
            border-left: 4px solid #0d6efd;
        }
        
        .mobile-card-view .card-body {
            padding: 1rem;
        }
        
        .mobile-card-view .item-name {
            font-size: 1.1rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }
        
        .mobile-card-view .item-meta {
            font-size: 0.9rem;
            color: #6c757d;
            margin-bottom: 0.25rem;
        }
        
        .mobile-card-view .item-actions {
            margin-top: 0.75rem;
            display: flex;
            gap: 0.5rem;
        }
        
        .mobile-card-view .item-actions .btn {
            flex: 1;
        }
    }
}

/* ===== Landscape Orientation Optimizations ===== */
@media (max-width: 767.98px) and (orientation: landscape) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
    
    main.container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
}

/* ===== Accessibility Improvements ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Dark Mode Support (if needed in future) ===== */
@media (prefers-color-scheme: dark) {
    /* Placeholder for dark mode styles */
}
