/* ====================================
   RESPONSIVE STYLES - Admin Dashboard
   All @media queries for responsive design
   ==================================== */

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    .container-fluid {
        /* max-width: 1600px; */
        margin: 0 auto;
    }

    .page-content {
        padding: 30px;
    }

    .card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    }
}

/* Desktop (1200px - 1399px) */
@media (min-width: 1200px) and (max-width: 1399px) {
    .page-content {
        padding: 24px;
    }

    .stat-card h4 {
        font-size: 26px;
    }
}

/* Tablet Landscape (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .page-content {
        padding: 20px;
    }

    .sidebar {
        width: 240px;
    }

    :root {
        --sidebar-width: 240px;
    }

    .stat-card h4 {
        font-size: 24px;
    }

    .card-body {
        padding: 20px;
    }
}

/* Tablet - Sidebar Close Button (991px) */
@media (max-width: 991px) {
    .sidebar-close {
        display: block;
    }
}

/* Tablet - Layout & Sidebar (991px) */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.15);
        z-index: 1050;
        width: 85vw;
        max-width: 320px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .main-wrapper.sidebar-collapsed {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .search-box input {
        width: 180px;
    }

    .user-name {
        display: none;
    }

    /* Improve touch targets for mobile */
    .nav-link {
        padding: 16px 20px;
        font-size: 16px;
        min-height: 56px;
    }

    .nav-link i {
        font-size: 22px;
        width: 28px;
    }

    .submenu li a {
        padding: 12px 20px 12px 60px;
        font-size: 15px;
        min-height: 48px;
    }

    /* Page content full width */
    .page-content {
        padding: 16px;
    }

    /* Better button spacing */
    .btn-group {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Forms responsive */
    .form-control,
    .form-select {
        font-size: 16px;
        padding: 12px 16px;
    }

    /* Chart containers */
    .chart-container {
        height: 300px !important;
    }
}

/* Mobile - General Layout (767px) */
@media (max-width: 767px) {
    .header {
        padding: 0 12px;
        height: 60px;
    }

    .search-box {
        display: none;
    }

    .header-btn {
        padding: 10px;
        font-size: 20px;
        min-width: 44px;
        min-height: 44px;
    }

    .page-content {
        padding: 12px;
    }

    .page-title-box {
        margin-bottom: 16px;
    }

    .page-title {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .breadcrumb {
        font-size: 13px;
        margin-bottom: 0;
    }

    /* Stats cards responsive */
    .stat-card {
        margin-bottom: 16px;
    }

    .stat-card .card-body {
        padding: 18px;
    }

    .stat-card h4 {
        font-size: 22px;
    }

    .stat-card p {
        font-size: 13px;
    }

    /* Dropdown menus */
    .notification-dropdown {
        width: 92vw;
        max-width: 340px;
        left: 4vw !important;
        right: 4vw !important;
    }

    .profile-dropdown {
        width: 92vw;
        max-width: 260px;
        right: 4vw !important;
    }

    /* Better button layouts */
    .btn-group-vertical .btn,
    .btn-group .btn {
        font-size: 15px;
        padding: 10px 16px;
        min-height: 44px;
    }

    /* Form elements */
    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .input-group {
        flex-wrap: nowrap;
    }

    /* Footer */
    .footer {
        padding: 16px;
        text-align: center;
    }

    .footer .text-md-end {
        text-align: center !important;
        margin-top: 8px;
    }

    /* Cards responsive */
    .row > [class*='col-'] {
        margin-bottom: 16px;
    }

    /* Alerts */
    .alert {
        font-size: 14px;
        padding: 12px 16px;
    }

    /* Badges */
    .badge {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* Extra Small Devices (576px) */
@media (max-width: 576px) {
    :root {
        --header-height: 60px;
    }

    .sidebar {
        width: 90vw;
        max-width: 300px;
    }

    .sidebar-header {
        padding: 16px;
    }

    .logo-wrapper {
        font-size: 18px;
    }

    .logo-icon {
        font-size: 26px;
    }

    .page-title {
        font-size: 18px;
    }

    .page-content {
        padding: 10px;
    }

    /* Stats cards */
    .stat-card h4 {
        font-size: 20px;
    }

    .stat-card .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .stat-card p {
        font-size: 12px;
    }

    /* Larger touch targets */
    .nav-link {
        padding: 18px;
        min-height: 60px;
    }

    .sidebar-close {
        padding: 12px;
        font-size: 24px;
        min-width: 48px;
        min-height: 48px;
    }

    .user-info {
        padding: 14px;
    }

    .header-right {
        gap: 2px;
    }

    .header-btn {
        padding: 8px;
        font-size: 18px;
        min-width: 44px;
        min-height: 44px;
    }

    /* Typography */
    h1 { font-size: 28px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    h4 { font-size: 18px; }
    h5 { font-size: 16px; }
    h6 { font-size: 14px; }

    /* Buttons */
    .btn {
        padding: 10px 18px;
        font-size: 14px;
        min-height: 44px;
    }

    .btn-sm {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 38px;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 16px;
        min-height: 50px;
    }

    /* Form controls */
    .form-control,
    .form-select {
        font-size: 16px;
        padding: 12px 14px;
        min-height: 48px;
    }

    /* Modals */
    .modal-dialog {
        margin: 10px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 14px 16px;
    }
}

/* Mobile Responsive Table (991px) */
@media (max-width: 991px) {
    .table-responsive {
        border: none;
        box-shadow: none;
    }

    .table-responsive::after {
        display: none;
    }

    #usersTable {
        min-width: auto;
        border: none;
    }

    #usersTable thead {
        display: none;
    }

    #usersTable tbody {
        display: block;
    }

    #usersTable tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        background: white !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        overflow: hidden;
        transition: transform 0.2s, box-shadow 0.2s;
        position: relative;
    }

    #usersTable tbody tr:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
        background: white !important;
    }

    #usersTable tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        border: none;
        border-bottom: 1px solid #f0f0f5;
        text-align: right;
    }

    #usersTable tbody td:last-child {
        border-bottom: none;
    }

    #usersTable tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 10px;
        letter-spacing: 0.8px;
        text-align: left;
    }

    #usersTable tbody td:first-child {
        position: absolute;
        top: 12px;
        right: 12px;
        background: transparent;
        padding: 0;
        border: none;
        width: auto;
        z-index: 10;
    }

    #usersTable tbody td:first-child::before {
        display: none;
    }

    #usersTable tbody td:nth-child(2) {
        padding: 20px 16px;
        border-bottom: 2px solid var(--light-color);
        background: linear-gradient(to bottom, rgba(64, 81, 137, 0.02), transparent);
    }

    #usersTable tbody td:nth-child(2)::before {
        display: none;
    }

    .user-info-cell {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        gap: 14px;
        padding-right: 30px;
    }

    .user-avatar-table {
        width: 50px;
        height: 50px;
        flex-shrink: 0;
    }

    .user-details-table {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .user-name-table {
        font-size: 16px;
        font-weight: 600;
        color: var(--dark-color);
    }

    .user-id-table {
        font-size: 12px;
        color: var(--text-muted);
        font-weight: 500;
    }

    #usersTable tbody td:nth-child(3) {
        padding: 12px 16px;
    }

    #usersTable tbody td:nth-child(3)::before {
        content: 'EMAIL';
    }

    #usersTable tbody td:nth-child(4) {
        display: flex !important;
        padding: 12px 16px;
    }

    #usersTable tbody td:nth-child(5) {
        display: flex !important;
        padding: 12px 16px;
    }

    #usersTable tbody td:nth-child(6) {
        display: none !important;
    }

    #usersTable tbody td:last-child {
        background: var(--light-color);
        justify-content: center;
        padding: 16px;
        gap: 8px;
        border-top: 2px solid #e9ebec;
    }

    #usersTable tbody td:last-child::before {
        display: none;
    }

    .action-btn {
        padding: 10px 16px;
        font-size: 18px;
        border-radius: 8px;
        min-width: 44px;
        height: 44px;
    }

    .action-btn:hover {
        transform: scale(1.08);
    }
}

