/* MFT Billing - Professional Theme */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --gradient-warning: linear-gradient(135deg, #f7971e 0%, #ffd200 100%);
    --gradient-info: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    --gradient-purple: linear-gradient(135deg, #7f00ff 0%, #e100ff 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --radius: 0.75rem;
}

/* Dark/Light Theme */
[data-bs-theme="light"] {
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --bg-navbar: #ffffff;
    --text-primary: #1a202c;
    --text-muted: #718096;
    --border-color: #e2e8f0;
}

[data-bs-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-navbar: #1e293b;
    --text-primary: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

body {
    background-color: var(--bg-body);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
}

/* Navbar */
.navbar {
    background-color: var(--bg-navbar) !important;
    box-shadow: var(--shadow-md);
    padding: 0.4rem 0;
}

/* Brand Logo */
.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    margin-right: 0.5rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

.brand-icon-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 1rem;
    margin-right: 0.4rem;
}

.brand-name {
    font-size: 1.55rem;
    font-weight: 800;
    color: #dc2626;
    letter-spacing: -0.3px;
    line-height: 1;
}

.brand-name-sm {
    font-size: 1.05rem;
}

[data-bs-theme="dark"] .brand-name {
    color: #f87171;
}

.navbar-brand {
    text-decoration: none;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.55rem 0.9rem !important;
    border-radius: 0.5rem;
    margin: 0 2px;
    transition: all 0.2s;
}

.nav-link:hover, .nav-link.active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea !important;
}

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

/* Cards */
.card {
    background-color: var(--bg-card);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-size: 0.9rem;
}

/* Dashboard Stat Cards */
.stat-card {
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: none;
}

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

.stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* Quick Action Buttons */
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.quick-action:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
    color: #667eea;
    transform: translateY(-2px);
}

.quick-action .qa-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    margin-bottom: 0.4rem;
}

.quick-action small {
    font-weight: 600;
    font-size: 0.75rem;
}

/* Icon Circles */
.icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Table Styles */
.table-responsive {
    border-radius: var(--radius);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    white-space: nowrap;
    border-bottom-width: 2px;
    padding: 0.75rem;
}

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

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.04);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 0.5rem;
    border-color: var(--border-color);
}

.form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.form-control-lg {
    padding: 0.7rem 1rem;
    font-size: 0.95rem;
}

