/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 56px;
    --mobile-nav-height: 64px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-info { color: var(--info-color); }

/* Touch-friendly base styles */
button, a, input, select, textarea {
    -webkit-touch-callout: none;
}

/* Prevent text selection on interactive elements */
button, .nav-link, .mobile-nav-item {
    -webkit-user-select: none;
    user-select: none;
}

/* ==================== LOGIN PAGE (Mobile-First) ==================== */
.page {
    min-height: 100vh;
    min-height: 100dvh;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    padding: 16px;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.login-box {
    background: var(--card-bg);
    padding: 32px 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo i {
    font-size: 40px;
    color: var(--primary-color);
    margin-bottom: 12px;
    display: block;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ==================== DASHBOARD LAYOUT ==================== */
#dashboard-page {
    display: flex;
    flex-direction: column;
}

/* ==================== SIDEBAR (Mobile: Off-canvas) ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    height: 100vh;
    height: 100dvh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-100%);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    min-height: 56px;
}

.sidebar-header i {
    font-size: 24px;
    color: var(--primary-color);
    min-width: 28px;
    text-align: center;
}

.sidebar-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    -webkit-overflow-scrolling: touch;
}

.nav-section {
    margin-bottom: 16px;
}

.nav-title {
    padding: 0 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sidebar.collapsed .nav-title {
    display: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    min-height: 48px;
}

.nav-link:hover {
    background: #f9fafb;
    color: var(--primary-color);
}

.nav-link.active {
    background: #eef2ff;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.nav-link i {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.sidebar.collapsed .nav-link span {
    display: none;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-info span {
    font-weight: 600;
    font-size: 14px;
}

.user-info small {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar.collapsed .user-info {
    display: none;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar.open ~ .sidebar-overlay,
.sidebar.open + .sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

/* ==================== MOBILE BOTTOM NAVIGATION ==================== */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    padding-bottom: var(--safe-area-bottom);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    height: var(--mobile-nav-height);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    padding: 8px 4px;
    border: none;
    background: none;
    cursor: pointer;
    transition: color 0.2s;
    min-height: 48px;
}

.mobile-nav-item i {
    font-size: 20px;
    transition: transform 0.2s;
}

.mobile-nav-item:active i {
    transform: scale(0.9);
}

.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-item.active i {
    color: var(--primary-color);
}

/* Mobile More Menu */
.mobile-more-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 250;
}

.mobile-more-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
}

.mobile-more-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: var(--safe-area-bottom);
}

.mobile-more-menu:not(.hidden) .mobile-more-content {
    transform: translateY(0);
}

.mobile-more-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 16px;
}

.mobile-more-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-more-items {
    padding: 8px 0;
}

.mobile-more-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    transition: background 0.2s;
    min-height: 48px;
}

.mobile-more-item:active {
    background: var(--bg-color);
}

