@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --app-bg: #f3f4f6;
    --app-sidebar: #ffffff;
    --app-sidebar-border: #e5e7eb;
    --app-sidebar-active: #2563eb;
    --app-sidebar-text: #4b5563;
    --app-card: #ffffff;
    --app-border: #e5e7eb;
    --app-text: #1f2937;
    --app-text-muted: #6b7280;
    --app-primary: #2563eb;
    --app-success: #10b981;
    --app-danger: #ef4444;
    --app-warning: #f59e0b;
    --app-info: #3b82f6;
    --font-sans: 'Inter', sans-serif;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: var(--font-sans);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Sidebar Shell Layout */
.app-layout {
    display: grid;
    grid-template-columns: 80px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--app-sidebar);
    border-right: 1px solid var(--app-sidebar-border);
    color: var(--app-text);
    padding-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--app-text);
    text-decoration: none;
    padding: 1.60rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex-grow: 1;
}

.sidebar-item {
    width: 100%;
    text-align: center;
    border-top: 1px solid #eee;
}

.sidebar-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.75rem 0;
    color: var(--app-text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-item a:hover {
    color: var(--app-primary);
    background: rgba(37, 99, 235, 0.04);
}

.sidebar-item-group {
    position: relative;
    width: 100%;
}

.sidebar-submenu {
    position: absolute;
    left: calc(100% + 0.5rem);
    top: 0.15rem;
    width: 220px;
    padding: 0.5rem 0;
    background: var(--app-sidebar);
    border: 1px solid var(--app-sidebar-border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    display: none;
    z-index: 200;
}

.sidebar-item-group:hover .sidebar-submenu,
.sidebar-item-group.active .sidebar-submenu {
    display: block;
}

.sidebar-submenu-item {
    display: block;
    padding: 0.55rem 1rem;
    color: var(--app-text-muted);
    text-decoration: none;
    text-align: left;
    font-size: 0.85rem;
    white-space: nowrap;
}

.sidebar-submenu-item:hover,
.sidebar-submenu-item.active {
    color: var(--app-primary);
    background: rgba(37, 99, 235, 0.05);
}

.sidebar-item.active a {
    color: var(--app-primary);
    background: rgba(37, 99, 235, 0.08);
    border-left-color: var(--app-primary);
}

.sidebar-item a span.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    font-size: 1.25rem;
    color: var(--app-text);
}

.sidebar-footer {
    width: 100%;
    padding: 0 0.5rem;
    text-align: center;
}

.app-main {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.app-shell {
    margin: 0 auto;
    padding: 0 1rem;
}

.inventory-row-actions .btn {
    min-width: 5.5rem;
}

.inventory-row-actions form {
    margin: 0;
}

.inventory-row-actions form .btn {
    min-width: auto;
}

.config-grid,
.config-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.config-card {
    display: block;
    padding: 1.5rem;
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    background: var(--app-card);
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.config-card:hover,
.config-card.active {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
    border-color: rgba(37, 99, 235, 0.15);
}

.config-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--app-text);
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.config-card h2 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.config-card p {
    margin: 0;
    font-size: 0.94rem;
    color: var(--app-text-muted);
}

.taxonomy-container {
    display: grid;
    grid-template-columns: minmax(280px, 340px) 1fr;
    gap: 1.5rem;
}

@media (max-width: 991px) {
    .taxonomy-container {
        grid-template-columns: 1fr;
    }
}

.taxonomy-panel {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 1rem;
    padding: 1.5rem;
}

.taxonomy-panel h2 {
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
    font-weight: 700;
}

.taxonomy-panel p {
    color: var(--app-text-muted);
    margin-bottom: 1.25rem;
}

.taxonomy-table-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
}

.taxonomy-table-header .input-group-sm {
    min-width: 220px;
}

.taxonomy-table-header .bulk-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* Top Navigation Bar */
.app-topbar {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Common Card Styles */
.app-card {
    background: var(--app-card);
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.01);
    transition: all 0.2s ease;
}

.app-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.02);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--app-border);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
}

.app-header > div:first-child {
    min-width: 0;
    max-width: 68%;
}

.app-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--app-text);
    margin: 0;
}

.app-subtitle {
    font-size: 0.85rem;
    color: var(--app-text-muted);
    margin: 0.25rem 0 0;
}

/* Touch Input & Buttons */
.touch-input, .touch-select, .touch-btn {
    min-height: 2.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.touch-input:focus, .touch-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.touch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.15s ease-in-out;
}

.touch-btn-lg {
    min-height: 3.25rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 0.5rem;
}

/* Category Filter Pills */
.category-filter-list {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.category-btn {
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--app-border);
    background: #ffffff;
    color: var(--app-text);
    transition: all 0.15s ease;
}

.category-btn.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}

/* Stock & Status Filter Pills */
.stock-filter-list {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.stock-filter-btn {
    white-space: nowrap;
    border-radius: 999px;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--app-border);
    background: #ffffff;
    color: var(--app-text);
    transition: all 0.15s ease;
}

.stock-filter-btn.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}

/* Product Tile Styling */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.product-tile {
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    background: #ffffff;
    padding: 0.75rem;
    text-align: left;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
}

.product-tile:hover {
    border-color: var(--app-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -3px rgba(37, 99, 235, 0.08);
}

.product-tile-image-container {
    width: 100%;
    height: 120px;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
    background: #f3f4f6;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-tile-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-add-circle-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--app-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    transition: all 0.15s ease;
    border: none;
    padding: 0;
    line-height: 1;
}

.product-tile:hover .product-add-circle-btn {
    transform: scale(1.1);
    background-color: #1d4ed8;
}

.product-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--app-text);
    margin-bottom: 0.15rem;
    line-height: 1.3;
}

.product-price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--app-primary);
}

