/* assets/css/style.css - SaaS & Multi-Shop Design System */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    --secondary-color: #475569;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
}

/* Green Theme */
[data-theme-color="green"] {
    --primary-color: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --primary-border: #a7f3d0;
}

/* Dark Mode */
[data-bs-theme="dark"], body.dark-mode {
    --bg-body: #090d16;
    --bg-card: #131b2e;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #1e293b;
    --primary-light: rgba(37, 99, 235, 0.15);
    --primary-border: #1e3a8a;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

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

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.15rem;
}

.sidebar-logo img {
    height: 38px;
    width: 38px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.25rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.925rem;
    transition: all 0.2s ease;
    margin-bottom: 0.2rem;
}

.sidebar-nav-link:hover {
    color: var(--primary-color);
    background-color: var(--primary-light);
}

.sidebar-nav-link.active {
    color: #ffffff;
    background-color: var(--primary-color);
    font-weight: 600;
}

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

.topbar {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.content-body {
    padding: 1.5rem;
    flex: 1;
}

/* Stat Cards */
.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-val {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0.35rem 0 0.15rem;
    color: var(--text-main);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Card Styling */
.card-saas {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card-saas-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-saas-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-main);
}

.card-saas-body {
    padding: 1.25rem;
}

/* Badges */
.badge-status-active { background-color: #dcfce7; color: #166534; font-weight: 600; }
.badge-status-pending { background-color: #fef9c3; color: #854d0e; font-weight: 600; }
.badge-status-suspended, .badge-status-outofstock { background-color: #fee2e2; color: #991b1b; font-weight: 600; }

/* Buttons */
.btn-primary-saas {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn-primary-saas:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
}

/* POS Screen */
.pos-product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.pos-product-card:hover:not(.out-of-stock) {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pos-product-card.out-of-stock {
    opacity: 0.65;
    border-color: var(--danger-color);
    background-color: #fff5f5;
    cursor: not-allowed;
}

.pos-product-img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: #f1f5f9;
}

/* Mobile Sidebar Drawer */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
        display: none;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

/* Printable Invoice */
@media print {
    .no-print, .sidebar, .topbar, .btn, .breadcrumb, footer, .pwa-bottom-nav, .pwa-mobile-header {
        display: none !important;
    }
    .main-content, .pwa-mobile-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .card-saas {
        border: none !important;
        box-shadow: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
}

/* ========================================================
   EMPLOYEE PWA - STRICT MOBILE-ONLY VIEWPORT
   ======================================================== */
body.pwa-mobile-mode {
    background: #0f172a; /* Desktop backdrop */
    background-image: radial-gradient(rgba(37, 99, 235, 0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

body.pwa-mobile-mode.dark-mode {
    background-color: #030712;
}

.pwa-mobile-container {
    width: 100%;
    max-width: 480px; /* Strict mobile width on desktop */
    min-height: 100vh;
    background-color: var(--bg-body);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

@media (max-width: 480px) {
    body.pwa-mobile-mode {
        background: var(--bg-body);
    }
    .pwa-mobile-container {
        max-width: 100%;
        border-left: none;
        border-right: none;
        box-shadow: none;
    }
}

/* Mobile Sticky Header */
.pwa-mobile-header {
    height: 60px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.pwa-shop-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.pwa-shop-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.pwa-shop-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.2;
}

.pwa-emp-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pwa-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid #ffffff;
    box-shadow: var(--shadow-sm);
}

.pwa-profile-btn {
    text-decoration: none;
}

/* Mobile Content Body */
.pwa-mobile-content {
    flex: 1;
    padding: 0.75rem 0.75rem 85px 0.75rem;
    overflow-x: hidden;
}

/* Mobile Bottom Navigation Bar */
.pwa-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 64px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1050;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
}

@media (max-width: 480px) {
    .pwa-bottom-nav {
        max-width: 100%;
        left: 0;
        right: 0;
        transform: none;
    }
}

.pwa-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0;
    text-decoration: none !important;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.pwa-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 2px;
    display: block;
    line-height: 1;
}

.pwa-nav-item:hover, .pwa-nav-item.active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

.pwa-nav-item.active i {
    transform: scale(1.1);
    color: var(--primary-color) !important;
}

/* Floating Sticky Cart Bar */
.pwa-floating-cart {
    position: fixed;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 456px;
    background: var(--primary-color);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 50px;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 1040;
    cursor: pointer;
}

@media (max-width: 480px) {
    .pwa-floating-cart {
        max-width: calc(100% - 24px);
        left: 12px;
        transform: none;
    }
}

@keyframes slideUpCart {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive Support for Full Shop Owner PWA */
@media (max-width: 767.98px) {
    .main-content {
        width: 100%;
        overflow-x: hidden;
    }
    .topbar {
        padding: 0 0.75rem;
    }
    .content-body {
        padding: 1rem 0.75rem;
    }
    .stat-val {
        font-size: 1.3rem;
    }
}