.mobile-more-item i {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.mobile-more-item.active {
    color: var(--primary-color);
    background: #eef2ff;
}

.mobile-more-item.active i {
    color: var(--primary-color);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: var(--mobile-nav-height);
    padding-bottom: calc(var(--mobile-nav-height) + var(--safe-area-bottom));
}

/* ==================== HEADER ==================== */
.header {
    height: var(--header-height);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    padding: 0 16px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px;
    margin-right: 12px;
    border-radius: 8px;
    transition: all 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-actions #current-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ==================== CONTENT ==================== */
.content {
    padding: 16px;
}

.page-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== STATS GRID ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.users { background: #dbeafe; color: var(--info-color); }
.stat-icon.orders { background: #fef3c7; color: var(--warning-color); }
.stat-icon.products { background: #d1fae5; color: var(--success-color); }
.stat-icon.revenue { background: #fce7f3; color: #ec4899; }

.stat-info h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ==================== CARDS ==================== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-header a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 12px;
}

.card-body {
    padding: 16px;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    min-height: 44px;
    -webkit-appearance: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 36px;
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    min-width: 44px;
    min-height: 44px;
}

.btn-icon:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-group input.error,
.form-group select.error {
    border-color: var(--danger-color);
}

/* Prevent zoom on input focus on iOS */
@media (max-width: 768px) {
    .form-group input:not([type="checkbox"]),
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }
}

/* Form group label with checkbox inline */
.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 400;
}

.password-input {
    position: relative;
}

.password-input input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-message {
    color: var(--danger-color);
    font-size: 14px;
    margin-top: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* ==================== TABLES ==================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px;
    padding: 0 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    white-space: nowrap;
}

.data-table th {
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: #f9fafb;
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.data-table img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
}

/* ==================== STATUS BADGES ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

/* ==================== PAGINATION ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
    min-height: 40px;
    font-size: 14px;
}

.pagination button:hover:not(:disabled) {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== TOOLBAR ==================== */
.table-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 100%;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 0;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: var(--safe-area-bottom);
}

.modal-small { max-width: 100%; }
.modal-medium { max-width: 100%; }
.modal-large { max-width: 100%; }

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 16px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== TOAST NOTIFICATIONS ==================== */
#toast-container {
    position: fixed;
    top: 12px;
    right: 12px;
    left: 12px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
}

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.warning {
    border-left: 4px solid var(--warning-color);
}

.toast.info {
    border-left: 4px solid var(--info-color);
}

.toast-icon {
    font-size: 18px;
}

.toast.success .toast-icon { color: var(--success-color); }
.toast.error .toast-icon { color: var(--danger-color); }
.toast.warning .toast-icon { color: var(--warning-color); }
.toast.info .toast-icon { color: var(--info-color); }

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 14px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== LOADING SPINNER ==================== */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--border-color);
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==================== RATING STARS ==================== */
.rating {
    display: flex;
    gap: 2px;
}

.rating .fas.fa-star {
    color: #fbbf24;
    font-size: 14px;
}

.rating .far.fa-star {
    color: #d1d5db;
    font-size: 14px;
}

/* ==================== DASHBOARD SECTIONS ==================== */
.dashboard-sections {
    display: grid;
    gap: 16px;
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    padding: 14px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 48px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    margin-top: 12px;
}

/* ==================== CHECKBOX STYLES ==================== */

/* Custom checkbox base styling for all checkboxes */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkbox list container */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
}

.checkbox-item:hover {
    background: var(--bg-color);
    border-radius: 6px;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* ==================== FORM CONTROL SMALL ==================== */
.form-control-sm {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    min-height: 40px;
    -webkit-appearance: none;
}

/* ==================== SEARCHABLE SELECT ==================== */
.searchable-select {
    position: relative;
}

.searchable-select-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0 0 8px 8px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    -webkit-overflow-scrolling: touch;
}

.searchable-select-option {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 14px;
    min-height: 44px;
}

.searchable-select-option:active {
    background: var(--bg-color);
}

.searchable-select-option.selected {
    background: var(--primary-color);
    color: white;
}

/* ==================== PRICING TIERS ==================== */
.pricing-section {
    margin-top: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.pricing-section h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 16px;
}

.pricing-section .help-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.tier-header {
    display: none;
}

.pricing-tier-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
}

.pricing-tier-row:last-child {
    margin-bottom: 0;
}

.pricing-tier-row input[type="text"],
.pricing-tier-row input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
}

.tier-name-input { width: 100%; }
.tier-multiplier-input { width: 100%; }
.tier-total-units { 
    font-weight: 500;
    padding: 10px 0;
    font-size: 14px;
}
.tier-discount-input { width: 100%; }
.tier-price-display { 
    text-align: left;
    padding: 10px 0;
    font-size: 14px;
}
.tier-actions { 
    text-align: right;
}

.tier-unit-price {
    font-weight: 600;
    color: var(--success-color);
}

