/* ---- Base (from _blank_grey) ---- */
body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    background-color: black;
    font-size: 16px;
    color: rgb(146, 146, 146);
    font-family: 'Consolas', 'Courier New', monospace;
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

/* ---- Layout ---- */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* ---- Header ---- */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

header h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: 2px;
    color: #aaa;
}

header .version {
    font-size: 13px;
    color: #555;
}

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

/* Demo button styling */
.btn-demo {
    color: #8c8 !important;
    border-color: #585 !important;
}

.btn-demo:hover {
    color: #afa !important;
    border-color: #6a6 !important;
    background: #0a1a0a !important;
}

/* ---- Tab Bar ---- */
#tab-bar {
    display: flex;
    gap: 2px;
    padding: 4px 16px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.tab {
    background: transparent;
    border: 1px solid #444;
    color: #888;
    padding: 6px 14px;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.tab:hover {
    color: #ccc;
    border-color: #666;
}

.tab.active {
    color: #ddd;
    border-color: #888;
    background: #1a1a1a;
}

.tab-action {
    color: #8c8 !important;
    border-color: #585 !important;
    margin-left: auto;
}

.tab-action:hover {
    color: #afa !important;
    border-color: #6a6 !important;
    background: #0a1a0a;
}

/* ---- Action Bar (per-tab buttons) ---- */
#action-bar {
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    min-height: 52px;
}

.action-bar-content {
    display: none;
    padding: 10px 16px;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.action-bar-content button {
    margin-right: 8px;
}

/* Stock tab - Green buttons */
.action-bar-content[data-for-tab="plants"] button.btn-primary {
    color: #8c8;
    border-color: #585;
}

.action-bar-content[data-for-tab="plants"] button.btn-primary:hover {
    color: #afa;
    border-color: #6a6;
    background: #0a1a0a;
}

/* Products tab - Amber/Yellow buttons */
.action-bar-content[data-for-tab="products"] button.btn-primary {
    color: #cc9;
    border-color: #885;
}

.action-bar-content[data-for-tab="products"] button.btn-primary:hover {
    color: #dd9;
    border-color: #996;
    background: #15120a;
}

/* Customers tab - Blue buttons */
.action-bar-content[data-for-tab="customers"] button.btn-primary {
    color: #8bf;
    border-color: #357;
}

.action-bar-content[data-for-tab="customers"] button.btn-primary:hover {
    color: #9cf;
    border-color: #468;
    background: #0a0e15;
}

.action-bar-content input {
    margin-bottom: 0;
    margin-right: 8px;
}

.action-bar-content input[type="date"] {
    width: 150px;
}

/* Show action bar content for active tab */
#app[data-active-tab="dashboard"] .action-bar-content[data-for-tab="dashboard"],
#app[data-active-tab="plants"] .action-bar-content[data-for-tab="plants"],
#app[data-active-tab="products"] .action-bar-content[data-for-tab="products"],
#app[data-active-tab="customers"] .action-bar-content[data-for-tab="customers"],
#app[data-active-tab="charts"] .action-bar-content[data-for-tab="charts"],
#app[data-active-tab="sales"] .action-bar-content[data-for-tab="sales"] {
    display: flex;
}

/* ---- Tab Content ---- */
.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* ---- Full-Width Table Layout ---- */
.full-table {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.full-table table {
    width: 100%;
}

/* ---- Forms ---- */
input, select, textarea {
    background: #111;
    border: 1px solid #444;
    color: #ccc;
    font-family: inherit;
    font-size: 15px;
    padding: 6px 8px;
    width: 100%;
    margin-bottom: 8px;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: #777;
}

input::placeholder, textarea::placeholder {
    color: #555;
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 40px;
}

.qty-row {
    display: flex;
    gap: 4px;
}

.qty-row input {
    flex: 1;
}

.qty-row select {
    width: 90px;
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.form-actions button {
    flex: 1;
}

button {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #aaa;
    font-family: inherit;
    font-size: 15px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.15s;
}

button:hover {
    color: #ddd;
    border-color: #666;
    background: #222;
}

button.btn-primary {
    color: #8c8;
    border-color: #585;
}

button.btn-primary:hover {
    color: #afa;
    border-color: #6a6;
    background: #0a1a0a;
}

button.btn-danger {
    color: #c88;
    border-color: #855;
}

button.btn-danger:hover {
    color: #faa;
    border-color: #a66;
    background: #1a0a0a;
}

button.btn-sm {
    padding: 3px 8px;
    font-size: 14px;
}

/* ---- Tables ---- */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 14px;
    color: #777;
    letter-spacing: 1px;
    padding: 6px 8px;
    border-bottom: 1px solid #444;
    white-space: nowrap;
}

th.sortable {
    cursor: pointer;
    user-select: none;
}
th.sortable:hover {
    color: #aaa;
}
th.sort-asc::after {
    content: ' \2191';
    font-size: 12px;
    opacity: 0.8;
}
th.sort-desc::after {
    content: ' \2193';
    font-size: 12px;
    opacity: 0.8;
}

td {
    padding: 6px 8px;
    border-bottom: 1px solid #222;
    font-size: 15px;
    vertical-align: top;
}

tr:hover td {
    background: #111;
}

td.actions {
    white-space: nowrap;
}

td.actions button {
    margin-right: 4px;
}

.text-right {
    text-align: right;
}

.text-dim {
    color: #555;
}

.text-warn {
    color: #ca8;
}

.qty-zero {
    color: #855;
}

.empty-msg {
    color: #555;
    font-style: italic;
    padding: 20px 0;
}

/* ---- Sale Detail Rows ---- */
.sale-detail {
    display: none;
}

.sale-detail.expanded {
    display: table-row;
}

.sale-detail td {
    padding: 4px 8px 12px 24px;
    color: #777;
    font-size: 14px;
    border-bottom: 1px solid #333;
}

.sale-detail-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sale-detail-items li {
    padding: 2px 0;
}

.sale-row {
    cursor: pointer;
}

.sale-row:hover td {
    background: #151515;
}

/* ---- Modal ---- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: #0a0a0a;
    border: 1px solid #444;
    padding: 20px;
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #aaa;
    letter-spacing: 1px;
}

.sale-customer {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.sale-customer select {
    flex: 1;
    margin-bottom: 0;
}

.sale-customer button {
    flex-shrink: 0;
}

/* ---- Sale Line Items ---- */
#sale-items {
    margin-bottom: 8px;
}

