/* pos-styles.css */
:root {
    --pos-bg: #f8f9fc;
    --pos-white: #ffffff;
    --pos-text: #2d3748;
    --pos-text-muted: #718096;
    --pos-border: #e2e8f0;
    --pos-primary: #ef4444;
    /* Clean flat red for Save */
    --pos-accent: #10b981;
    /* Flat green Credit button */
    --pos-blue: #3b82f6;
    /* Add items text */
    --pos-light-gray: #edf2f7;
    --pos-share-bg: #fee2e2;
}

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

body.pos-bg {
    background-color: var(--pos-bg);
    color: var(--pos-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- App Container for Desktop Constraints --- */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--pos-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* --- Top Header --- */
.pos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--pos-white);
    border-bottom: 1px solid var(--pos-border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.icon-btn-back {
    background: none;
    border: none;
    color: var(--pos-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-right .toggle-switch {
    display: flex;
    background: var(--pos-light-gray);
    border-radius: 20px;
    padding: 3px;
}

.toggle-btn {
    border: none;
    background: transparent;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--pos-text-muted);
}

.toggle-btn.active#btn-credit {
    background: var(--pos-accent);
    color: white;
}

.toggle-btn.active#btn-cash {
    background: var(--pos-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: var(--pos-text);
}

/* --- Meta Row (Invoice No / Date) --- */
.meta-row {
    display: flex;
    background: var(--pos-white);
    border-bottom: 1px solid var(--pos-border);
}

.meta-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    gap: 0.25rem;
}

.meta-col label {
    font-size: 0.8rem;
    color: var(--pos-text-muted);
    font-weight: 500;
}

.input-with-icon {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ghost-input {
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--pos-text);
    outline: none;
    width: 100%;
    font-weight: 500;
}

.meta-col select.ghost-input {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 1.5rem;
}

.icon-gray {
    color: var(--pos-text-muted);
}

.divider {
    width: 1px;
    background: var(--pos-border);
    margin: 0.5rem 0;
}

/* --- Main Form Area --- */
.pos-main {
    padding: 1.25rem 1rem;
    flex: 1;
    background: var(--pos-bg);
}

.field-container {
    margin-bottom: 1.25rem;
}

.pos-input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--pos-border);
    border-radius: 8px;
    background: var(--pos-white);
    font-size: 1.05rem;
    outline: none;
    transition: border-color 0.2s;
}

.pos-input::placeholder {
    color: var(--pos-text-muted);
}

.pos-input:focus {
    border-color: var(--pos-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.btn-add-line {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--pos-border);
    border-radius: 8px;
    background: var(--pos-white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-line:hover {
    background: #f8fafc;
}

.plus-icon {
    color: var(--pos-blue);
    font-size: 1.2rem;
    font-weight: 500;
}

.action-text {
    color: var(--pos-blue);
    font-weight: 600;
    font-size: 1rem;
}

.optional-text {
    color: var(--pos-text-muted);
    font-size: 0.95rem;
}

/* --- Items List Overrides --- */
.items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.5rem;
}

.item-row {
    background: var(--pos-white);
}

.item-row td {
    padding: 0.5rem;
    border-top: 1px solid var(--pos-border);
    border-bottom: 1px solid var(--pos-border);
}

.item-row td:first-child {
    border-left: 1px solid var(--pos-border);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.item-row td:last-child {
    border-right: 1px solid var(--pos-border);
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.cell-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--pos-border);
    border-radius: 6px;
    font-size: 0.95rem;
    outline: none;
}

.cell-input:focus {
    border-color: var(--pos-blue);
}

.qty-input,
.rate-input {
    width: 70px;
    text-align: center;
}

.amount-display {
    font-weight: 600;
    white-space: nowrap;
}

.btn-remove {
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* --- Total Area --- */
.total-row {
    background: var(--pos-bg);
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 1.05rem;
}

.total-label {
    min-width: 100px;
}

.total-value-container {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.rupee-symbol {
    color: var(--pos-text);
    margin-left: 1rem;
}

.dotted-line {
    flex: 1;
    border-bottom: 2px dashed var(--pos-text-muted);
    position: relative;
    top: -5px;
    opacity: 0.5;
}

.total-amount {
    font-size: 1.15rem;
}

/* --- Footer Action Bar --- */
.pos-bottom-bar {
    background: var(--pos-white);
    border-top: 1px solid var(--pos-border);
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1.5fr auto;
    gap: 1rem;
    align-items: center;
    position: sticky;
    bottom: 0;
}

.btn-action {
    padding: 1rem;
    border: none;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action.light {
    background: var(--pos-light-gray);
    color: var(--pos-text-muted);
    border-radius: 24px;
}

.btn-action.primary {
    background: var(--pos-primary);
    color: white;
    border-radius: 24px;
}

.btn-action.share {
    background: var(--pos-share-bg);
    color: var(--pos-primary);
    width: 52px;
    height: 52px;
    border-radius: 50%;
}