/* Mobile Responsive Styles */

/* Mobile Hamburger Menu */
.mobile-menu-btn {
    display: none;
    width: 48px;
    height: 48px;
    background: white;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.1s ease;
    margin-right: 8px;
    z-index: 1001;
    position: relative;
    pointer-events: all !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-menu-btn:hover {
    background: var(--gray-50);
}

.mobile-menu-btn:active {
    background: var(--gray-100);
    transform: scale(0.95);
}

.mobile-menu-btn svg {
    width: 28px;
    height: 28px;
    fill: var(--gray-700);
    pointer-events: none;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1499;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile breakpoint: 768px */
@media (max-width: 768px) {
    /* Header Adjustments */
    .main-header {
        padding: 0 10px;
        height: 60px;
    }

    /* Show hamburger menu on mobile */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        outline: none;
        user-select: none;
    }

    .mobile-menu-btn:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }

    /* Hide logo text on mobile, keep icon */
    .logo span {
        display: none;
    }

    .logo {
        margin-left: 0;
    }

    .logo svg {
        width: 28px;
        height: 28px;
    }

    /* Adjust header layout */
    .header-left {
        flex: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .header-right {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }

    /* Hide user name on mobile */
    .user-info .user-name {
        display: none;
    }

    /* Language switcher adjustments */
    .language-switcher {
        padding: 3px;
    }

    .lang-btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* Sidebar becomes fullscreen overlay on mobile */
    .sidebar {
        position: fixed !important;
        left: -100% !important;
        top: 0 !important;
        bottom: 0 !important;
        right: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        transition: left 0.3s ease;
        z-index: 1500;
        background: #1a1d2e !important;
        box-shadow: none;
        overflow-y: auto;
        transform: none !important;
    }

    /* Custom scrollbar for dark theme */
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

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

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

    .sidebar.active {
        left: 0 !important;
    }

    /* Mobile close button for sidebar */
    .sidebar-close-btn {
        display: block;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        cursor: pointer;
        z-index: 10;
        padding: 10px;
        border-radius: 50%;
        transition: all 0.2s;
        backdrop-filter: blur(10px);
    }

    .sidebar-close-btn:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.05);
    }

    .sidebar-close-btn:active {
        transform: scale(0.95);
    }

    .sidebar-close-btn svg {
        width: 24px;
        height: 24px;
        fill: white;
    }

    /* Add header area to sidebar on mobile */
    .sidebar::before {
        content: 'Navigation';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        font-size: 22px;
        font-weight: 600;
        display: flex;
        align-items: center;
        padding: 0 20px;
        z-index: 5;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }

    /* Sidebar content adjustments */
    .sidebar-nav {
        padding: 85px 15px 20px 15px;
        background: transparent;
    }

    .sidebar-nav ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .sidebar-nav li {
        margin-bottom: 4px;
    }

    .sidebar-nav a {
        display: flex !important;
        align-items: center;
        padding: 14px 18px;
        color: #e0e0e0 !important;
        text-decoration: none;
        border-radius: 12px;
        transition: all 0.3s ease;
        font-size: 16px;
        gap: 14px;
        justify-content: flex-start !important;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        position: relative;
        overflow: hidden;
    }

    /* Add subtle gradient overlay on hover */
    .sidebar-nav a::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        transition: left 0.5s ease;
    }

    /* IMPORTANT: Always show text spans on mobile, even if sidebar has collapsed class */
    .sidebar-nav span,
    .sidebar.collapsed .sidebar-nav span {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #e0e0e0 !important;
        font-weight: 500;
    }

    .sidebar-nav a:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        color: white !important;
        transform: translateX(5px);
        border-color: rgba(255, 255, 255, 0.2);
    }

    .sidebar-nav a:hover::before {
        left: 100%;
    }

    .sidebar-nav a:hover span {
        color: white !important;
    }

    .sidebar-nav a.active,
    .sidebar-nav li.active a {
        background: linear-gradient(135deg, #667eea, #764ba2) !important;
        color: white !important;
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }

    .sidebar-nav a.active span,
    .sidebar-nav li.active a span {
        color: white !important;
        font-weight: 600;
    }

    .sidebar-nav svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
        fill: currentColor !important;
    }

    /* Remove desktop dividers on mobile */
    .sidebar-nav li::after {
        display: none !important;
    }

    /* Hide desktop sidebar toggle button on mobile */
    .sidebar-toggle {
        display: none;
    }

    /* Main content adjustments */
    .main-container {
        margin-left: 0;
        padding-top: var(--header-height);
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    /* Table responsiveness */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .orders-table {
        min-width: 600px;
    }

    /* Stats grid responsiveness */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Filters grid responsiveness */
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Search box responsiveness */
    .search-box {
        width: 100%;
        max-width: none;
    }

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

    .modal-header {
        padding: 15px;
    }

    .modal-body {
        padding: 15px;
        max-height: calc(100vh - 120px);
    }

    /* Form adjustments */
    .form-group {
        margin-bottom: 15px;
    }

    /* Button adjustments */
    .btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Smaller mobile breakpoint: 480px */
@media (max-width: 480px) {
    /* Even more compact header */
    .main-header {
        padding: 0 10px;
    }

    /* Language buttons even smaller */
    .lang-btn {
        padding: 3px 6px;
        font-size: 11px;
    }

    /* Hide user avatar on very small screens */
    .user-info {
        display: none;
    }

    /* Full width sidebar on small screens */
    .sidebar {
        width: 100%;
        max-width: 100%;
    }

    /* Stats cards stack */
    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 24px;
    }

    /* Table font size adjustments */
    .orders-table {
        font-size: 12px;
    }

    .orders-table th,
    .orders-table td {
        padding: 8px 5px;
    }

    /* Pagination adjustments */
    .pagination {
        font-size: 12px;
    }

    .page-btn {
        width: 32px;
        height: 32px;
    }
}