.sale-line-item {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-bottom: 6px;
    padding: 6px;
    border: 1px solid #333;
    flex-wrap: wrap;
}

.sale-line-item select {
    width: 90px;
    margin-bottom: 0;
}

.sale-line-item select.item-select {
    width: 140px;
}

.sale-line-item input {
    width: 70px;
    margin-bottom: 0;
}

.sale-line-item .item-info {
    font-size: 13px;
    color: #666;
    flex-basis: 100%;
    padding-top: 2px;
}

.sale-line-item .item-line-total {
    color: #aaa;
    font-size: 15px;
    min-width: 60px;
    text-align: right;
}

.sale-line-item .btn-remove-item {
    padding: 3px 6px;
    font-size: 11px;
    color: #c88;
    border-color: #855;
}

.sale-total {
    text-align: right;
    font-size: 16px;
    color: #aaa;
    padding: 10px 0;
    border-top: 1px solid #444;
    margin-top: 8px;
}

.sale-total span {
    color: #ccc;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.modal-actions button {
    flex: 1;
}

/* ---- Quick Customer Input (inline in modal) ---- */
.quick-customer {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.quick-customer input {
    flex: 1;
    margin-bottom: 0;
}

/* ---- Status Bar ---- */
#status-bar {
    display: flex;
    align-items: center;
    padding: 6px 16px;
    border-top: 1px solid #333;
    font-size: 14px;
    color: #555;
    flex-shrink: 0;
}

/* ---- Hidden utility ---- */
.hidden {
    display: none !important;
}

/* ---- Confirm Dialog ---- */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.confirm-box {
    background: #0a0a0a;
    border: 1px solid #666;
    padding: 20px;
    max-width: 400px;
    text-align: center;
}

.confirm-box p {
    margin: 0 0 16px 0;
    color: #aaa;
}

.confirm-box .confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ---- Error Message ---- */
.error-msg {
    color: #c66;
    font-size: 14px;
    margin-bottom: 6px;
}

/* ---- Sale Notes ---- */
.sale-notes-input {
    width: 100%;
    margin-top: 8px;
}

/* ---- Sale Discount ---- */
.sale-discount {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.sale-discount label {
    color: #aaa;
    font-size: 15px;
    white-space: nowrap;
}

.sale-discount input {
    width: 90px;
    margin-bottom: 0;
}

.sale-discount select {
    width: 80px;
    margin-bottom: 0;
}

/* ---- Sale Total Breakdown ---- */
.sale-subtotal {
    font-size: 14px;
    color: #777;
    padding-bottom: 2px;
}

.sale-discount-line {
    font-size: 14px;
    color: #c88;
    padding-bottom: 2px;
}

.sale-final-total {
    font-size: 17px;
    color: #ccc;
    padding-top: 4px;
}

/* ---- Dashboard ---- */
.dashboard {
    padding: 16px;
    overflow-y: auto;
    width: 100%;
}

.dash-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dash-card {
    border: 1px solid #333;
    padding: 14px;
    flex: 1;
    min-width: 140px;
}

.dash-card-wide {
    min-width: 280px;
}

.dash-label {
    font-size: 13px;
    color: #777;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.dash-value {
    font-size: 24px;
    color: #ccc;
}

.dash-sub {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.dash-list {
    margin: 0;
    padding: 0 0 0 20px;
    color: #aaa;
    font-size: 15px;
}

.dash-list li {
    padding: 3px 0;
}

.dash-list-unordered {
    list-style: none;
    padding-left: 0;
}

.dash-empty {
    color: #555;
    font-style: italic;
    font-size: 14px;
}

.dash-chart-card {
    min-height: 280px;
}
.dash-chart-card canvas {
    max-height: 260px;
}

/* ---- Low Stock Warning ---- */
tr.low-stock td {
    color: #ca8;
}

tr.low-stock td:first-child::before {
    content: "\26A0  ";
}

/* ============================================================
   SECTION COLOR CODING
   Each tab gets a subtle accent color for visual distinction
   ============================================================ */

/* ---- Stock: Dark Green ---- */
.tab[data-tab="plants"].active {
    border-color: #3a7a3a;
    color: #7c7;
    background: #0a150a;
}
.tab[data-tab="plants"]:hover {
    color: #9d9;
    border-color: #3a7a3a;
}

#tab-plants {
    border-top: 3px solid #2a5a2a;
}
#tab-plants .panel-form {
    border-right-color: #2a5a2a;
}
#tab-plants .panel-form h2 {
    color: #7b7;
}
#tab-plants th {
    border-bottom-color: #2a5a2a;
    color: #7a7;
}
#tab-plants input:focus,
#tab-plants select:focus {
    border-color: #3a7a3a;
}

