/**
 * SMART-PGS — Global light theme enhancements
 * Applies across Inventory, POS, Account, and Admin modules.
 * Preserves existing layout structure; refines colors, spacing, and surfaces.
 */

:root {
    --smart-bg: #f0f4f8;
    --smart-bg-subtle: #f8fafc;
    --smart-surface: #ffffff;
    --smart-border: #e2e8f0;
    --smart-border-light: #eef2f6;
    --smart-text: #475569;
    --smart-text-muted: #94a3b8;
    --smart-text-heading: #1e293b;
    --smart-primary: #5b8def;
    --smart-primary-hover: #4a7de0;
    --smart-primary-light: #eef4ff;
    --smart-primary-soft: rgba(91, 141, 239, 0.12);
    --smart-success: #22c55e;
    --smart-success-light: #ecfdf5;
    --smart-warning-light: #fffbeb;
    --smart-danger-light: #fef2f2;
    --smart-info-light: #eff6ff;
    --smart-sidebar-bg: #1e2a3a;
    --smart-sidebar-text: #cbd5e1;
    --smart-sidebar-hover: rgba(255, 255, 255, 0.07);
    --smart-sidebar-active: rgba(91, 141, 239, 0.18);
    --smart-topbar-bg: #ffffff;
    --smart-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
    --smart-shadow: 0 2px 12px rgba(15, 23, 42, 0.07);
    --smart-shadow-lg: 0 8px 28px rgba(15, 23, 42, 0.09);
    --smart-radius: 10px;
    --smart-radius-lg: 14px;
    --smart-transition: 0.2s ease;
}

/* ── Page & layout shell ─────────────────────────────────────── */
body[data-layout-mode="light"] {
    background-color: var(--smart-bg);
    color: var(--smart-text);
}

.main-content {
    background-color: var(--smart-bg);
}

.page-content {
    background-color: transparent;
}

.container-fluid {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

/* ── Topbar ──────────────────────────────────────────────────── */
#page-topbar {
    background: var(--smart-topbar-bg) !important;
    border-bottom: 1px solid var(--smart-border-light);
    box-shadow: var(--smart-shadow-sm);
}

#page-topbar .navbar-header .header-item {
    color: var(--smart-text);
    border-radius: 8px;
    transition: background-color var(--smart-transition);
}

#page-topbar .navbar-header .header-item:hover {
    background-color: var(--smart-primary-soft);
    color: var(--smart-primary);
}

#page-topbar .app-search .form-control {
    background-color: var(--smart-bg-subtle);
    border: 1px solid var(--smart-border);
    border-radius: 20px;
    padding-left: 2.2rem;
    color: var(--smart-text-heading);
    transition: border-color var(--smart-transition), box-shadow var(--smart-transition);
}

#page-topbar .app-search .form-control:focus {
    background-color: var(--smart-surface);
    border-color: var(--smart-primary);
    box-shadow: 0 0 0 3px var(--smart-primary-soft);
}

#page-topbar .app-search .bx-search-alt {
    color: var(--smart-text-muted);
}

/* POS / module quick-nav pills in topbar */
.topbar-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--smart-text);
    border: 1px solid transparent;
    border-radius: 20px;
    background: transparent;
    transition: all var(--smart-transition);
}

.topbar-nav-pill:hover,
.topbar-nav-pill.is-active {
    background: var(--smart-primary-light);
    color: var(--smart-primary);
    border-color: rgba(91, 141, 239, 0.2);
}

.topbar-nav-pill i {
    font-size: 1rem;
    opacity: 0.85;
}

/* Account module shortcut buttons */
.topbar-shortcut-btn {
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 20px;
    padding: 0.3rem 0.85rem;
    border-width: 1px;
    transition: all var(--smart-transition);
}

.topbar-shortcut-btn.btn-outline-primary {
    color: var(--smart-primary);
    border-color: rgba(91, 141, 239, 0.35);
    background: var(--smart-primary-light);
}

