/* 
 * Ecomosto - Mobile Responsive Enhancements
 * Comprehensive mobile optimization for all device sizes
 */

/* ==== MOBILE-FIRST RESPONSIVE DESIGN ==== */

/* Avatar styles */
.avatar-sm {
    width: 40px;
    height: 40px;
    font-size: 0.875rem;
}

.avatar-xs {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
}

/* Admin profile avatar */
.admin-profile-avatar {
    width: 50px;
    height: 50px;
}

/* Cart badge styles */
.cart-count {
    font-size: 0.75rem;
}

/* Touch-friendly interactions */
.btn, .form-control, .dropdown-toggle {
    min-height: 44px; /* Minimum touch target size */
    min-width: 44px;
}

/* Better spacing for mobile */
@media (max-width: 767.98px) {
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .py-4 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-4 {
        margin-top: 1.5rem !important;
    }
}

/* ==== ADMIN INTERFACE MOBILE OPTIMIZATIONS ==== */

/* Admin sidebar responsive behavior */
@media (max-width: 991.98px) {
    .admin-sidebar {
        position: relative;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .admin-sidebar .card {
        margin-bottom: 1rem;
    }
    
    .admin-sidebar .nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .admin-sidebar .nav-link {
        flex: 1;
        min-width: calc(50% - 0.125rem);
        text-align: center;
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .admin-sidebar .nav-link i {
        display: block;
        margin-bottom: 0.25rem;
        margin-right: 0 !important;
    }
}

@media (max-width: 575.98px) {
    .admin-sidebar .nav-link {
        min-width: 100%;
        text-align: left;
    }
    
    .admin-sidebar .nav-link i {
        display: inline;
        margin-bottom: 0;
        margin-right: 0.5rem !important;
    }
}

/* Admin page headers */
@media (max-width: 767.98px) {
    .admin-page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
    
    .admin-page-header .btn-group {
        width: 100%;
    }
    
    .admin-page-header .btn {
        flex: 1;
    }
}

/* ==== DATA TABLES MOBILE OPTIMIZATION ==== */

/* Responsive table wrapper with better scrolling */
.table-responsive {
    border-radius: 0.375rem;
    border: 1px solid var(--bs-border-color);
}

@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table-responsive table {
        min-width: 600px; /* Ensure horizontal scroll when needed */
    }
    
    /* Hide less important columns on mobile */
    .table .d-none-mobile {
        display: none !important;
    }
    
    .table th, .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Stack table cells for very narrow screens */
    .table-stack {
        display: block;
    }
    
    .table-stack thead {
        display: none;
    }
    
    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }
    
    .table-stack tr {
        border: 1px solid var(--bs-border-color);
        margin-bottom: 1rem;
        border-radius: 0.375rem;
        padding: 1rem;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .table-stack td {
        border: none;
        padding: 0.25rem 0;
        text-align: left !important;
    }
    
    .table-stack td:before {
        content: attr(data-label) ": ";
        font-weight: bold;
        display: inline-block;
        width: 120px;
        min-width: 120px;
    }
}

/* Mobile-friendly action buttons */
@media (max-width: 575.98px) {
    .btn-group-vertical-mobile .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-vertical-mobile .btn {
        margin-bottom: 0.25rem;
        border-radius: 0.375rem !important;
    }
    
    .table .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* ==== FORMS MOBILE OPTIMIZATION ==== */

@media (max-width: 767.98px) {
    .form-row-mobile {
        flex-direction: column;
    }
    
    .form-row-mobile .col-md-6,
    .form-row-mobile .col-lg-6 {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .input-group {
        flex-wrap: wrap;
    }
    
    .input-group > .form-control {
        min-width: 0;
        flex: 1 1 auto;
    }
}

/* ==== CARDS AND LAYOUTS ==== */

@media (max-width: 767.98px) {
    .card-deck-mobile {
        flex-direction: column;
    }
    
    .card-deck-mobile .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
}

/* ==== MODALS MOBILE OPTIMIZATION ==== */

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: none;
        width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    .modal-header {
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 70vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-wrap: wrap;
        justify-content: stretch;
    }
    
    .modal-footer .btn {
        flex: 1;
        margin: 0.25rem;
    }
}

/* ==== NAVIGATION MOBILE ENHANCEMENTS ==== */

@media (max-width: 991.98px) {
    .navbar-collapse {
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .navbar-nav .dropdown-menu {
        position: static;
        float: none;
        width: 100%;
        margin-top: 0;
        background-color: rgba(0,0,0,0.1);
        border: none;
    }
    
    .navbar .form-control {
        margin-bottom: 1rem;
    }
}

/* Mobile-friendly search bar */
@media (max-width: 767.98px) {
    .navbar .d-flex {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .navbar .input-group {
        width: 100%;
    }
}

/* ==== VERIFICATION SYSTEM MOBILE ==== */

@media (max-width: 991.98px) {
    .verification-dashboard .row {
        flex-direction: column;
    }
    
    .verification-progress-card {
        order: -1;
        margin-bottom: 1rem;
    }
    
    .verification-requirements {
        width: 100%;
    }
}

@media (max-width: 767.98px) {
    .verification-requirement-card {
        margin-bottom: 1rem;
    }
    
    .verification-upload-area {
        min-height: 120px;
        padding: 1rem;
    }
    
    .verification-status-badge {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

/* ==== DROPDOWNS AND SELECTS ==== */

@media (max-width: 575.98px) {
    .dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 0.5rem;
        border-radius: 0.375rem;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
    
    .form-select {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* ==== BUTTONS AND ACTIONS ==== */

@media (max-width: 575.98px) {
    .btn-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-toolbar .btn-group {
        width: 100%;
    }
    
    .btn-toolbar .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    
    .d-flex.gap-2 {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .d-flex.gap-2 .btn {
        width: 100%;
    }
}

/* ==== PAGINATION MOBILE ==== */

@media (max-width: 575.98px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination .page-item {
        margin: 0.125rem;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.75rem;
        min-width: 44px;
        text-align: center;
    }
    
    /* Hide page numbers, keep only prev/next */
    .pagination .page-item:not(.disabled):not(.active):not(:first-child):not(:last-child) {
        display: none;
    }
}

/* ==== ALERTS AND NOTIFICATIONS ==== */

@media (max-width: 767.98px) {
    .alert {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    .alert .d-flex {
        flex-direction: column;
        text-align: center;
    }
    
    .alert .d-flex > i {
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
    }
    
    .alert-heading {
        font-size: 1.1rem;
    }
}

/* ==== BREADCRUMBS ==== */

@media (max-width: 575.98px) {
    .breadcrumb {
        flex-wrap: wrap;
        font-size: 0.875rem;
    }
    
    .breadcrumb-item {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ==== STATS AND METRICS ==== */

@media (max-width: 767.98px) {
    .stats-card {
        text-align: center;
        margin-bottom: 1rem;
    }
    
    .stats-number {
        font-size: 1.75rem;
    }
    
    .stats-label {
        font-size: 0.875rem;
    }
}

/* ==== FILE UPLOAD AREAS ==== */

@media (max-width: 767.98px) {
    .upload-area {
        min-height: 100px;
        padding: 1rem;
        text-align: center;
    }
    
    .upload-area .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* ==== PRODUCT CARDS ==== */

@media (max-width: 767.98px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .product-card {
        margin-bottom: 1rem;
    }
    
    .product-card .card-body {
        padding: 1rem;
    }
    
    .product-card .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* ==== UTILITY CLASSES ==== */

/* Hide elements on mobile */
.d-mobile-none {
    display: none !important;
}

@media (min-width: 768px) {
    .d-mobile-none {
        display: block !important;
    }
}

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

@media (min-width: 768px) {
    .d-mobile-block {
        display: none !important;
    }
}

/* Mobile-specific spacing */
@media (max-width: 767.98px) {
    .mobile-spacing {
        margin-bottom: 1rem !important;
    }
    
    .mobile-padding {
        padding: 1rem !important;
    }
    
    .mobile-text-center {
        text-align: center !important;
    }
}

/* ==== TOUCH IMPROVEMENTS ==== */

/* Larger click targets for mobile */
@media (max-width: 767.98px) {
    .clickable {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better button spacing */
    .btn + .btn {
        margin-left: 0.5rem;
    }
    
    .btn-group-mobile .btn {
        margin-bottom: 0.5rem;
        width: 100%;
    }
}

/* ==== LOADING STATES ==== */

@media (max-width: 767.98px) {
    .loading-spinner {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 200px;
    }
}

/* ==== ACCESSIBILITY IMPROVEMENTS ==== */

/* Better focus indicators for mobile */
@media (max-width: 767.98px) {
    .btn:focus,
    .form-control:focus,
    .form-select:focus {
        outline: 2px solid var(--bs-primary);
        outline-offset: 2px;
    }
    
    /* Skip to content link for screen readers */
    .skip-to-content {
        position: absolute;
        left: -9999px;
        z-index: 999;
        padding: 1rem;
        background: var(--bs-primary);
        color: white;
        text-decoration: none;
    }
    
    .skip-to-content:focus {
        left: 1rem;
        top: 1rem;
    }
}

/* ==== PRINT STYLES ==== */

@media print {
    .d-print-none {
        display: none !important;
    }
    
    .container-fluid {
        width: 100% !important;
        max-width: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
    }
}