:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --bg-input: #1a1a3e;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0b0;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --border: #2a2a4a;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* === LAYOUT === */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 80px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    font-size: 1.4rem;
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.user-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

/* === LOGIN === */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    gap: 24px;
}

.login-screen h1 {
    font-size: 2rem;
    color: var(--accent);
}

.login-screen .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.pin-display {
    display: flex;
    gap: 12px;
    margin: 20px 0;
}

.pin-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    transition: background 0.2s;
}

.pin-dot.filled {
    background: var(--accent);
}

.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    max-width: 280px;
}

.pin-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-btn:active {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(0.95);
}

.pin-btn.clear {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-error {
    color: var(--danger);
    font-size: 0.9rem;
    min-height: 20px;
}

/* === BUTTONS === */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.btn-large {
    padding: 18px 32px;
    font-size: 1.2rem;
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === CARDS === */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* === HOME MENU === */
.home-menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 20px;
}

.menu-btn {
    padding: 28px 24px;
    border-radius: 16px;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.menu-btn:active {
    transform: scale(0.98);
    border-color: var(--accent);
}

.menu-btn .menu-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.menu-btn .menu-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* === LISTS === */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.1s;
}

.list-item:active {
    background: var(--border);
}

.list-item-name {
    font-weight: 500;
    font-size: 1rem;
}

.list-item-detail {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.list-item-price {
    font-weight: 700;
    color: var(--accent);
    font-size: 1.1rem;
}

.list-item-badge {
    background: var(--accent);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.list-item-badge.success {
    background: var(--success);
}

.list-item-badge.warning {
    background: var(--warning);
}

/* === FORMS === */
.form-group {
    margin-bottom: 16px;
}

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

.form-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
}

.form-input:focus {
    border-color: var(--accent);
}

/* === SALE SCREEN === */
.sale-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sale-member {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 600;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.product-tile {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}

.product-tile:active {
    border-color: var(--accent);
    background: var(--bg-secondary);
}

.product-tile.selected {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.1);
}

.product-tile-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.product-tile-price {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
}

/* === CART === */
.cart {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.cart-title {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.cart-qty button {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-qty button:active {
    background: var(--accent);
}

.cart-qty span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.cart-item-total {
    font-weight: 700;
    color: var(--accent);
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 2px solid var(--border);
    font-size: 1.2rem;
    font-weight: 700;
}

.cart-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

/* === SETTLE === */
.settle-amount {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent);
    margin: 16px 0;
}

.settle-breakdown {
    max-height: 300px;
    overflow-y: auto;
}

.settle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.settle-item-date {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* === NAV BAR === */
.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
    padding: 8px 16px;
    z-index: 100;
}

.nav-bar-inner {
    display: flex;
    gap: 4px;
    max-width: 800px;
    width: 100%;
    justify-content: space-around;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    border: none;
    background: none;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

/* === BACK BUTTON === */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 8px 0;
    border: none;
    background: none;
    margin-bottom: 12px;
}

.back-btn:active {
    color: var(--accent);
}

/* === STATS === */
.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 12px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 16px;
}

/* === TOAST === */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 300;
    animation: slideDown 0.3s ease;
}

.toast.error {
    background: var(--danger);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === SEARCH === */
.search-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 12px;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent);
}

/* === UTILITIES === */
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