/* Tablet Table Width (768px - 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    #usersTable {
        min-width: 650px;
    }
}

/* Small Mobile Table Adjustments (576px) */
@media (max-width: 576px) {
    #usersTable tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .user-avatar-table {
        width: 36px;
        height: 36px;
    }

    .user-name-table {
        font-size: 14px;
    }

    .user-id-table {
        font-size: 11px;
    }

    .action-btn {
        padding: 6px;
        font-size: 16px;
    }
}

/* Mobile Modal Adjustments (768px) */
@media (max-width: 768px) {
    .modern-modal .modal-header {
        padding: 20px;
    }

    .modal-user-avatar {
        width: 48px;
        height: 48px;
        border-radius: 12px;
    }

    .modal-title {
        font-size: 16px;
    }

    .modal-tabs {
        padding: 0 16px;
    }

    .modal-tabs .nav-link {
        padding: 12px 12px;
        font-size: 12px;
    }

    .modal-tabs .nav-link i {
        display: none;
    }

    .tab-content {
        padding: 20px !important;
    }

    .info-card {
        flex-direction: column;
        gap: 16px;
    }

    .info-item {
        min-width: 100%;
    }

    .modern-modal .modal-footer {
        padding: 16px 20px;
        flex-direction: column;
    }

    .modern-modal .modal-footer .btn {
        width: 100%;
    }

    .delete-modal .modal-body {
        padding: 32px 24px !important;
    }

    .delete-icon-circle {
        width: 80px;
        height: 80px;
    }

    .delete-icon-circle i {
        font-size: 36px;
    }
}

