/* Responsive Styles for Blinkit Dashboard */

/* Large Desktop (1400px and up) */
@media (min-width: 1400px) {
    .dashboard-container {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Desktop (1200px to 1399px) */
@media (max-width: 1399px) {
    .kpi-value {
        font-size: 1.5rem;
    }
}

/* Tablet and below (991px and down) */
@media (max-width: 991px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }

    .sidebar.active {
        transform: translateX(0);
        animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .btn-toggle-sidebar {
        display: block;
        animation: fadeIn 0.3s ease-in;
    }

    .dashboard-container {
        padding: 1.5rem;
    }

    .order-status-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .delivery-stats {
        grid-template-columns: 1fr;
    }

    .stat-item {
        justify-content: center;
    }

    /* Overlay for mobile sidebar */
    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 280px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        animation: fadeIn 0.3s ease-in;
    }

    /* Smooth slide animation */
    @keyframes slideInLeft {
        from {
            transform: translateX(-100%);
            opacity: 0.8;
        }
        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
        }
        to {
            opacity: 1;
        }
    }
}

/* Tablet (768px to 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .search-box {
        max-width: 300px;
    }

    .user-name {
        display: none;
    }

    .kpi-card {
        padding: 1.25rem;
    }

    .kpi-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .kpi-value {
        font-size: 1.5rem;
    }
}

/* Mobile (767px and down) */
@media (max-width: 767px) {
    .header {
        padding: 0 1rem;
        position: sticky;
        top: 0;
        z-index: 998;
    }

    .search-box {
        display: none;
    }

    .header-right {
        gap: 0.75rem;
    }

    .filter-group {
        display: none;
    }

    .user-name {
        display: none;
    }

    .user-profile img {
        width: 35px;
        height: 35px;
    }

    .dashboard-container {
        padding: 1rem;
        padding-top: 1.5rem;
    }

    /* Smooth sidebar animations */
    .sidebar {
        will-change: transform;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.active {
        animation: slideInFromLeft 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }

    /* Hamburger menu animation */
    .btn-toggle-sidebar {
        position: relative;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        transition: all 0.3s ease;
    }

    .btn-toggle-sidebar:active {
        transform: scale(0.95);
        background: rgba(248, 203, 70, 0.1);
    }

    /* Sidebar overlay backdrop */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        animation: fadeIn 0.3s ease;
    }

    @keyframes slideInFromLeft {
        from {
            transform: translateX(-100%);
        }
        to {
            transform: translateX(0);
        }
    }

    .kpi-card {
        padding: 1rem;
    }

    .kpi-icon {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }

    .kpi-value {
        font-size: 1.25rem;
    }

    .kpi-label {
        font-size: 0.75rem;
    }

    .kpi-change {
        font-size: 0.75rem;
    }

    .card-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .order-status-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .status-item {
        padding: 0.75rem;
    }

    .status-icon {
        font-size: 1.5rem;
    }

    .status-count {
        font-size: 1.25rem;
    }

    .recent-orders h6 {
        font-size: 0.875rem;
    }

    .order-item {
        padding: 0.625rem;
    }

    .inventory-summary {
        flex-direction: column;
        gap: 1rem;
    }

    .summary-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .summary-label,
    .summary-value {
        display: inline;
    }

    .product-item {
        padding: 0.75rem;
    }

    .product-rank {
        font-size: 1rem;
        min-width: 25px;
    }

    .product-image {
        width: 40px;
        height: 40px;
    }

    .delivery-stats {
        gap: 1rem;
    }

    .stat-item {
        padding: 0.75rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stat-content h4 {
        font-size: 1.25rem;
    }

    .region-filters {
        width: 100%;
    }

    .region-filters .btn {
        flex: 1;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }

    #salesMap {
        height: 300px !important;
    }

    .btn-group-sm .btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Small Mobile (575px and down) */
@media (max-width: 575px) {
    .header {
        height: 60px;
    }

    .dashboard-container {
        padding: 0.75rem;
    }

    .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    .kpi-card {
        padding: 0.875rem;
    }

    .kpi-icon {
        width: 40px;
        height: 40px;
        font-size: 1.125rem;
    }

    .kpi-value {
        font-size: 1.125rem;
    }

    .order-status-grid {
        grid-template-columns: 1fr;
    }

    .status-item {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
    }

    .status-icon {
        margin-bottom: 0;
    }

    .product-item {
        flex-wrap: wrap;
    }

    .product-stats {
        width: 100%;
        text-align: left;
        margin-top: 0.5rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .delivery-stats {
        grid-template-columns: 1fr;
    }

    canvas {
        max-height: 250px !important;
    }
}

/* Landscape Mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .sidebar {
        width: 200px;
    }

    .sidebar-nav {
        padding: 0.5rem 0;
    }

    .nav-item {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }

    .nav-item i {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .header,
    .btn,
    .filter-group,
    .region-filters {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .dashboard-container {
        padding: 0;
    }

    .card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .kpi-card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background-color: #1a1a1a;
        color: #e0e0e0;
    }

    body.dark-mode .card,
    body.dark-mode .kpi-card,
    body.dark-mode .header {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    body.dark-mode .card-header {
        border-bottom-color: #404040;
    }

    body.dark-mode .search-box input {
        background: #404040;
        border-color: #555;
        color: #e0e0e0;
    }

    body.dark-mode .order-item,
    body.dark-mode .inventory-item,
    body.dark-mode .product-item {
        border-bottom-color: #404040;
    }

    body.dark-mode .order-item:hover,
    body.dark-mode .inventory-item:hover,
    body.dark-mode .product-item:hover {
        background: #404040;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .pulse {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .kpi-card,
    .card {
        border: 2px solid currentColor;
    }

    .btn-outline-primary,
    .btn-outline-secondary {
        border-width: 2px;
    }
}

/* Focus Visible for Keyboard Navigation */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Made with Bob */
