/* Bakery Master - Modern Theme & Stylesheet */
:root {
    --primary: #8b4513;        /* Warm SaddleBrown */
    --primary-hover: #70360f;
    --primary-light: #fbeee6;
    --primary-dark: #4a240a;
    --secondary: #d97706;      /* Bakery Amber */
    --secondary-light: #fef3c7;
    --accent: #b45309;
    
    --bg-main: #fcf9f5;
    --bg-card: #ffffff;
    --bg-sidebar: #2c1a0e;
    --sidebar-text: #e8d8cc;
    --sidebar-hover: #432818;
    
    --text-primary: #2d1810;
    --text-secondary: #665248;
    --text-muted: #8c766b;
    --border-color: #ebdcd2;
    --border-light: #f3eae3;

    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #ca8a04;
    --warning-bg: #fef9c3;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info: #0284c7;
    --info-bg: #e0f2fe;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 10px -1px rgba(139, 69, 19, 0.08), 0 2px 4px -1px rgba(139, 69, 19, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(139, 69, 19, 0.12), 0 4px 6px -2px rgba(139, 69, 19, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-brand span {
    font-size: 0.75rem;
    color: #bfa593;
}

.sidebar-user {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user .role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--secondary);
    color: #fff;
    margin-bottom: 4px;
}

.sidebar-user .user-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 12px;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-item {
    margin-bottom: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.2s;
}

.sidebar-link:hover, .sidebar-link.active {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.4);
}

.sidebar-link .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.15);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s;
}

.logout-btn:hover {
    background: var(--danger);
    color: #fff;
}

/* Main Content Area */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.top-navbar {
    background: #fff;
    height: 65px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: var(--shadow-sm);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
}

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

/* Cards & Containers */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Grid Systems */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* Stat Widgets */
.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

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

.stat-info .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--secondary);
    color: #fff;
}
.btn-secondary:hover {
    background: var(--accent);
}

.btn-outline {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--border-light);
    border-color: var(--text-muted);
}

.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}

.table th {
    background: #fbf5ef;
    padding: 12px 16px;
    font-weight: 700;
    color: var(--primary-dark);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #fdfaf7;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Merged Sheet Table Styling (Page 11 Matrix) */
.merged-sheet-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.merged-sheet-table th, .merged-sheet-table td {
    border: 1px solid #d4c2b4;
    padding: 10px 14px;
    text-align: center;
}

.merged-sheet-table th {
    background: #eadecc;
    color: #4a240a;
    font-weight: 700;
}

.merged-sheet-table th.item-col, .merged-sheet-table td.item-col {
    text-align: left;
    font-weight: 600;
    background: #faf4ed;
}

.merged-sheet-table th.total-col, .merged-sheet-table td.total-col {
    background: #fff4e5;
    font-weight: 700;
    color: #8b4513;
    font-size: 1rem;
}

/* Alert Notifications */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.92rem;
    font-weight: 500;
}

.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #bbf7d0; }
.alert-error, .alert-danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: #854d0e; border: 1px solid #fef08a; }
.alert-info { background: var(--info-bg); color: #075985; border: 1px solid #bae6fd; }

/* Landing / Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top right, #faece1, #fcf9f5);
    padding: 20px;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 36px;
    border: 1px solid var(--border-color);
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo .icon-wrap {
    width: 68px;
    height: 68px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 12px;
}

.auth-logo h1 {
    font-size: 1.6rem;
    color: var(--primary-dark);
    font-weight: 800;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.portal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 24px;
}

.portal-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 2px solid var(--border-color);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-weight: 600;
}

.portal-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.portal-btn .icon {
    font-size: 2rem;
}

.portal-btn .info h4 {
    font-size: 1.05rem;
    color: var(--primary-dark);
}

.portal-btn .info p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
}

/* Order Item Row styling for Shop Order Page */
.order-item-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.order-item-card:hover {
    border-color: var(--secondary);
}

.qty-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-input-group input {
    width: 85px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.qty-input-group input:focus {
    border-color: var(--primary);
    outline: none;
}

.qty-unit {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 32px;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
    }
    
    .sidebar.open {
        left: 0;
    }

    .nav-toggle {
        display: block;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .content-body {
        padding: 16px;
    }

    .top-navbar {
        padding: 0 16px;
    }
}

/* =========================================
   RETAIL POS BILLING COUNTER STYLES
   ========================================= */
.pos-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(340px, 380px);
    gap: 22px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1140px) {
    .pos-layout {
        display: flex;
        flex-direction: column;
        gap: 28px;
    }

    .pos-right-section {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        margin: 0 auto;
    }

    .pos-cart-panel {
        max-width: 580px;
        width: 100% !important;
        margin: 0 auto !important;
        position: static !important;
    }
}

.pos-cat-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.pos-cat-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: #fff;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pos-cat-tab:hover, .pos-cat-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.25);
}

.pos-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

.pos-item-card {
    background: #fff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.pos-item-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pos-item-card:active {
    transform: scale(0.98);
}

.pos-item-card .item-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.25;
}

.pos-item-card .item-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.pos-item-card .item-stock {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    display: inline-block;
    margin-top: 4px;
}

.pos-item-card .item-stock.low {
    background: #fee2e2;
    color: #991b1b;
}

.pos-cart-panel {
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    position: sticky;
    top: 85px;
}

.pos-payment-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 14px 0;
}

.payment-pill {
    padding: 10px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.payment-pill:hover, .payment-pill.active {
    border-color: var(--primary);
    background: #fdf8f4;
    color: var(--primary-dark);
}

.payment-pill.active {
    box-shadow: inset 0 0 0 1px var(--primary);
}

