/* css/cashier.css */
:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --bg-color: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #111827;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --success: #10B981;
    --danger: #EF4444;
    --radius: 12px;
    --transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* App Footer */
.app-footer {
    text-align: center;
    padding: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* Views */
.view {
    display: none;
    height: 100%;
    width: 100%;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}
.view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.app-header {
    background: var(--surface);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    z-index: 10;
}
.app-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    transition: var(--transition);
    outline: none;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    font-size: 1rem;
}
.btn-primary:active:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(0.98);
}
.btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 12px 20px;
    font-size: 1rem;
}
.btn-icon, .btn-text {
    background: transparent;
    color: var(--primary);
    font-weight: 500;
}
.full-width {
    width: 100%;
}
.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

/* Forms */
.input-group {
    margin-bottom: 16px;
    text-align: left;
}
.input-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.input-group input, .input-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
    transition: var(--transition);
}
.input-group input:focus, .input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Login Box */
.login-box {
    margin: auto;
    background: var(--surface);
    padding: 30px 24px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    text-align: center;
}
.logo-text {
    color: var(--primary);
    margin-bottom: 4px;
}
.subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Dashboard */
.stats-card {
    background: var(--primary);
    color: white;
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}
.stats-card h3 {
    font-weight: 400;
    font-size: 0.9rem;
    opacity: 0.9;
}
.stats-card .amount {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 8px 0;
}
.stats-card .bills-count {
    font-size: 0.9rem;
    background: rgba(255,255,255,0.2);
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
}

/* Billing Container */
.billing-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.card {
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}
.action-buttons {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

/* Steps - legacy */
.step {
    animation: fadeIn 0.2s ease;
}

/* Item Search & Autocomplete */
.item-search-box {
    position: relative;
    margin-bottom: 20px;
}
.item-search-box input {
    width: 100%;
    padding: 14px 16px 14px 44px; /* Added left padding for search icon */
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background: var(--surface);
    transition: var(--transition);
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.item-search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1), 0 4px 6px -1px rgba(0,0,0,0.05);
}
/* Beautiful search icon */
.item-search-box::before {
    content: '🔍';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}
.dropdown-list {
    position: absolute;
    top: calc(100% + 6px); /* slightly offset below input */
    left: 0; right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    display: none;
    padding: 6px;
}
.dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: 8px; /* rounded corners on hover */
    cursor: pointer;
    font-size: 0.95rem;
    transition: var(--transition);
    border-bottom: none;
    margin-bottom: 2px;
}
.dropdown-item:last-child {
    margin-bottom: 0;
}
.dropdown-item:hover {
    background: rgba(79, 70, 229, 0.08); /* light primary tint on hover */
    color: var(--primary);
}
.dropdown-item .item-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dropdown-item .item-name {
    font-weight: 600;
    color: var(--text-main);
}
.dropdown-item:hover .item-name {
    color: var(--primary);
}
.dropdown-item .item-code {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-start;
    text-transform: uppercase;
}
.dropdown-item .item-price {
    font-weight: 700;
    color: var(--primary);
}

/* Item Form */
.item-form {
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.hidden { display: none !important; }
.item-name-disp { font-weight: 600; font-size: 1.1rem; }
.item-price-disp { color: var(--text-muted); margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.item-total-line { display: flex; justify-content: space-between; font-size: 1.1rem; font-weight: 600; margin: 16px 0; padding-top: 16px; border-top: 1px solid var(--border); }
.item-total-val { color: var(--primary); }

/* Cart */
.cart-section {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.cart-list {
    list-style: none;
    margin-top: 12px;
}
.cart-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dotted var(--border);
}
.cart-list li:last-child { border-bottom: none; }
.cart-item-details { flex: 1; display: flex; flex-direction: column;}
.cart-item-name { font-weight: 500; }
.cart-item-meta { font-size: 0.85rem; color: var(--text-muted); }
.cart-item-price { font-weight: 600; text-align: right; }
.del-item { color: var(--danger); font-size: 1.2rem; margin-left: 12px; background:none; padding:4px; }

.cart-summary {
    background: var(--primary);
    color: white;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
}
.summary-line { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 700; }

.action-bar {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideUp 0.3s ease forwards;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin: 40px 0 20px;
}
.text-center { text-align: center; }