/* ---- Products: Dark Amber ---- */
.tab[data-tab="products"].active {
    border-color: #7a6a3a;
    color: #cc9;
    background: #15120a;
}
.tab[data-tab="products"]:hover {
    color: #dd9;
    border-color: #7a6a3a;
}

#tab-products {
    border-top: 3px solid #5a4a2a;
}
#tab-products .panel-form {
    border-right-color: #5a4a2a;
}
#tab-products .panel-form h2 {
    color: #bb9;
}
#tab-products th {
    border-bottom-color: #5a4a2a;
    color: #a97;
}
#tab-products input:focus,
#tab-products select:focus {
    border-color: #7a6a3a;
}

/* ---- Customers: Dark Blue ---- */
.tab[data-tab="customers"].active {
    border-color: #3a5a8a;
    color: #8bf;
    background: #0a0e15;
}
.tab[data-tab="customers"]:hover {
    color: #9cf;
    border-color: #3a5a8a;
}

#tab-customers {
    border-top: 3px solid #2a3a5a;
}
#tab-customers .panel-form {
    border-right-color: #2a3a5a;
}
#tab-customers .panel-form h2 {
    color: #89b;
}
#tab-customers th {
    border-bottom-color: #2a3a5a;
    color: #79a;
}
#tab-customers input:focus,
#tab-customers select:focus {
    border-color: #3a5a8a;
}

/* ---- Charts: Teal/Cyan (analytics) ---- */
.tab[data-tab="charts"].active {
    border-color: #3a6a6a;
    color: #7dd;
    background: #0a1212;
}
.tab[data-tab="charts"]:hover {
    color: #9ee;
    border-color: #3a6a6a;
}

#tab-charts {
    border-top: 3px solid #2a4a4a;
    overflow-y: auto;
}

.charts-tab {
    padding: 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.charts-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #333;
}

.chart-control-label {
    color: #777;
    font-size: 14px;
    margin-right: 4px;
}

.chart-period-btn {
    color: #7dd;
    border-color: #3a6a6a;
}

.chart-period-btn:hover {
    color: #9ee;
    border-color: #4a7a7a;
    background: #0a1212;
}

.chart-period-btn.active {
    color: #afa;
    border-color: #5a8a8a;
    background: #0a1515;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    flex: 1;
    overflow-y: auto;
}

.chart-card {
    border: 1px solid #3a6a6a;
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    background: #0a0a0a;
}

.chart-card canvas {
    flex: 1;
    max-height: calc(100% - 10px);
    max-width: 100%;
    padding: 5px;
}

/* Special constraint for heatmap to prevent overflow */
#chart-revenue-heatmap {
    max-height: 280px !important;
    height: 280px !important;
}

.chart-title {
    font-size: 13px;
    color: #7dd;
    letter-spacing: 1px;
    margin: 0 0 12px 0;
    font-weight: normal;
}

.chart-info-row {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 12px;
}

.chart-info-label {
    color: #777;
}

.chart-info-value {
    color: #aaa;
}

.chart-card canvas {
    flex: 1;
    max-height: 100%;
}

/* Responsive layout for smaller screens */
@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.charts-label {
    color: #666;
    font-size: 14px;
}

/* ---- Sales: Dark Purple ---- */
.tab[data-tab="sales"].active {
    border-color: #6a3a8a;
    color: #c8f;
    background: #120a15;
}
.tab[data-tab="sales"]:hover {
    color: #d9f;
    border-color: #6a3a8a;
}

#tab-sales {
    border-top: 3px solid #4a2a5a;
}
#tab-sales .panel-form {
    border-right-color: #4a2a5a;
}
#tab-sales .panel-form h2 {
    color: #a8c;
}
#tab-sales th {
    border-bottom-color: #4a2a5a;
    color: #97a;
}
#tab-sales input:focus,
#tab-sales select:focus {
    border-color: #6a3a8a;
}

/* ---- Dashboard: Dark Teal ---- */
.tab[data-tab="dashboard"].active {
    border-color: #3a7a7a;
    color: #7cc;
    background: #0a1515;
}
.tab[data-tab="dashboard"]:hover {
    color: #9dd;
    border-color: #3a7a7a;
}

#tab-dashboard {
    border-top: 3px solid #2a5a5a;
}