/* Tablet Filter Bar (991.98px) */
@media (max-width: 991.98px) {
    .filter-bar .row > div {
        margin-bottom: 0;
    }

    .sidebar-filter {
        margin-bottom: 20px;
    }

    .filter-section {
        padding: 15px;
    }
}

/* Mobile Filter Bar & Products (767.98px) */
@media (max-width: 767.98px) {
    .filter-bar {
        padding: 15px;
    }

    .filter-panel {
        padding: 15px;
    }

    .quick-filters .btn {
        padding: 8px 18px;
        font-size: 13px;
    }

    .filter-tag {
        font-size: 12px;
        padding: 6px 12px;
    }

    .product-card {
        margin-bottom: 15px;
    }
}

/* Extra Small Filter Adjustments (575.98px) */
@media (max-width: 575.98px) {
    .filter-bar .col-12 {
        margin-bottom: 10px;
    }

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .btn {
        width: 100%;
    }

    .quick-filters {
        gap: 8px;
    }

    .quick-filters .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        padding: 8px 12px;
        font-size: 12px;
    }
}

/* Tablet Card Adjustments (991.98px) */
@media (max-width: 991.98px) {
    .card-body {
        padding: 20px;
    }

    .card-header {
        padding: 16px 20px;
    }

    .icon-circle {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }

    .feature-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* Mobile Card Styles (767.98px) */
@media (max-width: 767.98px) {
    .card {
        margin-bottom: 16px;
    }

    .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 14px 16px;
    }

    .card-footer {
        padding: 12px 16px;
    }

    .icon-circle {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .feature-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .card-group {
        flex-direction: column;
    }

    .card-group > .card {
        border-radius: 12px !important;
        margin-bottom: 16px;
    }
}

/* Extra Small Card Typography (575.98px) */
@media (max-width: 575.98px) {
    .card-title {
        font-size: 15px;
    }

    .card h3 {
        font-size: 24px;
    }

    .card h4 {
        font-size: 20px;
    }

    .card h5 {
        font-size: 16px;
    }
}

/* Mobile Multistep Forms (767.98px) */
@media (max-width: 767.98px) {
    .multistep-indicator {
        padding: 15px 0;
    }

    .step-circle {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .step-label {
        font-size: 11px;
        margin-top: 8px;
    }

    .step-line {
        max-width: 60px;
        top: -15px;
    }
}

/* Extra Small Multistep Forms (575.98px) */
@media (max-width: 575.98px) {
    .step-label {
        display: none;
    }

    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .step-line {
        max-width: 40px;
        top: -12px;
    }
}

/* ====================================
   Additional Component Responsive Styles
   ==================================== */

/* Accordion Mobile (767px) */
@media (max-width: 767px) {
    .accordion-button {
        font-size: 14px;
        padding: 14px 16px;
    }

    .accordion-body {
        font-size: 13px;
        padding: 14px 16px;
    }
}

/* Tabs Mobile (767px) */
@media (max-width: 767px) {
    .nav-tabs .nav-link {
        font-size: 13px;
        padding: 10px 12px;
    }

    .tab-content {
        padding: 16px 12px;
    }
}

/* Pagination Mobile (575px) */
@media (max-width: 575px) {
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .page-link {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 40px;
    }
}

/* Breadcrumb Mobile (575px) */
@media (max-width: 575px) {
    .breadcrumb-item {
        font-size: 12px;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        font-size: 10px;
    }
}

/* List Group Mobile (767px) */
@media (max-width: 767px) {
    .list-group-item {
        padding: 12px 14px;
        font-size: 14px;
    }
}

/* Progress Bars Mobile (575px) */
@media (max-width: 575px) {
    .progress {
        height: 8px;
    }

    .progress-bar {
        font-size: 0;
    }
}

/* Toasts Mobile (575px) */
@media (max-width: 575px) {
    .toast {
        width: calc(100vw - 20px);
        margin: 10px;
    }
}

/* Offcanvas Mobile Improvements */
@media (max-width: 767px) {
    .offcanvas {
        width: 90vw !important;
        max-width: 320px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    button,
    a,
    .btn,
    .nav-link,
    .dropdown-item {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .card:hover {
        transform: none;
    }

    /* Better spacing for touch */
    .btn-group .btn {
        margin: 2px;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .header,
    .footer,
    .action-btn,
    .btn,
    .sidebar-overlay {
        display: none !important;
    }

    .main-wrapper {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
}

/* Dark Mode Responsive Adjustments */
@media (max-width: 767px) {
    body.dark-mode {
        background: var(--dark-color);
    }

    body.dark-mode .card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}