/* ==========================================================================
   PharmPro — Billing Page Styles
   Loaded AFTER home.css. Header + sidebar theme comes from home.css;
   this file only styles the billing-page-specific pieces (New Bill panel,
   cart, saved-bills table, stock suggestions) using the same design tokens.
   ========================================================================== */

:root {
    /* Aliases onto home.css's variables so this file stays theme-consistent */
    --primary: var(--primary-color);
    --border: var(--border-color);
    --text-main: var(--secondary-color);
    --text-muted: #64748b;
    --bg-light: var(--hover-bg);
}

/* --- Page Search / Control Bar --- */
.control-panel { margin-bottom: 20px; }

.actions-bar-fluid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.search-box-container {
    flex: 1;
    min-width: 260px;
    position: relative;
}

.search-box-container i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box-container input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.btn-primary-main {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-primary-main:hover { background: var(--primary-dark); }

/* --- New Bill Panel (always visible, no modal) --- */
.new-bill-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-main); }

.form-scroll-area { padding: 20px; }

.section-tag {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: 0.6px;
    font-weight: 700;
}

.fluid-row { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.f-group { flex: 1 1 200px; }
.f-group label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }

.f-group input, .f-group select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-main);
}
.f-group input:focus, .f-group select:focus { outline: none; border-color: var(--primary); }

/* --- Medicine Stock Suggestions (simple list, sharp corners, right under the box) --- */
.med-input-wrapper { position: relative; }

.suggestions-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0;
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
}

.suggestions-list.active { display: block; }

.suggestion-item {
    padding: 8px 10px;
    font-size: 0.88rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item.highlighted { background: var(--bg-light); }

.suggestion-item .s-name { font-weight: 600; color: var(--text-main); }
.suggestion-item .s-meta { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }

.suggestion-empty { padding: 10px; font-size: 0.85rem; color: #94a3b8; text-align: center; }

/* --- Cart Header & Body --- */
.cart-header-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 36px;
    background: var(--bg-light);
    padding: 8px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border);
    border-bottom: none;
    text-transform: uppercase;
    color: var(--text-muted);
}

.cart-body-list {
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

.cart-body-list .med-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 36px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    font-size: 0.9rem;
}
.cart-body-list .med-row:last-child { border-bottom: none; }

.empty-cart-msg { text-align: center; color: #94a3b8; padding: 14px; font-size: 0.9rem; }

.bill-highlight {
    font-size: 1.3rem !important;
    font-weight: 800;
    color: var(--primary);
    background: var(--primary-light) !important;
    border-color: #bfdbfe !important;
}

.form-actions {
    padding: 16px 20px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-save {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
}
.btn-save:hover { background: var(--primary-dark); }

.btn-cancel {
    background: none;
    border: 1px solid var(--border);
    padding: 10px 22px;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    color: var(--text-main);
}
.btn-cancel:hover { background: var(--bg-light); }

/* --- Saved Bills Table --- */
.table-wrapper {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.bills-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
    font-size: 0.9rem;
}

.bills-table thead th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    white-space: nowrap;
}

.bills-table tbody tr.bill-row {
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.bills-table tbody tr.bill-row:hover { background: var(--bg-light); }

.bills-table tbody td {
    padding: 12px 14px;
    white-space: nowrap;
    color: var(--text-main);
}

.bills-table tbody tr.detail-row td {
    white-space: normal;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border);
    padding: 16px;
}

.bill-amount { font-weight: 700; color: var(--primary); }

.no-results-cell { text-align: center; color: #94a3b8; padding: 30px !important; }

.detail-items { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; line-height: 1.6; }

.detail-actions button {
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    margin-right: 8px;
}
.btn-print { background: var(--primary); color: white; }
.btn-delete { background: #fee2e2; color: #dc2626; }

/* --- Mobile View Adjustments (sidebar collapse is handled by home.css) --- */
@media (max-width: 600px) {
    .search-box-container { min-width: 100%; }
    .btn-primary-main { width: 100%; justify-content: center; }
    .cart-header-grid { display: none; }
    .cart-body-list .med-row { grid-template-columns: 1fr 1fr auto; gap: 5px; }
    .form-actions { flex-direction: column; }
    .btn-save, .btn-cancel { width: 100%; }
}