/**
 * Konfidi Quick Billing Specialized Stylesheet
 * High-speed keyboard navigation and desktop/mobile billing interface
 */

.kb-billing-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Keyboard Shortcut Legend Bar */
.kb-shortcut-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e293b;
    color: #f8fafc;
    padding: 8px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.kb-shortcuts-list {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.kb-kbd {
    display: inline-block;
    background: #334155;
    color: #38bdf8;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid #475569;
    box-shadow: 0 1px 0 #0f172a;
    margin-right: 4px;
}

.kb-mobile-keyboard-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Customer Deck */
.kb-customer-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kb-customer-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr;
    gap: 16px;
    align-items: center;
}

@media (max-width: 900px) {
    .kb-customer-grid {
        grid-template-columns: 1fr;
    }
}

.kb-customer-search-wrap {
    position: relative;
}

.kb-customer-search-input {
    width: 100%;
    height: 44px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 600;
    border: 2px solid #2563eb;
    border-radius: 6px;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.kb-customer-details-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kb-balance-pill {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 14px;
    text-align: right;
}

.kb-balance-pill.has-outstanding {
    background: #fef2f2;
    border-color: #fecaca;
}

.kb-balance-pill-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
}

.kb-balance-pill-val {
    font-size: 20px;
    font-weight: 800;
    color: #1e293b;
}

.kb-balance-pill.has-outstanding .kb-balance-pill-val {
    color: #dc2626;
}

/* Items Grid Table */
.kb-billing-table-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    overflow: visible;
}

.kb-billing-table-responsive {
    overflow-x: auto;
    min-height: 250px;
}

.kb-billing-table {
    width: 100%;
    border-collapse: collapse;
}

.kb-billing-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 10px;
    border-bottom: 2px solid #cbd5e1;
    text-align: left;
}

.kb-billing-table th.th-right,
.kb-billing-table td.td-right {
    text-align: right;
}

.kb-billing-table th.th-center,
.kb-billing-table td.td-center {
    text-align: center;
}

.kb-billing-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.1s ease;
}

.kb-billing-table tbody tr.row-active {
    background: #f8fafc;
}

.kb-billing-table td {
    padding: 6px 8px;
    vertical-align: middle;
}

/* Inputs inside Table Rows */
.kb-table-input {
    width: 100%;
    height: 38px;
    padding: 6px 10px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.15s ease;
}

.kb-table-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    outline: none;
    background: #ffffff;
}

.kb-table-input.input-qty,
.kb-table-input.input-rate {
    text-align: right;
    font-family: monospace;
    font-size: 15px;
    font-weight: 600;
}

.kb-table-input.input-rate.is-overridden {
    border-color: #f59e0b;
    background: #fffbeb;
    color: #b45309;
}

.kb-row-amount {
    font-family: monospace;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    padding-right: 6px;
}

.kb-btn-remove-row {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.kb-btn-remove-row:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* Autocomplete Suggestion Dropdowns */
.kb-autocomplete-wrap {
    position: relative;
    width: 100%;
}

.kb-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    min-width: 320px;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #94a3b8;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    padding: 4px 0;
    display: none;
}

.kb-autocomplete-dropdown.show {
    display: block;
}

.kb-suggestion-item {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
}

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

.kb-suggestion-item.is-selected {
    background: #2563eb !important;
    color: #ffffff !important;
}

.kb-suggestion-item.is-selected .kb-sugg-sub,
.kb-suggestion-item.is-selected .kb-sugg-rate {
    color: #ffffff !important;
}

.kb-suggestion-item:hover {
    background: #eff6ff;
}

.kb-sugg-title {
    font-weight: 600;
}

.kb-sugg-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

.kb-sugg-rate {
    font-weight: 700;
    font-family: monospace;
    font-size: 14px;
    color: #1e293b;
}

.kb-dropdown-action-item {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #2563eb;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.kb-dropdown-action-item:hover,
.kb-dropdown-action-item.is-selected {
    background: #2563eb !important;
    color: #ffffff !important;
}

.kb-dropdown-action-item.is-selected span,
.kb-dropdown-action-item.is-selected strong {
    color: #ffffff !important;
}

.kb-dropdown-empty-state {
    padding: 16px 14px;
    text-align: center;
}

/* Bottom Deck: Summary & Actions */
.kb-billing-deck {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 900px) {
    .kb-billing-deck {
        grid-template-columns: 1fr;
    }
}

.kb-notes-card {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.kb-totals-card {
    background: #ffffff;
    border: 2px solid #2563eb;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.kb-total-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    color: #475569;
}

.kb-total-line.grand-total {
    border-top: 2px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
    margin: 10px 0;
    padding: 12px 0;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.kb-total-line.grand-total .val {
    color: #2563eb;
    font-family: monospace;
}

.kb-total-line.balance-line {
    font-size: 18px;
    font-weight: 800;
    padding-top: 8px;
    color: #dc2626;
}

.kb-total-line.balance-line .val {
    font-family: monospace;
}

.kb-save-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

.kb-btn-save-bill {
    flex: 1;
    height: 48px;
    font-size: 16px;
    font-weight: 700;
    background: #16a34a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.3);
    transition: all 0.15s ease;
}

.kb-btn-save-bill:hover {
    background: #15803d;
}

.kb-btn-save-bill:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}

/* Post-Save Modal Success */
.kb-success-hero {
    text-align: center;
    padding: 16px 0;
}

.kb-success-icon {
    font-size: 48px;
    color: #16a34a;
    margin-bottom: 12px;
}

.kb-success-bill-num {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.kb-success-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .kb-success-actions-grid {
        grid-template-columns: 1fr;
    }
}

.kb-btn-whatsapp-share {
    background: #25d366;
    color: #ffffff !important;
    font-weight: 700;
}

.kb-btn-whatsapp-share:hover {
    background: #20ba5a;
}
