/* Ruma Eco Bricks - Enterprise Aesthetic Eco-Green Theme & Global Styling */
:root {
    --primary: #15803d;         /* Eco Green */
    --primary-hover: #166534;   /* Deep Forest Green */
    --primary-light: #dcfce7;   /* Soft Sage Green */
    --primary-dark: #0f3922;    /* Dark Pine */
    --secondary: #0f172a;       /* Slate Dark */
    --accent: #059669;          /* Emerald Green */
    --accent-light: #ecfdf5;    /* Mint tint */
    --sidebar-bg: #0b1f14;      /* Deep Forest Night */
    --sidebar-hover: #143823;   /* Rich Emerald Hover */
    --content-bg: #f3f6f4;      /* Crisp Off-White / Natural Clean Canvas */
    --card-border: #e2e8f0;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --gold: #d97706;            /* Premium Accent */
    --gold-light: #fef3c7;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--content-bg);
    color: var(--text-dark);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #86efac;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #22c55e;
}

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

.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    color: #f8fafc;
    flex-shrink: 0;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.sidebar .brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.25);
}

.sidebar .brand img {
    height: 34px;
    width: 34px;
    max-height: 34px;
    max-width: 34px;
    object-fit: contain;
    border-radius: 6px;
    background: #ffffff;
    padding: 2px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

/* Global Strict Dimensions for Logos across All Pages & Invoices */
img.main-brand-logo, .main-brand-logo {
    height: 40px !important;
    max-height: 40px !important;
    max-width: 80px !important;
    width: auto !important;
    object-fit: contain !important;
}

img.cert-logo-img, .cert-logo-img {
    height: 28px !important;
    max-height: 28px !important;
    max-width: 42px !important;
    width: auto !important;
    object-fit: contain !important;
}

.brand-logo-compact {
    height: 34px !important;
    width: 34px !important;
    max-height: 34px !important;
    max-width: 34px !important;
    object-fit: contain !important;
}

.sidebar .brand i {
    color: #4ade80;
    font-size: 1.6rem;
}

.sidebar-nav {
    list-style: none;
    padding: 15px 12px;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.2s ease;
}

.sidebar-nav a i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: #86efac;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.sidebar-nav a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(21, 128, 61, 0.4);
}

.sidebar-nav a.active i {
    color: #ffffff;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--content-bg);
}

.topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.content-body {
    padding: 24px;
    flex-grow: 1;
}

/* Stat & KPI Cards */
.stat-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.55rem;
    flex-shrink: 0;
}

.stat-icon.green { background: #dcfce7; color: #15803d; }
.stat-icon.emerald { background: #ecfdf5; color: #059669; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.blue { background: #e0f2fe; color: #0284c7; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.gold { background: #fef3c7; color: #d97706; }

/* Custom Tables */
.table-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}

.table-card .card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--card-border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
}

.custom-table {
    margin: 0;
}

.custom-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
}

.custom-table td {
    padding: 12px 16px;
    vertical-align: middle;
    color: #334155;
    font-size: 0.92rem;
    border-bottom: 1px solid #f1f5f9;
}

.custom-table tbody tr:hover {
    background: #f8fbf9;
}

/* Green Buttons & Highlights */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}
.text-primary {
    color: var(--primary) !important;
}
.bg-primary {
    background-color: var(--primary) !important;
}

/* POS Screen Styles */
.pos-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f4f7f5;
}

.pos-products-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid #cbd5e1;
}

.pos-cart-col {
    width: 470px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-shadow: -4px 0 20px rgba(0,0,0,0.06);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.pos-prod-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.pos-prod-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(21, 128, 61, 0.2);
}

.pos-prod-card img {
    width: 100%;
    height: 95px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f8fafc;
}

.pos-prod-title {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.25;
    color: #1e293b;
}

.pos-prod-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.98rem;
}

.pos-prod-stock {
    font-size: 0.74rem;
    color: #64748b;
}

/* Aesthetic Invoice Styles */
.invoice-print-container {
    width: 100%;
    max-width: 860px;
    margin: 20px auto;
    background: #ffffff;
    padding: 35px 40px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.08);
    border-radius: 12px;
    border-top: 6px solid var(--primary);
}

.invoice-header-logos {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-light);
}

.invoice-main-logo {
    max-height: 70px;
    max-width: 150px;
    object-fit: contain;
}

.invoice-cert-logo {
    max-height: 55px;
    max-width: 80px;
    object-fit: contain;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.invoice-table th {
    background: var(--primary);
    color: #ffffff;
    padding: 10px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    text-transform: uppercase;
}

.invoice-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.92rem;
    vertical-align: middle;
}

.invoice-prod-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

@media print {
    body {
        background: #ffffff !important;
        padding: 0 !important;
    }
    .no-print {
        display: none !important;
    }
    .invoice-print-container {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    @page {
        size: A4;
        margin: 12mm;
    }
}

/* Responsive Breakpoints */
@media (max-width: 991px) {
    .sidebar {
        position: fixed;
        left: -270px;
        top: 0;
        bottom: 0;
    }
    .sidebar.show {
        left: 0;
    }
    .pos-wrapper {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }
    .pos-cart-col {
        width: 100%;
        height: auto;
    }
}