.tier-unit-price.discounted {
    color: var(--primary-color);
}

.text-muted {
    color: var(--text-secondary);
    font-size: 12px;
}

/* ==================== STORE DETAILS ==================== */
.store-details p,
.order-details p,
.invoice-details p {
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.store-details p strong,
.order-details p strong,
.invoice-details p strong {
    min-width: 120px;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Tablets and up (768px+) */
@media (min-width: 768px) {
    .login-container {
        padding: 24px;
    }

    .login-box {
        padding: 40px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .content {
        padding: 24px;
    }

    .card-header {
        padding: 20px 24px;
    }

    .card-body {
        padding: 24px;
    }

    .table-toolbar {
        flex-wrap: nowrap;
        gap: 16px;
    }

    .search-box {
        min-width: 200px;
        max-width: 300px;
        flex: 0 0 auto;
    }

    .modal {
        align-items: center;
        padding: 24px;
    }

    .modal-content {
        border-radius: 16px;
        max-width: 500px;
    }

    .modal-small {
        max-width: 400px;
    }

    .modal-medium {
        max-width: 600px;
    }

    .modal-large {
        max-width: 800px;
    }

    #toast-container {
        left: auto;
        right: 24px;
        max-width: 400px;
    }

    .pricing-tier-row {
        flex-direction: row;
        align-items: center;
        border-radius: 0;
        margin-bottom: 0;
        border-top: none;
    }

    .pricing-tier-row:first-child {
        border-radius: 8px 8px 0 0;
        border-top: 1px solid var(--border-color);
    }

    .pricing-tier-row:last-child {
        border-radius: 0 0 8px 8px;
    }

    .tier-header {
        display: flex;
        gap: 10px;
        padding: 10px 14px;
        background: #e2e8f0;
        border-radius: 8px 8px 0 0;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-secondary);
    }

    .tier-col {
        flex: 1;
        text-align: center;
    }

    .tier-col:first-child {
        flex: 1.5;
        text-align: left;
    }

    .tier-name-input { flex: 1.5; }
    .tier-multiplier-input { flex: 1; }
    .tier-total-units { flex: 1; text-align: center; }
    .tier-discount-input { flex: 1; }
    .tier-price-display { flex: 1; text-align: center; }
    .tier-actions { flex: 0 0 40px; text-align: right; }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .stat-card {
        flex-direction: row;
        align-items: center;
    }

    .mobile-nav {
        display: none !important;
    }

    .main-content {
        padding-bottom: 0;
    }

    .sidebar {
        transform: translateX(0);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none !important;
    }

    .header {
        padding: 0 24px;
    }

    #dashboard-page {
        display: flex;
        flex-direction: row;
    }

    .main-content {
        margin-left: var(--sidebar-width);
        transition: margin-left 0.3s ease;
    }

    .sidebar.collapsed + .sidebar-overlay + .main-content,
    .sidebar.collapsed ~ .main-content {
        margin-left: var(--sidebar-collapsed);
    }

    .modal {
        align-items: center;
        padding: 24px;
    }

    .modal-content {
        border-radius: 16px;
        max-height: 85vh;
    }
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    .content {
        padding: 24px 32px;
    }

    .sidebar {
        width: 280px;
    }

    .main-content {
        margin-left: 280px;
    }
}

/* Small mobile adjustments (max-width: 360px) */
@media (max-width: 360px) {
    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .stat-info h3 {
        font-size: 18px;
    }

    .stat-info p {
        font-size: 12px;
    }

    .login-box {
        padding: 24px 20px;
    }

    .header-title {
        font-size: 15px;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .header,
    .btn,
    .mobile-nav,
    .mobile-more-menu,
    .sidebar-toggle {
        display: none !important;
    }

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

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* High contrast / accessibility */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --text-secondary: #333;
    }

    .badge {
        border: 1px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
    /* Can be expanded later */
}
