/**
 * POS System - Responsive MVP Styles
 * Teal/Cyan theme | Side panel nav | User-friendly cart | Print-ready receipt
 */

* { box-sizing: border-box; }
html { height: 100%; }
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    color: #333; margin: 0; padding: 0; padding-top: 56px;
    min-height: 100vh; height: 100%;
    -webkit-tap-highlight-color: transparent;
}
h2, h3 { color: #00796b; border-bottom: 2px solid #00bcd4; padding-bottom: 5px; }
.container { max-width: 1400px; margin: auto; padding: 15px; }
.container-fullscreen {
    max-width: none;
    width: 100%;
    min-height: calc(100vh - 56px);
    margin: 0;
    padding: 16px 20px 24px;
    box-sizing: border-box;
}

/* Top bar */
.top-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1030;
    background: linear-gradient(90deg, #004d40 0%, #009688 100%);
    padding: 12px 15px; display: flex; align-items: center; gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.menu-toggle {
    background: rgba(255,255,255,0.2); border: none; color: white;
    width: 44px; height: 44px; border-radius: 8px; font-size: 1.4em;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.menu-toggle:active { background: rgba(255,255,255,0.3); }
.brand { color: #ffeb3b !important; font-weight: 700; font-size: 1.2em; text-decoration: none; flex: 1; }
.top-bar-spacer { flex: 1; }
.user-info { color: rgba(255,255,255,0.9); font-size: 0.9em; }

/* Admin: notification bell & low-stock dropdown */
.top-bar-notify-wrap {
    position: relative;
    margin-right: 12px;
}
.top-bar-notify-btn {
    position: relative;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.top-bar-notify-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.05);
}
.top-bar-notify-badge {
    position: absolute;
    top: 4px; right: 4px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    display: flex; align-items: center; justify-content: center;
    background: #ff5722;
    color: white;
    font-size: 0.7rem; font-weight: 700;
    border-radius: 9px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.top-bar-notify-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px; max-width: 95vw;
    max-height: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.06);
    overflow: hidden;
    z-index: 1050;
    display: flex; flex-direction: column;
}
.top-bar-notify-dropdown[hidden] { display: none !important; }
.notify-dropdown-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
    font-weight: 700; font-size: 0.95rem;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.notify-dropdown-header i { font-size: 1.2rem; }
.notify-dropdown-count {
    margin-left: auto;
    background: #ff9800;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}
.notify-dropdown-body {
    overflow-y: auto;
    max-height: 280px;
    padding: 8px 0;
}
.notify-item {
    display: block;
    padding: 12px 16px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}
.notify-item:hover { background: #f0fdfa; }
.notify-item-empty {
    text-align: center;
    padding: 24px 16px;
    color: #64748b;
    border: none;
}
.notify-item-empty i {
    font-size: 2rem;
    color: #22c55e;
    display: block;
    margin-bottom: 8px;
}
.notify-item-empty p { margin: 0 0 4px; font-weight: 600; color: #334155; }
.notify-item-empty span { font-size: 0.85rem; }
.notify-item-alert {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 2px 12px;
}
.notify-item-store {
    grid-column: 1;
    font-size: 0.75rem;
    color: #00796b;
    font-weight: 600;
}
.notify-item-product {
    grid-column: 1;
    font-size: 0.9rem;
    color: #1e293b;
}
.notify-item-stock {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 8px;
    text-align: center;
}
.notify-item-stock.low { background: #fef3c7; color: #b45309; }
.notify-item-stock.critical { background: #fee2e2; color: #b91c1c; }
.notify-dropdown-footer {
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}
.notify-footer-link {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.9rem; font-weight: 600;
    color: #00796b;
    text-decoration: none;
    transition: color 0.2s;
}
.notify-footer-link:hover { color: #004d40; }
.dark-theme .top-bar-notify-dropdown {
    background: #1e1e1e;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.dark-theme .notify-dropdown-header {
    background: linear-gradient(135deg, #42210b 0%, #333 100%);
    color: #ffb74d;
    border-bottom-color: #333;
}
.dark-theme .notify-item { color: #e0e0e0; border-bottom-color: #333; }
.dark-theme .notify-item:hover { background: #2a2a2a; }
.dark-theme .notify-item-empty { color: #94a3b8; }
.dark-theme .notify-item-empty p { color: #e0e0e0; }
.dark-theme .notify-item-store { color: #4dd0e1; }
.dark-theme .notify-item-product { color: #e0e0e0; }
.dark-theme .notify-dropdown-footer { background: #252525; border-top-color: #333; }
.dark-theme .notify-footer-link { color: #4dd0e1; }
.dark-theme .notify-footer-link:hover { color: #80cbc4; }

/* Side panel nav — starts from very top of page, full height */
.side-panel {
    position: fixed; top: 0; left: 0; width: 280px; max-width: 85vw; height: 100vh;
    background: #fff; z-index: 1040; transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    overflow-y: auto; overflow-x: hidden;
    display: flex; flex-direction: column;
}
.side-panel.open { transform: translateX(0); }
.side-panel-header {
    flex-shrink: 0;
    padding: 0;
    background: linear-gradient(180deg, #004d40 0%, #00695c 50%, #00796b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
}
.side-panel-header::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #ffeb3b, #ffc107);
    opacity: 0.9;
}
.side-panel-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px 14px;
    color: #ffeb3b !important; text-decoration: none; font-weight: 700; font-size: 1.15em;
    transition: opacity 0.2s;
}
.side-panel-brand:hover { opacity: 0.9; color: #ffeb3b !important; }
.side-panel-brand i { font-size: 1.4em; }
.side-panel-brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-panel-user-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px 16px; border-top: 1px solid rgba(255,255,255,0.15);
}
.side-panel-user {
    font-size: 0.95em; opacity: 0.95;
    display: flex; align-items: center; gap: 8px;
}
.close-panel {
    background: rgba(255,255,255,0.15); border: none; color: white;
    font-size: 1.1em; cursor: pointer; padding: 8px 10px; border-radius: 8px;
    transition: background 0.2s;
}
.close-panel:hover { background: rgba(255,255,255,0.25); }
.side-nav { padding: 12px 0 24px; flex: 1; overflow-y: auto; }
.nav-item-link {
    display: flex; align-items: center; gap: 12px; padding: 14px 20px;
    color: #333; text-decoration: none; font-size: 1em; border-bottom: 1px solid #eee;
    transition: background 0.2s, padding-left 0.2s;
}
.nav-item-link:hover { background: #e0f7fa; color: #00796b; padding-left: 24px; }
.nav-item-link i { font-size: 1.2em; width: 24px; text-align: center; }
.nav-item-link.mode-switch { background: #fff8e1; color: #f57c00; }
.nav-item-link.logout { color: #c62828; border-top: 2px solid #eee; margin-top: 10px; }
.side-panel-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1035;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.side-panel-overlay.show { opacity: 1; pointer-events: auto; }

/* Responsive sidebar behavior — menu from top on all breakpoints */
@media (min-width: 992px) {
    .side-panel {
        transform: translateX(0) !important;
        width: 260px;
    }
    .top-bar { left: 260px; }
    .menu-toggle { display: none !important; }
    .container { margin-left: 260px; padding-left: 20px; padding-right: 20px; }
    .container-fullscreen {
        margin-left: 260px;
        width: calc(100% - 260px);
        min-height: 100vh;
        padding: 16px 24px 24px;
    }
    .side-panel-overlay { display: none; }
    .close-panel { display: none; }
}

@media (min-width: 768px) and (max-width: 991px) {
    .side-panel { width: 240px; height: 100vh; top: 0; }
    .top-bar { left: 240px; }
    .container { margin-left: 240px; padding-left: 15px; padding-right: 15px; }
    .container-fullscreen {
        margin-left: 240px;
        width: calc(100% - 240px);
        min-height: 100vh;
    }
}

@media (max-width: 767px) {
    .side-panel { top: 0; height: 100vh; width: 280px; }
    .menu-toggle { display: flex !important; }
    .top-bar { left: 0; }
}

/* Offline banner */
.offline-banner {
    position: fixed; top: 56px; left: 0; right: 0; z-index: 1020;
    background: #ff9800; color: white; padding: 10px 15px; text-align: center;
    font-size: 0.9em;
}

@media (min-width: 768px) {
    .offline-banner { left: 240px; }
}

@media (min-width: 992px) {
    .offline-banner { left: 260px; }
}

input, select, button, .form-control { 
    padding: 10px; margin: 5px 0; border: 1px solid #ccc; border-radius: 8px; 
    font-size: 16px; /* Prevents zoom on iOS */
}
button { background: linear-gradient(45deg, #00bcd4, #00acc1); color: white; cursor: pointer; border: none; }
button:hover { transform: translateY(-1px); }

table { width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: 20px; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
th, td { padding: 12px 15px; text-align: left; }
th { background: linear-gradient(45deg, #009688, #00796b); color: white; font-weight: 600; }
tr:nth-child(even) { background: #f8f9fa; }
tr:hover { background: #e0f7fa; }

.low-stock { color: #ff9800; font-weight: bold; }
.out-of-stock { color: #9e9e9e; font-style: italic; }
.bg-warning { background-color: #ff9800 !important; color: white !important; }
.bg-success-subtle { background-color: #e8f5e9 !important; border: 1px solid #4caf50; }

/* POS - Responsive flex */
.pos-container { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 20px; }
.pos-products { flex: 1 1 400px; min-width: 0; background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.pos-cart-sidebar { 
    flex: 0 0 100%; max-width: 420px; width: 100%; position: sticky; top: 76px;
    padding: 20px; background: #fff; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 2px solid #00bcd4; margin-left: auto;
}
@media (min-width: 768px) { .pos-cart-sidebar { flex: 0 0 380px; } }

/* Cart UX - larger touch targets, clearer layout */
.cart-item-row { padding: 12px 0; border-bottom: 1px solid #eee; min-height: 60px; }
.cart-item-row:last-child { border-bottom: none; }
.cart-total { font-size: 1.4em; font-weight: bold; color: #c62828; padding: 15px 0; border-top: 3px solid #00796b; margin-top: 15px; }
.floating-buttons { padding: 15px 0 0; margin-top: 15px; border-top: 1px solid #eee; }
.floating-buttons .btn { min-height: 48px; font-size: 1em; }
.floating-buttons input[type="number"] { min-height: 44px; }

#productsTable td, #productsTable th { padding: 10px 12px; }

/* POS Product Cards - typing-focused UI */
.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.pos-product-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.pos-product-card:hover {
    border-color: #00bcd4;
    box-shadow: 0 4px 12px rgba(0,188,212,0.15);
}
.pos-product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e0e0e0;
}
.pos-product-info strong { font-size: 1.05em; color: #333; }
.pos-product-price { color: #00796b; font-weight: 600; }
.pos-product-stock { font-size: 0.85em; color: #666; }
.pos-product-form { display: flex; flex-direction: column; gap: 10px; }
.pos-typing-row { display: flex; flex-direction: column; gap: 4px; }
.pos-typing-label {
    font-size: 0.8em; font-weight: 600; color: #555;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.pos-label-discount { color: #c62828; }
.pos-label-markup { color: #2e7d32; }
.pos-typing-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    font-size: 1.1em;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}
.pos-typing-input:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 0 3px rgba(0,188,212,0.2);
}
.pos-input-discount:focus { border-color: #c62828; box-shadow: 0 0 0 3px rgba(198,40,40,0.15); }
.pos-input-markup:focus { border-color: #2e7d32; box-shadow: 0 0 0 3px rgba(46,125,50,0.15); }
.pos-typing-input::placeholder { color: #aaa; }
.pos-add-btn {
    min-height: 50px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 4px;
    background: linear-gradient(135deg, #00bcd4, #009688);
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.pos-add-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,188,212,0.35);
}
.pos-add-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.cart-qty-form { display: inline-block; }
.cart-qty-input {
    width: 60px;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 1em;
    text-align: center;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}
.cart-qty-input:focus {
    outline: none;
    border-color: #00bcd4;
}

/* ========== LOGIN PAGE — Creative full-page experience ========== */
.login-page {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; overflow-y: auto;
    background: linear-gradient(145deg, #003d33 0%, #004d40 35%, #00695c 70%, #00897b 100%);
}
.login-page-bg {
    position: absolute; inset: 0; overflow: hidden; pointer-events: none;
}
.login-bg-shape {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.25;
    animation: login-float 20s ease-in-out infinite;
}
.login-bg-shape-1 {
    width: 400px; height: 400px; background: #ffeb3b;
    top: -100px; right: -100px; animation-delay: 0s;
}
.login-bg-shape-2 {
    width: 300px; height: 300px; background: #00bcd4;
    bottom: 10%; left: -80px; animation-delay: -7s;
}
.login-bg-shape-3 {
    width: 250px; height: 250px; background: #80cbc4;
    top: 50%; left: 50%; animation-delay: -14s;
}
.login-bg-grid {
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 48px 48px;
}
@keyframes login-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}
.login-wrapper {
    position: relative; z-index: 1;
    width: 100%; max-width: 920px;
    animation: login-appear 0.6s ease-out;
}
@keyframes login-appear {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-header {
    text-align: center; margin-bottom: 28px;
}
.login-logo {
    display: inline-flex; align-items: center; gap: 12px;
    color: #ffeb3b; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em;
    text-shadow: 0 2px 20px rgba(0,0,0,0.2);
}
.login-logo i { font-size: 2rem; }
.login-tagline {
    margin: 8px 0 0; color: rgba(255,255,255,0.85); font-size: 1rem; font-weight: 500;
}
.login-panel {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.5) inset;
    overflow: hidden;
}
.login-panel-inner {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0;
}
@media (max-width: 768px) {
    .login-panel-inner { grid-template-columns: 1fr; }
}
.login-section {
    padding: 32px 28px;
}
.login-section-stores { border-right: 1px solid rgba(0,0,0,0.06); }
@media (max-width: 768px) {
    .login-section-stores { border-right: none; border-bottom: 1px solid rgba(0,0,0,0.06); }
}
.login-section-form { background: rgba(248,250,252,0.6); }
.login-section-head { margin-bottom: 20px; }
.login-step {
    display: inline-block;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
    color: #00796b; margin-bottom: 6px;
}
.login-section-title {
    font-size: 1.25rem; font-weight: 700; color: #1a1a1a; margin: 0 0 4px;
}
.login-section-desc {
    font-size: 0.9rem; color: #64748b; margin: 0;
}
.store-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px;
}
.store-card {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 20px 14px; min-height: 110px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.store-card:hover {
    border-color: #00bcd4;
    box-shadow: 0 8px 24px rgba(0,188,212,0.2);
    transform: translateY(-2px);
}
.store-card.selected {
    border-color: #00796b;
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    box-shadow: 0 8px 24px rgba(0,121,107,0.25);
    transform: translateY(-2px);
}
.store-card-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,121,107,0.1);
    border-radius: 12px;
    margin-bottom: 10px;
    font-size: 1.4rem; color: #00796b;
    transition: background 0.2s, color 0.2s;
}
.store-card.selected .store-card-icon {
    background: #00796b; color: #fff;
}
.store-card-name {
    font-size: 0.9rem; font-weight: 700; color: #1e293b;
    display: block; line-height: 1.3;
}
.store-card-meta {
    font-size: 0.75rem; color: #64748b; margin-top: 2px;
}
.store-card-check {
    position: absolute; top: 10px; right: 10px;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    background: #00796b; color: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s, transform 0.2s;
}
.store-card.selected .store-card-check {
    opacity: 1; transform: scale(1);
}
.master-admin-card .store-card-icon { background: rgba(245,124,0,0.15); color: #e65100; }
.master-admin-card.selected .store-card-icon { background: #f57c00; color: #fff; }
.master-admin-card.selected { background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%); border-color: #f57c00; }
.master-admin-card .store-card-check { background: #f57c00; }
.login-selected-store {
    display: flex; align-items: center; gap: 10px;
    margin-top: 16px; padding: 12px 14px;
    background: #f1f5f9;
    border-radius: 12px;
    font-size: 0.9rem; color: #64748b;
}
.login-selected-store i { font-size: 1.1rem; flex-shrink: 0; }
.login-selected-store.selected {
    background: #e0f7fa;
    color: #00796b;
    border: 1px solid rgba(0,121,107,0.2);
}
.login-form { margin-top: 0; }
.login-field {
    margin-bottom: 18px;
}
.login-field label {
    display: block; font-size: 0.85rem; font-weight: 600; color: #334155;
    margin-bottom: 6px;
}
.login-field input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.login-field input:focus {
    outline: none;
    border-color: #00796b;
    box-shadow: 0 0 0 4px rgba(0,121,107,0.15);
}
.login-field input::placeholder { color: #94a3b8; }
.login-submit {
    width: 100%;
    margin-top: 8px; padding: 16px 24px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font-size: 1.05rem; font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #00796b 0%, #004d40 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    box-shadow: 0 4px 14px rgba(0,77,64,0.4);
}
.login-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,77,64,0.45);
}
.login-submit:disabled {
    opacity: 0.5; cursor: not-allowed;
}
.login-submit i { font-size: 1.2rem; }
.login-footer {
    text-align: center; margin-top: 24px;
}
.login-footer p {
    font-size: 0.85rem; color: rgba(255,255,255,0.7);
}
body.login-visible .top-bar { display: none !important; }
body.login-visible { padding-top: 0 !important; }

/* Receipt - thermal printer friendly */
.receipt-body { max-width: 80mm; margin: 0 auto; padding: 15px; font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.3; background: #fff; }
.receipt-thermal { width: 80mm; margin: 0 auto; padding: 0; }
.receipt-header { text-align: center; margin: 0 0 8px 0; font-weight: bold; padding: 0; }
.receipt-header h4 { margin: 0; font-size: 14px; font-weight: 900; letter-spacing: 1px; }
.receipt-header p { margin: 0; font-size: 10px; }
.receipt-details { border-top: 1px dashed #000; padding: 8px 0; margin: 8px 0; font-size: 10px; }
.receipt-details p { margin: 0; line-height: 1.4; }
.receipt-items { border-top: 1px dashed #000; padding: 8px 0; margin: 8px 0; }
.receipt-items p { margin: 0; font-size: 10px; line-height: 1.4; font-family: 'Courier New', monospace; }
.receipt-total { border-top: 2px solid #000; font-size: 11px; font-weight: bold; margin: 10px 0 0 0; padding: 8px 0 0 0; }
.receipt-total p { margin: 0; padding: 2px 0; font-family: 'Courier New', monospace; }
.receipt-footer { text-align: center; margin: 8px 0; font-weight: bold; padding: 0; }
.receipt-footer p { margin: 0; font-size: 10px; }
.receipt-actions .btn { min-height: 48px; }

/* Thermal printer 80mm width optimization */
@media print {
    body { padding: 0; background: white; margin: 0; }
    .no-print { display: none !important; }
    #receiptPrintArea { display: block !important; margin: 0; padding: 0; max-width: 80mm; width: 80mm; font-family: 'Courier New', monospace; }
    .receipt-body { box-shadow: none; border: none; max-width: 80mm; width: 80mm; margin: 0; padding: 5px; }
    .receipt-thermal { width: 80mm; margin: 0; padding: 0; }
    .container { margin: 0; padding: 0; max-width: 80mm; width: 80mm; }
    /* Reduce margins and padding for print */
    .receipt-header { margin: 0 0 4px 0; }
    .receipt-details { margin: 4px 0; padding: 4px 0; }
    .receipt-items { margin: 4px 0; padding: 4px 0; }
    .receipt-total { margin: 4px 0 0 0; padding: 4px 0 0 0; }
    .receipt-footer { margin: 4px 0; }
}

@media (max-width: 576px) {
    body { padding-top: 52px; }
    .container { padding: 10px; }
    h2 { font-size: 1.2em; }
    .pos-cart-sidebar { max-width: 100%; }
}

/* Dark Theme */
.dark-theme {
    background: linear-gradient(135deg, #121212 0%, #1e1e1e 100%);
    color: #e0e0e0;
}
.dark-theme h2, .dark-theme h3 {
    color: #00bcd4;
    border-bottom-color: #009688;
}
.dark-theme .top-bar {
    background: linear-gradient(90deg, #1a1a1a 0%, #333 100%);
}
.dark-theme .side-panel {
    background: #1e1e1e;
}
.dark-theme .side-panel-header {
    background: linear-gradient(180deg, #1a1a1a 0%, #252525 50%, #333 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.dark-theme .side-panel-header::before {
    background: linear-gradient(90deg, #00bcd4, #009688);
    opacity: 0.8;
}
.dark-theme .side-panel-brand { color: #00bcd4 !important; }
.dark-theme .side-panel-user-row { border-top-color: rgba(255,255,255,0.1); }
.dark-theme .close-panel { background: rgba(255,255,255,0.1); }
.dark-theme .close-panel:hover { background: rgba(255,255,255,0.2); }
.dark-theme .nav-item-link {
    color: #e0e0e0;
    border-bottom-color: #333;
}
.dark-theme .nav-item-link:hover {
    background: #333;
}
.dark-theme .table {
    color: #e0e0e0;
}
.dark-theme .table th, .dark-theme .table td {
    border-color: #333;
}
.dark-theme .form-control {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #555;
}
.dark-theme .form-control:focus {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #00bcd4;
}
.dark-theme .btn-primary {
    background: #00796b;
    border-color: #00796b;
}
.dark-theme .btn-primary:hover {
    background: #004d40;
}
.dark-theme .btn-success {
    background: #388e3c;
    border-color: #388e3c;
}
.dark-theme .btn-danger {
    background: #d32f2f;
    border-color: #d32f2f;
}
.dark-theme .btn-warning {
    background: #f57c00;
    border-color: #f57c00;
}
.dark-theme .card, .dark-theme .bg-light {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
}
.dark-theme .btn-warning {
    background: #f57c00;
    border-color: #f57c00;
}
.dark-theme .card, .dark-theme .bg-light {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
}
.dark-theme .text-primary { color: #00bcd4 !important; }
.dark-theme .text-success { color: #4caf50 !important; }
.dark-theme .text-info { color: #2196f3 !important; }

/* Custom Menu Link Modal */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.modal-header {
    background: linear-gradient(135deg, #00796b, #004d40);
    color: white;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}
.modal-title {
    font-weight: 600;
}
.btn-close {
    filter: invert(1);
}
.modal-body iframe {
    border-radius: 0 0 12px 12px;
}
.dark-theme .modal-content {
    background: #1e1e1e;
    color: #e0e0e0;
}
.dark-theme .modal-header {
    background: linear-gradient(135deg, #333, #1a1a1a);
}

/* User-friendly & device-fit: touch targets, responsive tables */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.table-receipt-history,
.receipts-table {
    min-width: 720px;
}
.receipt-actions-cell {
    white-space: nowrap;
}
.receipt-actions-cell .btn {
    margin: 2px 4px 2px 0;
}
.receipt-modal-body {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    max-height: 70vh;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}
.dark-theme .receipt-modal-body {
    background: #2a2a2a;
    color: #e0e0e0;
}
.page-header-responsive {
    margin-bottom: 1rem;
}
.page-header-responsive h2 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    margin: 0;
}
.receipt-history-card .form-label {
    margin-bottom: 0.25rem;
}

/* Container and main area fit screen on small devices */
@media (max-width: 991px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
        margin-left: 0;
    }
    .container-fullscreen {
        width: 100%;
        margin-left: 0;
        min-height: calc(100vh - 56px);
        padding: 12px 12px 20px;
    }
    .table-receipt-history,
    .receipts-table {
        min-width: 600px;
    }
}
@media (max-width: 767px) {
    .container {
        padding: 10px 8px;
    }
    .container-fullscreen {
        padding: 10px 8px 16px;
        min-height: calc(100vh - 56px);
    }
    .top-bar .brand {
        font-size: 1rem;
    }
    .receipt-actions-cell {
        white-space: normal;
    }
    .receipt-actions-cell .btn {
        margin: 4px 4px 0 0;
    }
    .card-body .row.g-3 {
        row-gap: 0.75rem;
    }
    .pos-container {
        flex-direction: column;
    }
    .pos-cart-sidebar {
        position: static;
        max-width: 100%;
    }
}
@media (max-width: 576px) {
    body { padding-top: 52px; }
    .container { padding: 8px; }
    h2 { font-size: 1.15rem; }
    .receipt-history-card .col-12 {
        padding-left: 0;
        padding-right: 0;
    }
}

/* Sales table: full width and readable on all screens */
.table-responsive table {
    font-size: clamp(0.85rem, 2vw, 1rem);
}
.table th, .table td {
    padding: 10px 8px;
    vertical-align: middle;
}
@media (max-width: 767px) {
    .table th, .table td {
        padding: 8px 6px;
        font-size: 0.9rem;
    }
}
