/* Custom CSS for Invoxa - Modern POS Design with Sidebar */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    --sidebar-text: #ffffff;
}

body {
    min-height: 100vh;
    background-color: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow-x: hidden;
}

/* Full-page background for Login / Register (unauthenticated) */
body.auth-background {
    /* Replace auth_bg.jpg with your own image file in static/images/ */
    background-image: url("/static/images/auth_bg.jpg");
    /* Slight dark overlay for better contrast */
    background-color: rgba(0, 0, 0, 0.35);
    background-blend-mode: darken;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

/* Make auth content sit nicely on top of image */
body.auth-background main.container {
    min-height: calc(100vh - 64px); /* navbar height approx */
}

body.auth-background .card {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
}

/* Tighter, focused auth cards */
.auth-login-card {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.auth-register-card {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

/* Sidebar Layout */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: width 0.3s ease, transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    /* Prevent scroll propagation to main content */
    overscroll-behavior: contain;
}

/* Sidebar closed by default on mobile */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    transition: padding 0.3s ease;
    /* Prevent scroll propagation */
    overscroll-behavior: contain;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-header {
    padding: 1.25rem 0.5rem;
    justify-content: center;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    /* color: var(--sidebar-text); */
    text-decoration: none;
    font-weight: 600;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.sidebar-brand i {
    font-size: 1.5rem;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

/* Sidebar logo styling */
.sidebar-logo {
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.sidebar-logo img {
    height: 50px;
    width: auto;
    max-width: 100%;
    display: block;
    /* SVG logo has white background, purple icon + black text, no filter needed */
    /* Logo SVG has white text and colored icon, no filter needed */
}

/* Full logo (shown when expanded) */
.sidebar-logo-full {
    display: flex;
}

/* Icon logo (shown when collapsed) */
.sidebar-logo-icon {
    display: none;
    /* No filter - keep original dark logo color */
}

/* Sidebar collapsed: show icon, hide full logo and brand text */
.sidebar.collapsed .sidebar-logo-full {
    display: none;
}

.sidebar.collapsed .sidebar-logo-icon {
    display: block;
}

.sidebar.collapsed .sidebar-logo {
    margin-right: 0;
}

.sidebar.collapsed .brand-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed .sidebar-toggle .bi-chevron-left {
    transform: rotate(180deg);
}

.sidebar-shop-info {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    /* Prevent scroll propagation */
    overscroll-behavior: contain;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-shop-info {
    padding: 0.5rem;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.shop-name-display {
    color: var(--sidebar-text);
    font-size: 0.9rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
}

.sidebar-content {
    flex: 1;
    padding: 1rem 0;
    overflow: hidden;
    min-height: 0;
    display: flex;
    flex-direction: column;
    /* Prevent scroll propagation */
    overscroll-behavior: contain;
}

.sidebar-nav {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    /* Prevent scroll propagation */
    overscroll-behavior: contain;
}

/* Global Scrollbar Styling (apply same UI to all scrollbars) */
*::-webkit-scrollbar {
    width: 8px;
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.7) rgba(0, 0, 0, 0.1);
}

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

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

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--sidebar-text);
    border-left-color: var(--sidebar-text);
    font-weight: 600;
}

.nav-link i {
    width: 24px;
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

.nav-link span {
    flex: 1;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Submenu Styles */
.has-submenu {
    position: relative;
}

.has-submenu .bi-chevron-down,
.has-submenu .collapse-icon {
    transition: transform 0.3s ease;
    font-size: 0.875rem;
}

.has-submenu[aria-expanded="true"] .bi-chevron-down,
.has-submenu[aria-expanded="true"] .collapse-icon {
    transform: rotate(180deg);
}

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

.submenu-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1.25rem 0.625rem 3.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.submenu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    padding-left: 4rem;
}

.submenu-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--sidebar-text);
    font-weight: 600;
}

/* Header User Dropdown */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#userProfileDropdown {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
    transition: all 0.2s;
    min-width: 150px;
}

#userProfileDropdown:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

#userProfileDropdown:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: #f8f9fa;
}

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

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Sidebar collapsed state - adjust main content */
.sidebar.collapsed ~ .main-content {
    margin-left: 70px;
}

/* Top Header */
.top-header {
    background: white;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.sidebar-toggle-btn:hover {
    color: var(--secondary-color);
    background: var(--light-bg);
    transform: scale(1.05);
}

/* Sidebar collapsed state */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-link span,
.sidebar.collapsed .shop-name-display span,
.sidebar.collapsed .sidebar-shop-info {
    display: none;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0;
}

.sidebar.collapsed .submenu-item {
    padding-left: 1.25rem;
}

/* User avatar in header */
.user-avatar-header {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar-header i {
    font-size: 1.1rem;
}

.user-name-header {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.page-title {
    font-weight: 600;
    color: #333;
}

.shop-badge {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--light-bg);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 1.5rem;
    background: #f5f7fa;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0;
    }
    
    body.sidebar-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    background-color: white;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn:active {
    transform: scale(0.98);
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9998;
}

.loading-overlay.show {
    display: flex;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* Billing Screen Specific Styles */
.billing-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
}

.billing-main {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.billing-left {
    flex: 1;
    min-width: 300px;
}

.billing-right {
    width: 400px;
    min-width: 300px;
}

/* Product Search */
.product-search-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.product-search-input {
    font-size: 1.25rem;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
}

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
}

.search-results.show {
    display: block;
}

.variant-list {
    margin-top: 0.5rem;
    border-top: 1px solid #f1f3f5;
}

.variant-list.show {
    display: block;
}

.variant-list.collapse:not(.show) {
    display: none;
}

.variant-quick-add {
    border: none;
    text-align: left;
    cursor: pointer;
    background: #fff;
}

.variant-quick-add:not(.disabled):hover {
    background: rgba(13, 110, 253, 0.08);
}

.variant-quick-add.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.search-result-item.single-variant .product-header {
    cursor: pointer;
}

.search-result-item {
    padding: 1rem 1.25rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

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

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.selected {
    background-color: rgba(13, 110, 253, 0.1);
}

/* Cart Items */
.cart-container {
    max-height: 500px;
    overflow-y: auto;
}

.cart-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: white;
    transition: background-color 0.2s;
}

.cart-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    flex-wrap: nowrap;
}

.cart-info {
    flex: 1;
    min-width: 180px;
}

.cart-quantity {
    display: flex;
    justify-content: center;
    flex: 0 0 150px;
}

.cart-price {
    min-width: 100px;
    text-align: right;
}

.cart-item .remove-item {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-width: 2px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.cart-item .remove-item:hover {
    box-shadow: 0 5px 15px rgba(220, 53, 69, 0.25);
    transform: translateY(-1px);
}

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

.cart-item:last-child {
    border-bottom: none;
}

@media (max-width: 767px) {
    .cart-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .cart-info,
    .cart-quantity,
    .cart-price {
        width: 100%;
        min-width: auto;
    }
    .cart-quantity {
        justify-content: flex-start;
    }
    .cart-price {
        text-align: left;
    }
    .cart-row .remove-item {
        width: 100%;
        justify-content: center;
    }
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quantity-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: bold;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
}

.quantity-btn:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

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

.quantity-input {
    width: 60px;
    text-align: center;
    font-weight: 600;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
}

/* Totals Panel */
.totals-panel {
    position: sticky;
    top: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.totals-section {
    background-color: var(--light-bg);
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.total-row:last-child {
    border-bottom: none;
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.5rem;
    padding-top: 1rem;
}

.total-label {
    font-weight: 500;
    color: #6c757d;
}

.total-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.grand-total .total-value {
    font-size: 1.5rem;
    color: var(--success-color);
}

/* Empty States */
.empty-cart {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-cart i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* Payment Method Selection */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.payment-methods button.payment-method-btn {
    padding: 0.85rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: #ffffff;
    transition: all 0.2s ease;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-weight: 500;
    color: #1e1e1e;
    width: 100%;
}

.payment-method-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.payment-method-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
}

.payment-method-btn i {
    color: #495057;
}

.payment-method-btn.active {
    border-color: #6759ff;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(103, 89, 255, 0.25);
    color: #3a2bd1;
    font-weight: 600;
}

.payment-method-btn.active i,
.payment-method-btn.active span {
    color: #3a2bd1;
}

/* Action Buttons */
.action-btn {
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    width: 100%;
    margin-bottom: 0.75rem;
}

.action-btn:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 992px) {
    .billing-main {
        flex-direction: column;
    }
    
    .billing-right {
        width: 100%;
    }
    
    .totals-panel {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .billing-container {
        padding: 0 0.5rem;
    }
    
    .product-search-input {
        font-size: 1.1rem;
        padding: 0.875rem 1rem;
    }
    
    .quantity-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .payment-methods {
        grid-template-columns: 1fr;
    }
    
    .quantity-controls {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .quantity-input {
        width: 100%;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.show {
    animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.search-results.show {
    animation: fadeIn 0.2s ease-out;
}

/* Scrollbar Styling */
.cart-container::-webkit-scrollbar,
.search-results::-webkit-scrollbar {
    width: 8px;
}

.cart-container::-webkit-scrollbar-track,
.search-results::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 4px;
}

.cart-container::-webkit-scrollbar-thumb,
.search-results::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.cart-container::-webkit-scrollbar-thumb:hover,
.search-results::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* Header Navigation Improvements */
.navbar {
    padding: 0.75rem 1rem;
}

.navbar .container-fluid {
    flex-wrap: wrap;
}

.navbar-nav {
    flex-wrap: nowrap !important;
    white-space: nowrap;
}

.nav-item {
    white-space: nowrap;
    flex-shrink: 0;
}

.navbar-brand {
    font-size: 1.3rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.navbar-brand:hover {
    opacity: 0.9;
}

.nav-link {
    transition: all 0.2s;
    border-radius: 0.375rem;
    margin: 0 0.2rem;
    padding: 0.5rem 0.75rem !important;
    position: relative;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-1px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25) !important;
    font-weight: 600 !important;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 2px;
}

/* Fix Reports dropdown active state - ensure underline matches Billing menu exactly */
.nav-item.dropdown .nav-link.active::after,
.nav-link.dropdown-toggle.active::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 60% !important;
    height: 2px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 2px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* Remove any duplicate underlines from Bootstrap defaults */
.nav-link.dropdown-toggle.active::before {
    display: none !important;
}

/* Ensure no border-bottom is applied to dropdown-toggle */
.nav-link.dropdown-toggle.active {
    border-bottom: none !important;
}

/* Shop and User Info Styling */
.navbar-nav .nav-item .text-white {
    transition: all 0.2s;
}

.navbar-nav .nav-item .text-white:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Dropdown Menu Improvements */
.dropdown-menu {
    border: none;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    margin-top: 0.5rem;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Shop Dropdown Specific Styles */
.shop-dropdown {
    min-width: 280px;
    max-width: min(350px, calc(100vw - 40px));
}

.shop-dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
}

.shop-dropdown-item span {
    min-width: 0;
    flex: 1;
}

.shop-dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.shop-dropdown-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.shop-dropdown-item.active:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.9;
}

/* Profile Dropdown Specific Styles */
.profile-dropdown {
    min-width: 280px;
    max-width: min(320px, calc(100vw - 40px));
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.profile-dropdown .dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    border-radius: 0;
    white-space: nowrap;
}

.profile-dropdown .dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(4px);
    padding-left: 1.25rem;
}

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

/* General Dropdown Item Styles */
.dropdown-item {
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    border-radius: 0;
}

.dropdown-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.dropdown-item.text-danger:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545 !important;
}

.dropdown-divider {
    margin: 0.5rem 0;
    opacity: 0.2;
}

/* Ensure dropdowns position correctly and don't overflow */
.dropdown-menu.dropdown-menu-end {
    right: 0;
    left: auto;
}

/* Prevent dropdown from causing page scroll */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    z-index: 1000;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

/* Adjust dropdown position if near bottom of screen */
@media (max-height: 800px) {
    .dropdown-menu {
        max-height: calc(100vh - 120px);
    }
}

/* Fix for Bootstrap 5 dropdown positioning - ensure dropdowns stay within viewport */
.dropdown-menu.dropdown-menu-end[data-bs-popper] {
    left: auto !important;
    right: 0 !important;
    margin-top: 0.5rem;
    position: absolute !important;
}

/* Ensure dropdowns don't overflow viewport */
.dropdown-menu {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* Prevent body scroll when dropdown is open */
body.dropdown-open {
    overflow: hidden;
}

/* Auto-adjust dropdown position if it would overflow bottom */
@media (max-height: 700px) {
    .dropdown-menu {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Prevent text overflow in dropdowns */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.min-w-0 {
    min-width: 0;
}

.flex-shrink-0 {
    flex-shrink: 0;
}

/* Profile header text handling */
.profile-header {
    word-wrap: break-word;
}

.profile-header small {
    word-break: break-all;
}

/* Profile Dropdown Container (Near Dashboard) */
.profile-dropdown-container {
    position: absolute;
    top: 80px;
    right: 20px;
    z-index: 1050;
    min-width: 280px;
    max-width: 320px;
}

/* Make dashboard header container relative for absolute positioning */
.dashboard-header {
    position: relative;
}

.profile-dropdown-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.profile-dropdown-card .list-group-item {
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    border: none;
}

.profile-dropdown-card .list-group-item:hover {
    background: rgba(102, 126, 234, 0.1);
    padding-left: 1.25rem;
}

.profile-dropdown-card .list-group-item a {
    color: inherit;
    transition: all 0.2s ease;
}

.profile-dropdown-card .list-group-item:hover a {
    color: #667eea;
}

.profile-dropdown-card .btn-link {
    text-align: left;
}

.profile-dropdown-card .btn-link:hover {
    text-decoration: underline;
}

/* Animation for profile dropdown */
.profile-dropdown-container {
    animation: slideDown 0.3s ease-out;
}

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

/* Responsive Header Improvements */
@media (max-width: 991px) {
    .navbar-nav {
        margin-top: 1rem;
    }
    
    .nav-link {
        margin: 0.25rem 0;
    }
    
    .navbar-nav .nav-item.me-3 {
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
    }
    
    .nav-link .d-flex.flex-column {
        display: none !important;
    }
    
    .nav-link .d-flex.flex-column + i {
        display: none !important;
    }
}