/* POS Counter Split Screen layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 620px;
    gap: 1.5rem;
    align-items: start;
}

/* Shopping Cart */
.cart-panel {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 1.5rem;
}

.cart-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--app-border);
    padding-bottom: 0.75rem;
}

.cart-items-list {
    max-height: 340px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: #f9fafb;
}

.cart-item-info {
    flex-grow: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--app-text);
}

.cart-item-price {
    font-size: 0.75rem;
    color: var(--app-text-muted);
    margin-top: 0.15rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Circular Steppers for Quantity */
.cart-qty-wrap {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: #ffffff;
    padding: 0.15rem;
}

.cart-qty-wrap button {
    width: 28px;
    height: 28px;
    border-radius: 50% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    font-weight: 700;
    font-size: 0.85rem;
    background: #ffffff;
    border: 1px solid var(--app-border);
    color: var(--app-text);
    transition: all 0.15s ease;
}

.cart-qty-wrap button:hover {
    background: #f3f4f6;
    color: var(--app-primary);
}

.cart-qty-input {
    width: 50px;
    border: 0 !important;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    padding: 0;
}

.cart-qty-input:focus {
    box-shadow: none !important;
    outline: none !important;
}

/* Totals Box breakdown */
.totals-box {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--app-text-muted);
}

.totals-grand {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--app-primary);
    border-top: 1px dashed var(--app-border);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.due-warning {
    color: var(--app-danger);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Toast stacking */
.app-toast-stack {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1080;
    width: 320px;
}

.app-toast {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    background: #ffffff;
    margin-bottom: 0.5rem;
}

/* Responsive Rules */
@media (max-width: 991px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .pos-layout {
        grid-template-columns: 1fr;
    }
    .cart-panel {
        position: static;
    }
}

/* Polished Table Styling */
.table {
    width: 100%;
    margin-bottom: 0;
    color: var(--app-text);
    vertical-align: middle;
    border-color: var(--app-border);
}
.table > :not(caption) > * > * {
    padding: 0.85rem 1.25rem;
    background-color: var(--bs-table-bg);
    border-bottom-width: 1px;
    box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg);
}
.table th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--app-text-muted);
    background-color: #f9fafb !important;
    border-bottom: 1px solid var(--app-border) !important;
}
.table td {
    font-size: 0.875rem;
    border-bottom: 1px solid var(--app-border) !important;
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: rgba(243, 244, 246, 0.5);
    color: var(--app-text);
}

/* Status Indicator Dot */
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.825rem;
    font-weight: 600;
}
.status-dot::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.status-dot.success { color: var(--app-success); }
.status-dot.success::before { background-color: var(--app-success); }
.status-dot.warning { color: var(--app-warning); }
.status-dot.warning::before { background-color: var(--app-warning); }
.status-dot.danger { color: var(--app-danger); }
.status-dot.danger::before { background-color: var(--app-danger); }

/* Dashboard Analytics Widgets */
.dashboard-summary-row {
    margin-bottom: 1.5rem;
}
.dashboard-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    padding: 1.5rem;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}
.dashboard-card-title {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--app-text-muted);
    margin-bottom: 0.75rem;
}
.dashboard-card-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--app-text);
}
.dashboard-card-note {
    font-size: 0.85rem;
    color: var(--app-text-muted);
}
.dashboard-card-success { border-left: 0.4rem solid #10b981; }
.dashboard-card-warning { border-left: 0.4rem solid #f59e0b; }
.dashboard-card-primary { border-left: 0.4rem solid #2563eb; }
.dashboard-card-danger { border-left: 0.4rem solid #ef4444; }

.dashboard-analytics-row {
    margin-bottom: 1.5rem;
}
.dashboard-analytics-card,
.dashboard-insight-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}
.dashboard-chart {
    min-height: 240px;
    padding: 1rem 0 0.5rem;
}
.dashboard-chart-grid {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 220px;
}
.dashboard-chart-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}
.dashboard-chart-bar {
    width: 100%;
    max-width: 26px;
    border-radius: 999px 999px 0 0;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.95), rgba(37, 99, 235, 0.55));
    transition: background 0.2s ease;
}
.dashboard-chart-bar-wrap:hover .dashboard-chart-bar {
    background: linear-gradient(180deg, rgba(37, 99, 235, 1), rgba(37, 99, 235, 0.65));
}
.dashboard-chart-label {
    margin-top: 0.9rem;
    font-size: 0.75rem;
    color: var(--app-text-muted);
}
.dashboard-mini-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 0.85rem;
    padding: 1rem;
    background: #f8fafc;
}
.dashboard-mini-card span {
    display: block;
    font-size: 0.75rem;
    color: var(--app-text-muted);
    margin-bottom: 0.35rem;
}
.dashboard-action-list {
    display: grid;
    gap: 1rem;
}
.dashboard-action-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 1rem;
    background: #f8fafc;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease;
}
.dashboard-action-item:hover {
    transform: translateY(-1px);
    background: #eef2ff;
}
.dashboard-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.dashboard-summary-footer {
    border-radius: 1rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.05);
}

/* Responsive dashboard rules */
@media (max-width: 991px) {
    .dashboard-chart-grid {
        height: 180px;
    }
}

/* Polished Pagination Links */
.pagination {
    display: flex;
    justify-content: flex-end;
    gap: 0.25rem;
    margin: 1.25rem 0 0;
    padding-left: 0;
    list-style: none;
}
.pagination li {
    display: inline-block;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 0.5rem;
    border-radius: 0.375rem;
    border: 1px solid var(--app-border);
    background: #ffffff;
    color: var(--app-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}
.pagination a:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
    background: rgba(37, 99, 235, 0.04);
}
.pagination .active a, .pagination .active span {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #ffffff;
}