/* Autocomplete */
.autocomplete-results {
    position: absolute;
    z-index: 1050;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.autocomplete-results .item {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    transition: background 0.15s;
}

.autocomplete-results .item:hover,
.autocomplete-results .item.active {
    background: rgba(102, 126, 234, 0.08);
}

/* Badges */
.badge {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.35em 0.65em;
    border-radius: 0.4rem;
}

.badge-role-admin { background: var(--gradient-danger); }
.badge-role-branch_manager { background: var(--gradient-warning); color: #000; }
.badge-role-sales_manager { background: var(--gradient-primary); }
.badge-role-viewer { background: linear-gradient(135deg, #6b7280, #9ca3af); }

.badge-pending { background: linear-gradient(135deg, #f7971e, #ffd200); color: #000; }
.badge-accepted { background: var(--gradient-success); }
.badge-rejected { background: var(--gradient-danger); }

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

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

.btn-primary {
    background: #667eea;
    border-color: #667eea;
}

.btn-primary:hover {
    background: #5a67d8;
    border-color: #5a67d8;
}

.btn-outline-primary {
    color: #667eea;
    border-color: #667eea;
}

.btn-outline-primary:hover {
    background: #667eea;
    border-color: #667eea;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

[data-bs-theme="dark"] .login-container {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 0 1rem;
}

/* Alert improvements */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info { background: #eff6ff; color: #1e40af; }

[data-bs-theme="dark"] .alert-success { background: #064e3b; color: #6ee7b7; }
[data-bs-theme="dark"] .alert-danger { background: #7f1d1d; color: #fca5a5; }
[data-bs-theme="dark"] .alert-warning { background: #78350f; color: #fcd34d; }
[data-bs-theme="dark"] .alert-info { background: #1e3a5f; color: #93c5fd; }

/* Ledger */
.ledger-credit { color: #059669; font-weight: 700; }
.ledger-debit { color: #dc2626; font-weight: 700; }

/* Page headings */
h5 .bi {
    color: #667eea;
}

/* Nav Pills (reports tabs) */
.nav-pills .nav-link {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 0.5rem;
}

.nav-pills .nav-link.active {
    background: var(--gradient-primary);
    color: #fff !important;
}

/* Nav Tabs */
.nav-tabs .nav-link {
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 0.5rem 0.5rem 0 0;
}

.nav-tabs .nav-link.active {
    color: #667eea;
    border-color: #667eea #667eea #fff;
}

/* Dropdown */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.dropdown-item {
    padding: 0.55rem 1rem;
    border-radius: 0.4rem;
    margin: 0.1rem 0.3rem;
    font-size: 0.92rem;
}

.dropdown-item i {
    font-size: 1.05rem;
}

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

/* Pagination */
.pagination .page-link {
    border-radius: 0.4rem;
    margin: 0 2px;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: #667eea;
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* ============================================
   MOBILE BOTTOM NAVIGATION (Android App Style)
   ============================================ */

/* Mobile Top Bar */
.mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bg-navbar);
    box-shadow: var(--shadow-sm);
}

.mobile-topbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.mobile-topbar-actions .btn-link {
    font-size: 1.1rem;
    color: var(--text-muted);
    text-decoration: none;
}

.mobile-hamburger {
    font-size: 1.5rem !important;
    color: var(--text-primary) !important;
    line-height: 1;
}

/* Submenu styles */
.side-submenu-toggle {
    position: relative;
    width: 100%;
    cursor: pointer;
}

.submenu-arrow {
    position: absolute;
    right: 0.8rem;
    font-size: 0.7rem;
    transition: transform 0.25s;
    color: var(--text-muted);
}

.side-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.side-submenu-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 2.4rem;
}

.side-submenu.open .side-submenu-items {
    max-height: 300px;
}

.side-submenu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 2px solid var(--border-color);
    margin-bottom: 0.15rem;
}

.side-submenu-link i {
    font-size: 1.05rem;
    width: 22px;
    text-align: center;
}

.side-submenu-link:active {
    background: rgba(102, 126, 234, 0.06);
}

.side-submenu-link.active {
    background: #fff7ed;
    color: #ea580c;
    font-weight: 600;
    border-left-color: #ea580c;
}

[data-bs-theme="dark"] .side-submenu-link.active {
    background: rgba(234, 88, 12, 0.15);
    color: #fb923c;
    border-left-color: #fb923c;
}

/* ===========================
   SIDE MENU (slide from right)
   =========================== */
.mobile-side-menu {
    position: fixed;
    inset: 0;
    z-index: 1060;
    display: none;
    visibility: hidden;
    pointer-events: none;
}

@media (max-width: 991.98px) {
    .mobile-side-menu {
        display: block;
    }
    .mobile-side-menu.open {
        visibility: visible;
        pointer-events: auto;
    }
}

.side-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s;
}

.mobile-side-menu.open .side-menu-backdrop {
    background: rgba(0,0,0,0.45);
}

.side-menu-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: var(--bg-card);
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    overflow-y: auto;
}

.mobile-side-menu.open .side-menu-panel {
    transform: translateX(0);
}

/* Close button */
.side-menu-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s;
}

.side-menu-close:hover {
    background: #fef2f2;
    color: #ef4444;
    border-color: #fca5a5;
}

/* Menu items */
.side-menu-items {
    flex: 1;
    padding: 2.5rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.side-menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.6rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 500;
    transition: background 0.15s;
}

.side-menu-link i {
    font-size: 1.3rem;
    width: 26px;
    text-align: center;
}

.side-menu-link:active {
    background: rgba(102, 126, 234, 0.06);
}

.side-menu-link.active {
    background: #fff7ed;
    color: #ea580c;
    font-weight: 600;
}

[data-bs-theme="dark"] .side-menu-link.active {
    background: rgba(234, 88, 12, 0.15);
    color: #fb923c;
}

/* Bottom section */
.side-menu-bottom {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.side-menu-logout {
    display: block;
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 0.6rem;
    background: #fef2f2;
    color: #dc2626;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    margin-bottom: 0.8rem;
    transition: background 0.2s;
}

[data-bs-theme="dark"] .side-menu-logout {
    background: rgba(220, 38, 38, 0.15);
    color: #fca5a5;
}

.side-menu-logout:active {
    background: #fee2e2;
}

.side-menu-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Print Styles */
@media print {
    .navbar, .no-print, .btn, .pagination, form,
    .mobile-topbar, .mobile-side-menu {
        display: none !important;
    }
    body { background: white; color: black; }
    .card { border: none; box-shadow: none; }
}

/* Responsive */
@media (max-width: 991.98px) {
    .table { font-size: 0.78rem; }
    .stat-card .stat-value { font-size: 1.1rem; }
    .stat-card .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .container-fluid { padding-left: 0.75rem; padding-right: 0.75rem; }
    .quick-action .qa-icon { width: 40px; height: 40px; font-size: 1.1rem; }
}

/* Sale Items Table */
#saleItems .form-control {
    min-width: 60px;
}

/* Barcode Scanner */
#barcode-scanner video {
    width: 100%;
    border-radius: var(--radius);
}

/* Modal */
.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom-color: var(--border-color);
}

/* Theme toggle button */
#themeToggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#themeToggle:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Invoice print */
.invoice-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem;
    border-radius: var(--radius) var(--radius) 0 0;
}
