/* ============================================
   PHARMACY ASA - CUSTOM STYLES
   ============================================ */

/* ---- GLOBAL STYLES ---- */
:root {
    /* Primary Brand Colors */
    --primary-color: #2C5B73;        /* Dark teal-blue for brand name, headings, buttons */
    --primary-hover: #1c3643;        /* Darker teal for hover states */
    --accent-color: #F4973F;          /* Vibrant orange for accents, icons, CTAs */
    --accent-hover: #ffd6a0;         /* Light orange for hover states */
    --dark-blue: #182335;            /* Very dark blue for text and backgrounds */
    
    /* Secondary Brand Colors */
    --secondary-teal: #5b9aa0;       /* Muted teal */
    --secondary-grey: #708090;       /* Medium blue-grey */
    --light-grey: #e0e6ea;           /* Very light grey */
    --cream: #f5efe6;                /* Cream/beige */
    --peach: #ffd6a0;                /* Light peach */
    
    /* System Colors */
    --success-color: #4CAF50;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    
    /* Background & Text Colors */
    --light-bg: #f5efe6;             /* Using cream as light background */
    --border-color: #e0e6ea;         /* Light grey for borders */
    --text-muted: #708090;           /* Medium grey for muted text */
    --text-dark: #182335;            /* Dark blue for main text */
    
    /* Shadows */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    
    /* Sidebar Colors */
    --sidebar-bg: #182335;            /* Dark blue for sidebar */
    --sidebar-hover: #2C5B73;        /* Primary color for hover */
    --sidebar-active: #5b9aa0;       /* Secondary teal for active */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

html {
    overflow-x: hidden;
    width: 100%;
}

/* ---- APP WRAPPER ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ---- SIDEBAR STYLES ---- */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 1040;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Mobile overlay backdrop */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1030;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo i {
    font-size: 1.75rem;
    color: #4CAF50;
}

.sidebar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-user {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.user-avatar {
    position: relative;
}

.user-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #4CAF50;
}

.user-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #4CAF50;
    border: 2px solid var(--sidebar-bg);
    border-radius: 50%;
}

.user-info {
    flex: 1;
}

.user-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.875rem;
    color: #9ca3af;
}

.user-menu-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.user-menu-btn:hover {
    color: #fff;
}

.sidebar-nav {
    padding: 1rem 0;
}

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

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: #9ca3af;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.nav-link.active {
    background-color: var(--sidebar-active);
    color: #fff;
    border-left: 3px solid #0d6efd;
}

.nav-link i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
}

/* Sidebar submenu styles */
.nav-link .fa-chevron-down {
    font-size: 0.875rem;
    transition: transform 0.3s ease;
}

.nav-link[aria-expanded="true"] .fa-chevron-down {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.2);
}

.nav-submenu .nav-item {
    margin-bottom: 0;
}

.nav-submenu .nav-link {
    padding: 0.75rem 1.5rem 0.75rem 3.5rem;
    font-size: 0.9375rem;
}

.nav-submenu .nav-link i {
    font-size: 0.9375rem;
}

.nav-submenu .nav-link:hover {
    background-color: rgba(92, 154, 160, 0.3);
}

.nav-submenu .nav-link.active {
    background-color: var(--sidebar-active);
    border-left: 3px solid #0d6efd;
}

.badge-danger {
    background-color: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    margin-left: auto;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: #9ca3af;
}

.sidebar-footer p {
    margin: 0;
    font-size: 0.875rem;
}

.sidebar-footer small {
    font-size: 0.75rem;
    color: #6c757d;
}

/* ---- MAIN WRAPPER ---- */
.main-wrapper {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: calc(100vw - 280px);
    overflow-x: hidden;
}

@media (max-width: 1024px) {
    .main-wrapper {
        max-width: 100vw;
    }
}

/* ---- HEADER STYLES ---- */
.main-header {
    background-color: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 999;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #495057;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    display: none; /* Hidden by default on desktop */
}

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

/* Show hamburger menu on tablets and below */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: block;
    }
}