.topbar-shortcut-btn.btn-outline-primary:hover {
    background: var(--smart-primary);
    color: #fff;
    border-color: var(--smart-primary);
}

.topbar-shortcut-btn.btn-outline-secondary {
    color: var(--smart-text);
    border-color: var(--smart-border);
    background: var(--smart-bg-subtle);
}

.topbar-shortcut-btn.btn-outline-secondary:hover {
    background: var(--smart-surface);
    border-color: var(--smart-text-muted);
}

.topbar-shortcut-btn.btn-outline-info {
    color: #0ea5e9;
    border-color: rgba(14, 165, 233, 0.3);
    background: var(--smart-info-light);
}

.topbar-shortcut-btn.btn-outline-info:hover {
    background: #0ea5e9;
    color: #fff;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
body[data-sidebar="dark"] .vertical-menu {
    background: var(--smart-sidebar-bg) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
}

body[data-sidebar="dark"] #sidebar-menu ul li a {
    color: var(--smart-sidebar-text);
    border-radius: 8px;
    margin: 2px 10px;
    padding: 0.65rem 1rem;
    transition: all var(--smart-transition);
}

body[data-sidebar="dark"] #sidebar-menu ul li a:hover {
    background: var(--smart-sidebar-hover);
    color: #fff;
}

body[data-sidebar="dark"] #sidebar-menu ul li a.active,
body[data-sidebar="dark"] #sidebar-menu ul li.mm-active > a {
    background: var(--smart-sidebar-active);
    color: #fff;
}

body[data-sidebar="dark"] #sidebar-menu ul li a i {
    color: #94a3b8;
    transition: color var(--smart-transition);
}

body[data-sidebar="dark"] #sidebar-menu ul li a:hover i,
body[data-sidebar="dark"] #sidebar-menu ul li a.active i {
    color: var(--smart-primary);
}

body[data-sidebar="dark"] #sidebar-menu .sub-menu {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    margin: 0 10px 4px;
    padding: 4px 0;
}

body[data-sidebar="dark"] #sidebar-menu .sub-menu li a {
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
}

/* ── Page title / breadcrumb bar ─────────────────────────────── */
.smart-page-header.card {
    margin-bottom: 1rem !important;
    border: 1px solid var(--smart-border-light);
    border-radius: var(--smart-radius);
    box-shadow: var(--smart-shadow-sm);
    background: var(--smart-surface);
}

.smart-page-header .page-title-box {
    padding: 0.75rem 1.25rem !important;
    background: transparent;
}

.smart-page-header .breadcrumb-item a {
    color: var(--smart-text-muted);
    font-size: 0.8125rem;
    text-decoration: none;
    transition: color var(--smart-transition);
}

.smart-page-header .breadcrumb-item a:hover {
    color: var(--smart-primary);
}

.smart-page-header .page-title-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0 !important;
    margin-bottom: 0 !important;
}

.smart-page-header .page-title-right .btn {
    font-size: 0.8125rem;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    border: 1px solid var(--smart-border-light) !important;
    border-radius: var(--smart-radius-lg) !important;
    box-shadow: var(--smart-shadow) !important;
    background: var(--smart-surface);
    transition: box-shadow var(--smart-transition);
}

.card:hover {
    box-shadow: var(--smart-shadow-lg) !important;
}

.card-header {
    background: var(--smart-bg-subtle) !important;
    border-bottom: 1px solid var(--smart-border-light) !important;
    padding: 0.875rem 1.25rem !important;
    font-weight: 600;
    color: var(--smart-text-heading);
}

.card-body {
    padding: 1.25rem !important;
}

.custome-card {
    margin-bottom: 1rem !important;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table {
    color: var(--smart-text);
    margin-bottom: 0;
}

.table > thead {
    vertical-align: middle;
}

.table-light,
.table > thead.table-light {
    --bs-table-bg: var(--smart-bg-subtle);
    --bs-table-color: var(--smart-text-heading);
}

.table-light th,
.table > thead.table-light th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--smart-text-muted);
    border-bottom: 1px solid var(--smart-border);
    padding: 0.75rem 0.65rem !important;
    white-space: nowrap;
}