/* Login Page Responsive Styles */
@media (max-width: 768px) {
    .login-container {
        padding: 20px;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Position language switcher better on mobile */
    .login-container .language-switcher {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        z-index: 100;
    }

    .login-box {
        width: 100%;
        max-width: 400px;
        padding: 0;
        margin: 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .login-header {
        padding: 30px 20px 20px;
    }

    .login-logo {
        margin-bottom: 15px;
    }

    .login-logo svg {
        width: 42px;
        height: 42px;
    }

    .login-title {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .login-subtitle {
        font-size: 14px;
        margin-bottom: 0;
    }

    /* Tab adjustments */
    .login-tabs {
        flex-direction: row;
    }

    .tab-btn {
        padding: 14px 10px;
        font-size: 13px;
    }

    .tab-btn svg {
        width: 18px;
        height: 18px;
    }

    .tab-btn span {
        display: inline;
    }

    /* Form adjustments */
    .login-form {
        padding: 25px 20px;
    }

    .login-form .form-group {
        margin-bottom: 18px;
    }

    .login-form label {
        font-size: 13px;
        margin-bottom: 6px;
        font-weight: 500;
    }

    .login-form input {
        padding: 10px 12px;
        font-size: 14px;
        height: 42px;
        width: 100%;
        border-radius: 6px;
    }

    .login-form .btn-login,
    .login-form .btn-scan {
        padding: 12px;
        font-size: 15px;
        height: 44px;
        margin-top: 20px;
        width: 100%;
        border-radius: 6px;
    }

    /* QR Scanner adjustments */
    .qr-preview {
        height: 250px;
    }

    .manual-qr-section {
        margin-top: 1.5rem !important;
        padding: 15px !important;
    }

    .login-footer {
        margin-top: 25px;
        font-size: 12px;
    }

    .error-message {
        padding: 10px;
        font-size: 13px;
        margin-bottom: 15px;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .login-container {
        padding: 15px;
    }

    .login-box {
        padding: 25px 15px;
        border-radius: 12px;
    }

    .login-logo svg {
        width: 40px;
        height: 40px;
    }

    .login-title {
        font-size: 20px;
    }

    .login-subtitle {
        font-size: 13px;
    }

    .login-form input {
        padding: 8px 10px;
        height: 40px;
        font-size: 14px;
    }

    .login-form .btn-login {
        height: 42px;
        font-size: 14px;
    }
}

/* Landscape mode adjustments for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .login-container {
        padding: 10px;
    }

    .login-box {
        padding: 20px;
    }

    .login-logo {
        margin-bottom: 15px;
    }

    .login-title {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .login-subtitle {
        margin-bottom: 15px;
    }

    .login-form .form-group {
        margin-bottom: 15px;
    }

    .login-form .btn-login {
        margin-top: 15px;
    }
}