/* Store Management System - Modern UI */

:root {
    --nav-bg: #1b4332;
    --nav-bg-dark: #081c15;
    --nav-hover: rgba(255, 255, 255, 0.12);
    --nav-active: rgba(255, 255, 255, 0.18);
    --primary: #40916c;
    --primary-dark: #2d6a4f;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --page-bg: #f0f2f5;
    --card-bg: #ffffff;
    --card-radius: 16px;
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 8px 32px rgba(0, 0, 0, 0.1);
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
}

[data-bs-theme="dark"] {
    --page-bg: #0f1117;
    --card-bg: #1a1d27;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --border-color: #2d3142;
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --nav-bg: #081c15;
    --nav-bg-dark: #040f0a;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--page-bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Top Navbar ─── */
.top-navbar {
    background: linear-gradient(135deg, var(--nav-bg) 0%, var(--nav-bg-dark) 100%);
    position: sticky;
    top: 0;
    z-index: 1050;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

.top-navbar .navbar {
    padding: 0.5rem 0;
}

.top-navbar .navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff !important;
    text-decoration: none;
    padding: 0.25rem 0;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #fff;
    flex-shrink: 0;
}
.brand-logo-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.brand-text small {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.65);
    font-weight: 400;
}

.top-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3);
    padding: 0.4rem 0.6rem;
}

.top-navbar .navbar-toggler-icon {
    filter: invert(1);
}

.top-navbar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.top-navbar .nav-link:hover {
    color: #fff !important;
    background: var(--nav-hover);
}

.top-navbar .nav-link.active {
    color: #fff !important;
    background: var(--nav-active);
}

.top-navbar .nav-link-pos {
    background: var(--accent) !important;
    color: #fff !important;
    font-weight: 600;
}

.top-navbar .nav-link-pos:hover {
    background: var(--accent-light) !important;
}

.top-navbar .dropdown-menu {
    border: none;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.top-navbar .dropdown-item {
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-navbar .dropdown-item:hover,
.top-navbar .dropdown-item.active {
    background: rgba(64, 145, 108, 0.1);
    color: var(--primary-dark);
}

[data-bs-theme="dark"] .top-navbar .dropdown-item:hover,
[data-bs-theme="dark"] .top-navbar .dropdown-item.active {
    background: rgba(64, 145, 108, 0.2);
    color: var(--primary);
}

.navbar-actions {
    padding: 0.5rem 0;
}

.nav-search {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-search i {
    position: absolute;
    left: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    pointer-events: none;
}

.nav-search input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    padding: 0.4rem 0.85rem 0.4rem 2.25rem;
    font-size: 0.85rem;
    width: 200px;
    transition: all 0.2s;
}

.nav-search input::placeholder { color: rgba(255, 255, 255, 0.45); }
.nav-search input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    width: 240px;
}

.btn-nav-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.85);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.btn-nav-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-nav-icon-active {
    background: rgba(64, 145, 108, 0.35);
    color: #fff;
}

.btn-user-menu {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.75rem 0.35rem 0.35rem;
    transition: all 0.2s;
}

.btn-user-menu:hover,
.btn-user-menu:focus,
.btn-user-menu.show {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-user-menu::after {
    margin-left: 0.25rem;
    opacity: 0.6;
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.65;
}

@media (max-width: 991.98px) {
    .top-navbar .navbar-collapse {
        background: var(--nav-bg-dark);
        border-radius: 12px;
        padding: 0.75rem;
        margin-top: 0.5rem;
        max-height: 80vh;
        overflow-y: auto;
    }

    .navbar-actions {
        flex-direction: column;
        align-items: stretch !important;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        margin-top: 0.5rem;
    }

    .nav-search {
        display: flex !important;
        width: 100%;
    }

    .nav-search input {
        width: 100%;
    }

    .nav-search input:focus { width: 100%; }

    .btn-user-menu { justify-content: flex-start; }
}

/* ─── Content Area ─── */
.content-area {
    min-height: calc(100vh - 70px);
    padding: 1.5rem;
}

.content-inner {
    max-width: 1440px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .content-area { padding: 2rem; }
}

/* ─── Page Header ─── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header h4,
.page-header .page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.page-header .page-subtitle,
.page-header .text-muted {
    font-size: 0.875rem;
    color: var(--text-secondary) !important;
}

.welcome-header {
    margin-bottom: 1.75rem;
}

.welcome-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.welcome-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.card.border-0.shadow-sm {
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--card-shadow) !important;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body { padding: 1.25rem; }

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* ─── Stat Cards ─── */
.stat-card {
    border-radius: var(--card-radius) !important;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover) !important;
}

.stat-card .card-body { padding: 1.25rem; }

.stat-card h4, .stat-card h5 {
    font-weight: 700;
    font-size: 1.5rem;
}