.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.language-selector {
    position: relative;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.header-greeting {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.greeting-icon {
    width: 48px;
    height: 48px;
    background-color: var(--peach);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.greeting-icon i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.greeting-text h6 {
    margin: 0;
    font-weight: 600;
    font-size: 0.9375rem;
}

.greeting-text small {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* ---- MAIN CONTENT ---- */
.main-content {
    flex: 1;
    background-color: var(--light-bg);
}

/* Add horizontal padding to main content for consistency */
.main-wrapper .main-content {
    padding-left: 2rem;
    padding-right: 2rem;
    padding-top: 2rem;
}

/* Ensure container-fluid inherits proper horizontal padding */
.main-content .container-fluid {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* For container (not fluid), ensure proper padding */
.main-content .container {
    padding-left: 2rem;
    padding-right: 2rem;
}

/* ---- DASHBOARD CONTENT ---- */
.dashboard-content {
    position: relative;
    padding: 2rem;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.dashboard-actions {
    position: absolute;
    top: 0;
    right: 0;
}

.btn-download {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #fff;
    border: 1px solid var(--border-color);
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-download:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ---- METRICS GRID ---- */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

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

.metric-card-success .metric-icon {
    background-color: #e8f5e9;
    color: var(--success-color);
}

.metric-card-revenue {
    border-left: 4px solid var(--accent-color);
}

.metric-card-revenue .metric-icon {
    background-color: var(--peach);
    color: var(--accent-color);
}

.metric-card-available {
    border-left: 4px solid var(--primary-color);
}

.metric-card-available .metric-icon {
    background-color: var(--light-grey);
    color: var(--primary-color);
}

.metric-card-shortage {
    border-left: 4px solid var(--danger-color);
}

.metric-card-shortage .metric-icon {
    background-color: #ffebee;
    color: var(--danger-color);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.metric-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.metric-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.metric-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.metric-link:hover {
    gap: 0.75rem;
}

/* ---- DASHBOARD WIDGETS ---- */
.dashboard-widgets {
    margin-top: 2rem;
}

.dashboard-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Side by side on large screens (1600px+) */
@media (min-width: 1600px) {
    .dashboard-row {
        grid-template-columns: 3fr 2fr;
    }
}

.dashboard-col-left,
.dashboard-col-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0; /* Prevent grid blowout */
    overflow: hidden;
}

.widget-card {
    background-color: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    overflow: hidden; /* Contain content */
    min-width: 0; /* Prevent grid blowout */
}

.widget-card .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-header h5 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.widget-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.widget-link:hover {
    gap: 0.75rem;
}

.widget-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.stat-item h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-item p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.875rem;
}

/* ---- FORM STYLES ---- */
.form-control,
.form-select {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 0.625rem 0.875rem;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-select-sm {
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
}

/* ---- DROPDOWN STYLES ---- */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-md);
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.625rem 1rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background-color: var(--light-bg);
}

.dropdown-item i {
    margin-right: 0.5rem;
    width: 20px;
}

.dropdown-menu-dark {
    background-color: var(--sidebar-bg);
}

.dropdown-menu-dark .dropdown-item {
    color: #9ca3af;
}

.dropdown-menu-dark .dropdown-item:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

/* ---- RESPONSIVE STYLES ---- */

/* Large Tablets and Below (1200px) */
@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar {
        width: 250px;
    }
    
    .main-wrapper {
        margin-left: 250px;
    }
}

/* Tablets and Below (992px) */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    
    /* Dashboard table badges - tablet */
    .dashboard-tables .badge,
    .widget-card .badge {
        min-width: 90px;
        width: 90px;
    }
    
    .main-header {
        padding: 1rem 1.5rem;
    }
    
    /* Make tables scroll horizontally */
    .table-responsive {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    .table {
        min-width: 600px;
    }
    
    /* Adjust button groups */
    .btn-group {
        flex-wrap: wrap;
    }
}

/* Mobile Landscape and Small Tablets (768px) */
@media (max-width: 768px) {
    .sidebar {
        width: 280px;
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .main-wrapper .main-content {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-top: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .dashboard-content {
        padding: 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    .main-content .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    .main-content .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        max-width: 100%;
        width: 100%;
    }
    
    /* Make tables responsive */
    .table-responsive {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        max-width: 100%;
        position: relative;
    }
    
    .table {
        width: 100%;
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .header-left {
        flex: 1;
    }
    
    
    .header-greeting {
        display: none;
    }
    
    .widget-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .dashboard-actions {
        position: static;
        margin-bottom: 1rem;
    }
    
    /* Card adjustments */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-header {
        padding: 0.875rem 1rem;
    }
    
    /* Widget adjustments */
    .widget-card {
        padding: 1rem;
    }
    
    .table-responsive {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .widget-header {
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
    }
    
    .widget-header h5 {
        font-size: 1rem;
    }
    
    /* Table adjustments */
    .table {
        font-size: 0.875rem;
    }
    
    .table thead th {
        font-size: 0.75rem;
        padding: 0.875rem 0.625rem;
    }
    
    .table tbody td {
        padding: 0.875rem 0.625rem;
    }
    
    /* Button adjustments */
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Form adjustments */
    .form-control,
    .form-select {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Pagination adjustments */
    .pagination {
        font-size: 0.875rem;
    }
    
    .page-link {
        padding: 0.375rem 0.75rem;
    }
}

/* Mobile Portrait (576px) */
@media (max-width: 576px) {
    .main-wrapper {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .main-wrapper .main-content {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        padding-top: 1rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .dashboard-content {
        padding: 0.5rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .main-content .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    .main-content .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    .widget-card {
        padding: 0.75rem 0 !important;
        overflow: visible;
    }
    
    .widget-header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .table-responsive {
        display: block;
        width: 100%;
        max-width: 100vw;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .main-header {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    
    .header-left {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .header-right {
        width: 100%;
        justify-content: flex-end;
    }
    
    
    .language-selector {
        display: none;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-user {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
    }
    
    .user-menu-btn {
        margin-top: 0.5rem;
    }
    
    /* Dashboard header */
    .dashboard-header h2 {
        font-size: 1.5rem;
    }
    
    /* Metrics */
    .metric-card {
        padding: 1rem;
    }
    
    .metric-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    
    .metric-content h3 {
        font-size: 1.5rem;
    }
    
    .metric-content p {
        font-size: 0.875rem;
    }
    
    /* Auth pages */
    .auth-container {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
    
    .auth-logo {
        max-width: 100px;
    }
    
    .brand-title {
        font-size: 1.5rem;
    }
    
    /* OTP inputs */
    .otp-inputs {
        gap: 0.5rem;
    }
    
    .otp-input {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    /* Buttons full width on mobile */
    .d-grid {
        gap: 0.75rem !important;
    }
    
    /* Hide text in some buttons, show only icons */
    .btn-group .btn span {
        display: none;
    }
    
    .btn-group .btn i {
        margin: 0;
    }
    
    /* Stack filter controls */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .filter-left,
    .filter-right {
        flex-direction: column;
        width: 100%;
    }
    
    /* Page title adjustments */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }
    
    .d-flex.justify-content-between > *:last-child {
        width: 100%;
    }
    
    .d-flex.justify-content-between .btn {
        width: 100%;
    }
    
    /* Already handled above in main-content rules */
    
    /* Reports page responsive */
    .col-md-4 .dropdown .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Actions row for ready-to-print */
    .actions-row {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }
    
    .actions-row h2 {
        font-size: 1.25rem;
    }
    
    .actions-row .btn {
        width: 100%;
    }
    
    /* Responsive tabs */
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-tabs .nav-link {
        white-space: nowrap;
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Sticky action bar */
    .sticky-bottom .card-body {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .sticky-bottom .btn {
        width: 100%;
    }
}

/* Mobile Phones (430px - iPhone 14 Pro Max and similar) */
@media (max-width: 430px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    .app-wrapper {
        overflow-x: hidden;
        max-width: 100vw;
        width: 100%;
    }
    
    .main-wrapper {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .main-wrapper .main-content {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .dashboard-content {
        padding: 0.5rem;
        width: 100%;
        max-width: 100%;
    }
    
    .widget-card {
        width: 100%;
        max-width: 100%;
        overflow: visible; /* Allow table scrolling */
        padding: 0.75rem;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        overflow: hidden;
    }
    
    .card-body {
        padding: 0.75rem 0.5rem;
        overflow-x: visible;
    }
    
    .widget-card {
        padding: 0.75rem 0 !important; /* Remove horizontal padding to allow full-width scroll */
    }
    
    .widget-header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .table-responsive {
        display: block;
        width: 100%;
        max-width: 100vw; /* Allow full viewport width */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        position: relative;
    }
    
    /* Add scroll indicator shadow */
    .table-responsive::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, rgba(0,0,0,0.15), transparent);
        pointer-events: none;
        z-index: 1;
    }
    
    .table {
        font-size: 0.75rem;
        min-width: 600px; /* Force horizontal scroll on mobile */
        margin-bottom: 0;
    }
    
    .table thead th {
        font-size: 0.7rem;
        padding: 0.5rem 0.375rem;
        white-space: nowrap;
    }
    
    .table tbody td {
        padding: 0.5rem 0.375rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .main-header {
        padding: 0.75rem 0.5rem;
    }
    
}

/* Extra Small Mobile (400px) */
@media (max-width: 400px) {
    .main-wrapper {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .main-wrapper .main-content {
        padding-left: 0.375rem;
        padding-right: 0.375rem;
        width: 100%;
        max-width: 100%;
    }
    
    .dashboard-content {
        padding: 0.375rem;
    }
    
    .widget-card {
        padding: 0.75rem 0 !important;
        overflow: visible;
    }
    
    .card {
        width: 100%;
        max-width: 100%;
        overflow: visible;
    }
    
    .card-body {
        padding: 0.75rem;
        width: 100%;
        overflow-x: visible;
    }
    
    .table-responsive {
        display: block;
        width: 100%;
        max-width: 100vw;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .sidebar {
        width: 100%;
        max-width: 280px;
    }
    
    .otp-input {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .otp-inputs {
        gap: 0.375rem;
    }
    
    .table {
        font-size: 0.75rem;
        width: 100%;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem 0.375rem;
        white-space: nowrap;
    }
    
    .badge {
        font-size: 0.625rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Dashboard table badges - responsive */
    .dashboard-tables .badge,
    .widget-card .badge {
        min-width: 80px;
        width: 80px;
        font-size: 0.625rem;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 0.5rem;
    }
}

/* ---- TABLET SPECIFIC ADJUSTMENTS (601px - 768px) ---- */
/* Tablet and below - hide sidebar by default */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

/* ---- LANDSCAPE ORIENTATION ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        font-size: 0.875rem;
    }
    
    .sidebar-header,
    .sidebar-user {
        padding: 0.75rem;
    }
    
    .nav-link {
        padding: 0.5rem 1rem;
    }
    
    .main-header {
        padding: 0.75rem 1.5rem;
    }
}

/* ---- OLD NAVBAR STYLES (for other pages) ---- */
.navbar {
    padding: 1rem 0;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark) !important;
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

/* ---- NAVBAR DROPDOWN STYLES ---- */
.navbar .nav-item.dropdown .dropdown-toggle {
    cursor: pointer;
}

.navbar .nav-item.dropdown .dropdown-toggle::after {
    margin-left: 0.3rem;
    vertical-align: 0.15em;
}

.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0;
}

.navbar .dropdown-item {
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar .dropdown-item:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
    padding-left: 1.5rem;
}

.navbar .dropdown-item:active {
    background-color: var(--primary-color);
    color: #fff;
}

.navbar .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Active state for dropdown parent */
.navbar .nav-item.dropdown .nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 500;
}

/* ---- FOOTER STYLES ---- */
.footer {
    margin-top: auto;
    padding: 2rem 0;
}

/* ---- CARD STYLES (for other pages) ---- */
.card {
    border: none;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md) !important;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    background-color: #fff;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

/* ---- TABLE STYLES ---- */
/* Make tables responsive and scrollable */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
    width: 100%;
    min-width: 600px; /* Ensure table has minimum width to trigger scroll on mobile */
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ---- PRODUCTS TABLE SPECIFIC STYLES ---- */
#productsTable {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

#productsTable thead {
    background-color: #f8f9fa;
}

#productsTable tbody tr.hidden {
    display: none !important;
}

#productsTable .btn-group {
    gap: 0.25rem;
}

#productsTable .btn-group .btn {
    margin: 0;
}

#productsTable .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Product name styling */
#productsTable tbody td:first-child strong {
    font-weight: 600 !important;
    font-size: 0.95rem;
}

/* Badge styling */
#productsTable .badge {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    font-weight: 500;
}

/* Category badge styling */
#productsTable tbody td:nth-child(2) .badge {
    font-weight: 400;
}

/* ---- BUTTON STYLES ---- */
.btn {
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

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

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

.btn-outline-primary:hover {
    transform: translateY(-1px);
}

/* ---- BADGE STYLES ---- */
.badge {
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    border-radius: 0.25rem;
}

/* Dashboard table badges - consistent width */
.dashboard-tables .badge,
.widget-card .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    width: 100px;
    text-align: center;
    white-space: nowrap;
}

/* ---- AUTH PAGES ---- */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--dark-blue) 50%, var(--accent-color) 100%);
    padding: 2rem 0;
}

.auth-card {
    background: white;
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
}

.auth-logo {
    max-width: 150px;
    height: auto;
}

.brand-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ---- OTP INPUT STYLES ---- */
.otp-inputs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.otp-input {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.otp-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease-out;
}

/* ---- UTILITY CLASSES ---- */
.text-primary {
    color: var(--primary-color) !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.hidden {
    display: none !important;
}

/* ---- CUSTOM SCROLLBAR ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ---- LOGO STYLES ---- */
.sidebar-logo-img {
    width: 130px;
    height: 48px;
    object-fit: contain;
}

.navbar-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    margin-right: 0.5rem;
}

/* ---- NAVIGATION BADGE STYLES ---- */
.nav-badge {
    background-color: #dc3545;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    min-width: 1.5rem;
    text-align: center;
    line-height: 1;
    display: inline-block;
    animation: pulse 2s infinite;
}

.nav-badge:empty {
    display: none;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* ---- PRINT STYLES ---- */
@media print {
    body {
        background-color: white;
    }
    
    .sidebar,
    .main-header,
    .footer,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}