.table > tbody > tr {
    border-bottom: 1px solid var(--smart-border-light);
    transition: background-color var(--smart-transition);
}

.table-hover tbody tr:hover {
    background-color: var(--smart-primary-soft) !important;
}

.table > tbody > tr > td {
    padding: 0.65rem !important;
    vertical-align: middle;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all var(--smart-transition);
}

.btn-primary {
    background-color: var(--smart-primary);
    border-color: var(--smart-primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--smart-primary-hover);
    border-color: var(--smart-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 141, 239, 0.35);
}

.btn-soft-info,
.btn-soft-primary {
    background-color: var(--smart-primary-light) !important;
    color: var(--smart-primary) !important;
    border: 1px solid rgba(91, 141, 239, 0.2) !important;
}

.btn-soft-info:hover,
.btn-soft-primary:hover {
    background-color: var(--smart-primary) !important;
    color: #fff !important;
    transform: translateY(-1px);
}

.btn-warning.btn-sm {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #b45309;
}

.btn-warning.btn-sm:hover {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

.btn-danger.btn-sm {
    background-color: var(--smart-danger-light);
    border-color: #fecaca;
    color: #dc2626;
}

.btn-danger.btn-sm:hover {
    background-color: #ef4444;
    border-color: #ef4444;
    color: #fff;
}

.btn-success.btn-sm {
    background-color: var(--smart-success-light);
    border-color: #bbf7d0;
    color: #15803d;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-control,
.form-select {
    border: 1px solid var(--smart-border);
    border-radius: 8px;
    color: var(--smart-text-heading);
    background-color: var(--smart-surface);
    transition: border-color var(--smart-transition), box-shadow var(--smart-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--smart-primary);
    box-shadow: 0 0 0 3px var(--smart-primary-soft);
}

.form-control::placeholder {
    color: var(--smart-text-muted);
}

.form-label {
    color: var(--smart-text-muted);
}

.form-container {
    border: 1px solid var(--smart-border-light);
    border-radius: var(--smart-radius-lg);
    background: var(--smart-surface);
    box-shadow: var(--smart-shadow);
}

.floating-label-group .form-label {
    color: var(--smart-text-muted);
}

.form-control:focus + .form-label,
.form-select:focus + .form-label,
.form-control:not(:placeholder-shown) + .form-label {
    color: var(--smart-primary);
}

/* ── Badges & alerts ─────────────────────────────────────────── */
.badge {
    font-weight: 500;
    border-radius: 6px;
    padding: 0.35em 0.65em;
}

.bg-soft-primary,
.badge.bg-soft-primary {
    background-color: var(--smart-primary-light) !important;
    color: var(--smart-primary) !important;
}

.alert {
    border-radius: var(--smart-radius);
    border: none;
    box-shadow: var(--smart-shadow-sm);
}

.alert-success {
    background-color: var(--smart-success-light);
    color: #15803d;
}

.alert-info {
    background-color: var(--smart-info-light);
    color: #0369a1;
}

.alert-warning {
    background-color: var(--smart-warning-light);
    color: #b45309;
}

.alert-danger {
    background-color: var(--smart-danger-light);
    color: #dc2626;
}

/* ── Pagination ───────────────────────────────────────────────── */
.pagination .page-link {
    border-radius: 8px !important;
    border: 1px solid var(--smart-border);
    color: var(--smart-text);
    margin: 0 2px;
    transition: all var(--smart-transition);
}

.pagination .page-link:hover {
    background-color: var(--smart-primary-light);
    border-color: rgba(91, 141, 239, 0.3);
    color: var(--smart-primary);
}

.pagination .page-item.active .page-link {
    background-color: var(--smart-primary);
    border-color: var(--smart-primary);
}

/* ── Modals & dropdowns ────────────────────────────────────────── */
.modal-content {
    border: 1px solid var(--smart-border-light);
    border-radius: var(--smart-radius-lg);
    box-shadow: var(--smart-shadow-lg);
}

.modal-header {
    background: var(--smart-bg-subtle);
    border-bottom: 1px solid var(--smart-border-light);
}

.dropdown-menu {
    border: 1px solid var(--smart-border-light);
    border-radius: var(--smart-radius);
    box-shadow: var(--smart-shadow-lg);
}

.dropdown-item {
    border-radius: 6px;
    margin: 2px 6px;
    padding: 0.5rem 0.75rem;
    transition: background-color var(--smart-transition);
}

.dropdown-item:hover {
    background-color: var(--smart-primary-soft);
    color: var(--smart-primary);
}

.notification-item:hover {
    background-color: var(--smart-bg-subtle);
}

/* ── Stats / mini cards ──────────────────────────────────────── */
.mini-stats-wid {
    border: 1px solid var(--smart-border-light) !important;
    box-shadow: var(--smart-shadow) !important;
}

.mini-stats-wid:hover {
    box-shadow: var(--smart-shadow-lg) !important;
    transform: translateY(-3px);
}

.mini-stat-icon {
    border-radius: 12px;
}

/* ── Account desk nav (single bar) — see account-desk-nav.css ── */
.account-module {
    --account-topbar-height: 0px;
    --account-topnav-height: 0px;
    --account-desk-bar-height: 62px;
}

.account-module #page-topbar {
    display: none;
}

.account-module .account-topnav {
    display: none;
}

.account-topnav {
    background: var(--smart-surface);
    box-shadow: var(--smart-shadow-sm);
    border-bottom: 1px solid var(--smart-border-light);
}

.account-topnav .navbar-nav .nav-link {
    padding: 0.85rem 1rem;
    font-weight: 600;
    color: var(--smart-text);
    border-radius: 8px;
    transition: all var(--smart-transition);
}

.account-topnav .navbar-nav .nav-link .bx {
    font-size: 1.05rem;
    opacity: 0.85;
}

.account-topnav .navbar-nav .nav-link:hover {
    color: var(--smart-primary);
    background: var(--smart-primary-soft);
}

.account-topnav .navbar-nav .nav-link.active {
    color: var(--smart-primary);
    background: var(--smart-primary-light);
    position: relative;
}

.account-topnav .navbar-nav .nav-link.active::after {
    content: "";
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 0.35rem;
    height: 3px;
    border-radius: 2px;
    background: var(--smart-primary);
}

.account-module .account-topnav .dropdown-menu {
    z-index: 1003;
}

.account-topnav .dropdown-menu {
    border-radius: var(--smart-radius);
    border-color: var(--smart-border-light);
    box-shadow: var(--smart-shadow-lg);
}

.account-topnav .dropdown-item.active,
.account-topnav .dropdown-item:active {
    background-color: var(--smart-primary-soft);
    color: var(--smart-primary);
}

@media (max-width: 991.98px) {
    .account-topnav .navbar-nav .nav-link.active::after {
        display: none;
    }
}

/* ── POS dashboard — light theme ───────────────────────────────── */
.dark-dashboard {
    background: var(--smart-bg-subtle);
    min-height: auto;
    color: var(--smart-text-heading);
    font-family: inherit;
    padding: 1.5rem;
    border-radius: var(--smart-radius-lg);
    margin-bottom: 1.25rem;
    border: 1px solid var(--smart-border-light);
}

.dark-dashboard .text-gradient {
    background: linear-gradient(135deg, var(--smart-primary) 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-card {
    background: var(--smart-surface);
    border-radius: var(--smart-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.25s ease;
    border: 1px solid var(--smart-border-light);
    box-shadow: var(--smart-shadow);
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--smart-shadow-lg);
    border-color: rgba(91, 141, 239, 0.25);
}

.metric-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    flex-shrink: 0;
}

.metric-card.steps .metric-icon {
    background: linear-gradient(135deg, #fb923c, #f97316);
}

.metric-card.calories .metric-icon {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.metric-card.water .metric-icon {
    background: linear-gradient(135deg, #60a5fa, #38bdf8);
}

.metric-card.heart-rate .metric-icon {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.metric-content h3 {
    color: var(--smart-text-heading);
    font-size: 1.5rem !important;
}

.metric-content p {
    color: var(--smart-text-muted);
}

.session-card,
.progress-card,
.premium-card,
.meal-card,
.activities-card {
    background: var(--smart-surface);
    border-radius: var(--smart-radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--smart-border-light);
    box-shadow: var(--smart-shadow);
}

.session-card .card-header h4,
.progress-card .card-header h4,
.premium-card h4 {
    color: var(--smart-text-heading);
}

.session-item {
    background: var(--smart-bg-subtle) !important;
    border: 1px solid var(--smart-border-light);
    transition: background-color var(--smart-transition);
}

.session-item:hover {
    background: var(--smart-primary-light) !important;
}

.session-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--smart-primary), #38bdf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.progress-chart {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.chart-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--smart-primary) 0deg 306deg, var(--smart-border) 306deg 360deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    background: var(--smart-surface);
    border-radius: 50%;
}

.chart-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--smart-text-heading);
    position: relative;
    z-index: 1;
    margin: 0;
}

.chart-label {
    font-size: 0.75rem;
    color: var(--smart-text-muted);
    position: relative;
    z-index: 1;
}

.progress-item {
    border-bottom-color: var(--smart-border-light) !important;
}

.progress-label {
    color: var(--smart-text-muted) !important;
}

.progress-hours {
    color: var(--smart-text-heading);
}

.premium-card {
    background: linear-gradient(145deg, var(--smart-primary-light) 0%, #f0f9ff 100%);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.premium-card h4 {
    color: #15803d !important;
}

.premium-image {
    font-size: 2.75rem;
    color: var(--smart-primary);
}

.small-metric {
    background: var(--smart-surface);
    border-radius: var(--smart-radius);
    border: 1px solid var(--smart-border-light);
}

.activity-image {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--smart-primary), #38bdf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
}

.dark-dashboard .shadow-lg {
    box-shadow: var(--smart-shadow) !important;
}

.dark-dashboard .form-select.bg-dark {
    background-color: var(--smart-bg-subtle) !important;
    color: var(--smart-text-heading) !important;
    border-color: var(--smart-border) !important;
}

.dark-dashboard .bg-dark-subtle {
    background-color: var(--smart-bg-subtle) !important;
}

.dark-dashboard .border-secondary {
    border-color: var(--smart-border-light) !important;
}

/* ── Root dashboard / module launcher cards ───────────────────── */
.module-btn {
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8125rem;
    transition: all var(--smart-transition);
}

.module-btn.btn-outline-primary {
    color: var(--smart-primary);
    border-color: rgba(91, 141, 239, 0.35);
    background: var(--smart-primary-light);
}

.module-btn.btn-outline-primary:hover {
    background: var(--smart-primary);
    border-color: var(--smart-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 141, 239, 0.3);
}

.module-btn.btn-outline-secondary:disabled {
    opacity: 0.55;
    background: var(--smart-bg-subtle);
}

/* Organization cards on root dashboard */
.card.mb-3 {
    border: 1px solid var(--smart-border-light);
    transition: box-shadow var(--smart-transition), transform var(--smart-transition);
}

.card.mb-3:hover {
    box-shadow: var(--smart-shadow-lg);
    transform: translateY(-2px);
}

.card.mb-3 .badge.bg-primary {
    background-color: var(--smart-primary-light) !important;
    color: var(--smart-primary) !important;
    font-weight: 500;
}

.card.mb-3 .badge.bg-danger {
    background-color: var(--smart-danger-light) !important;
    color: #dc2626 !important;
    font-weight: 500;
}

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
    background: var(--smart-surface);
    border-top: 1px solid var(--smart-border-light);
    color: var(--smart-text-muted);
}

/* ── Scrollbar (global, subtle) ────────────────────────────────── */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: var(--smart-bg-subtle);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ── Responsive tweaks ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .dark-dashboard {
        padding: 1rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-icon {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
}