.stat-card p.text-muted,
.stat-card small.text-muted {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-card-mini {
    text-align: center;
    padding: 1.25rem 1rem !important;
    border-radius: var(--card-radius);
}

.stat-card-mini h5 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card-mini small {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ─── Buttons ─── */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    font-weight: 600;
    padding: 0.5rem 1.15rem;
    transition: all 0.2s;
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 145, 108, 0.35);
}

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    border-radius: 10px;
    font-weight: 500;
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-success { border-radius: 10px; font-weight: 600; }
.btn-danger { border-radius: 10px; }
.btn-secondary { border-radius: 10px; }

.btn-group-sm .btn { border-radius: 8px !important; }

/* ─── Tables ─── */
.table-responsive {
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.table th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table tbody tr {
    transition: background 0.15s;
}

.table-hover tbody tr:hover {
    background: rgba(64, 145, 108, 0.04);
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background: rgba(64, 145, 108, 0.08);
}

.table a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.table a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ─── Forms & Filters ─── */
.form-control,
.form-select {
    border-radius: 10px;
    border-color: var(--border-color);
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(64, 145, 108, 0.15);
}

.input-group-text {
    border-radius: 10px 0 0 10px;
    border-color: var(--border-color);
    background: var(--page-bg);
}

.filter-bar .card-body { padding: 1rem 1.25rem; }

.search-input-wrap {
    position: relative;
}

.search-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input-wrap .form-control {
    padding-left: 2.5rem;
}

/* ─── Badges ─── */
.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

.badge.bg-primary { background: var(--primary) !important; }
.badge.bg-success { background: var(--success) !important; }
.badge.bg-danger { background: var(--danger) !important; }
.badge.bg-warning { background: var(--warning) !important; color: #fff !important; }

/* ─── Pagination ─── */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 2px;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(64, 145, 108, 0.35);
}

.pagination .page-link:hover {
    background: rgba(64, 145, 108, 0.1);
    color: var(--primary-dark);
}

/* ─── Alerts ─── */
.alert {
    border-radius: 12px;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success { background: rgba(16, 185, 129, 0.12); color: #065f46; }
.alert-danger { background: rgba(239, 68, 68, 0.12); color: #991b1b; }
.alert-warning { background: rgba(245, 158, 11, 0.12); color: #92400e; }

[data-bs-theme="dark"] .alert-success { color: #6ee7b7; }
[data-bs-theme="dark"] .alert-danger { color: #fca5a5; }

/* ─── Modals ─── */
.modal-content {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
}

/* ─── Product ─── */
.product-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

/* ─── Chart Cards ─── */
.chart-card .card-header h6 {
    font-weight: 700;
    font-size: 0.95rem;
}

.list-group-item {
    border-color: var(--border-color);
    padding: 0.85rem 1.25rem;
    font-size: 0.875rem;
}

/* ─── POS ─── */
.pos-container { min-height: calc(100vh - 120px); }

.search-dropdown {
    position: absolute;
    z-index: 1050;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: calc(100% - 2rem);
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--card-shadow-hover);
}

.search-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}

.search-item:hover { background: rgba(64, 145, 108, 0.08); }

.customer-info-panel {
    background: var(--page-bg);
    border-radius: 12px;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
}

#productCodeInput {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

#productCodeInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

#codeFeedback {
    font-weight: 500;
}

.pos-cart-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.pos-cart-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--page-bg);
    color: var(--text-secondary);
    font-size: 1rem;
}

.search-item .pos-cart-thumb {
    width: 36px;
    height: 36px;
}

.scanner-viewport {
    background: #000;
    min-height: 280px;
}

.scanner-viewport #qrReader {
    width: 100%;
}

.scanner-viewport #qrReader video {
    border-radius: 12px;
}

.scanner-status {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ─── Login Page ─── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--nav-bg) 0%, var(--nav-bg-dark) 50%, #1a1a2e 100%);
    padding: 1rem;
}

.login-container { width: 100%; max-width: 440px; }

.login-card {
    border-radius: var(--card-radius);
    border: none;
    background: var(--card-bg);
    overflow: hidden;
}

.login-card .card-body { padding: 2.5rem !important; }

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    color: #fff;
}
.login-logo-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.login-card h3 {
    font-weight: 700;
    font-size: 1.5rem;
}

.login-card .btn-primary {
    padding: 0.7rem;
    font-size: 0.95rem;
}

/* ─── View Action Link ─── */
.action-link {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: gap 0.2s;
}

.action-link:hover {
    color: var(--primary-dark);
    gap: 0.45rem;
}

/* ─── Print ─── */
@media print {
    .top-navbar, .no-print { display: none !important; }
    .content-area { padding: 0; }
}

/* ─── Report Cards ─── */
a.card.text-decoration-none {
    transition: transform 0.2s, box-shadow 0.2s;
}

a.card.text-decoration-none:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover) !important;
}

a.card.text-decoration-none h5 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.15); border-radius: 3px; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); }

/* ─── Responsive Utilities ─── */
@media (max-width: 575.98px) {
    .page-header h4, .page-header .page-title { font-size: 1.25rem; }
    .welcome-header h2 { font-size: 1.35rem; }
    .stat-card h4 { font-size: 1.2rem; }
    .content-area { padding: 1rem; }
}
