﻿/* -------------------------------------------------------------------

CORE: Tokens, Typography, and Global Layout

------------------------------------------------------------------- */
:root {
    --bg: #ffffff;
    --bg-alt: #fafafa;
    --card: #ffffff;
    --text: #212529;
    --muted: #6c757d;
    --border: #e9ecef;
    --brand: #0d6efd;
    --brand-600: #0b5ed7;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;
}

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
    font-size: 14.5px;
    line-height: 1.4;
    padding: 0;
}

/* Global layout */
.main-content {
    padding: 20px;
}

footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

/* -------------------------------------------------------------------

NAVIGATION & BUTTONS

------------------------------------------------------------------- */

/* Navbar */
.navbar .navbar-brand {
    font-weight: 600;
}

.logo-img {
    height: 36px;
    margin-right: 20px;
}

.navbar .nav-link {
    color: #495057;
    padding: .5rem .75rem;
    border-radius: .375rem;
}

    .navbar .nav-link:hover {
        color: #000;
        background: #f3f5f7;
    }

    .navbar .nav-link.active {
        color: #fff;
        background: var(--brand);
    }

/* Standard Buttons */
.btn {
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
}

.btn-primary {
    background-color: #2e7d32;
    color: white;
    border: none;
}

.btn-secondary {
    background-color: #888;
    color: white;
    border: none;
}

    .btn-primary:hover,
    .btn-secondary:hover {
        opacity: 0.85;
    }

/* -------------------------------------------------------------------

REVIEW PAGE (Parent App) STYLES

------------------------------------------------------------------- */

/* Sidebar Layout */
.ws-wrapper {
    display: flex; /* Key to horizontal layout */
    min-height: calc(100vh - 56px - 40px);
}

.ws-sidebar {
    width: 240px; /* Fixed width for menu */
    flex-shrink: 0;
}

.ws-content {
    flex-grow: 1; /* Content fills remaining space */
    padding: 20px;
}

.ws-sidebar .nav-link {
    color: var(--text);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 4px;
}

    .ws-sidebar .nav-link:hover {
        background-color: #e9ecef;
    }

    .ws-sidebar .nav-link.active {
        background-color: var(--brand);
        color: white;
    }

/* Search Bar */
.review-page-content {
    padding: 20px 0; /* Vertical padding */
}

.search-bar-mini {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f7f7f7;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-input, .filter-dropdown {
    min-width: 150px;
    padding: 5px;
    font-size: 14px;
}

.filter-input-small, .filter-dropdown-small {
    min-width: 60px;
    padding: 5px;
    font-size: 14px;
}

.filter-buttons {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-end;
}

/* Main GridView / ListView Styles */
.gridview-style {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
}

    .gridview-style th, .gridview-style td {
        padding: 10px 12px; /* Increased padding */
        border: 1px solid #dee2e6;
    }

    .gridview-style th {
        background-color: #f8f9fa;
        font-weight: 600;
    }

    .gridview-style tr:hover:not(.selected-row-highlight) {
        background-color: #e8f5e9;
        cursor: pointer;
    }

.selected-row-highlight {
    background-color: #d1e7dd !important; /* Highlight selected row */
    font-weight: 600;
}

/* Expanded Detail Row & Layout */

/* Row cell that spans the list */
.detail-insert-cell {
    padding: 0 !important;
    border: none !important;
    border-top: 2px solid var(--brand-600) !important;
    background-color: transparent !important;
}

/* The panel containing the form content */
.expand-panel {
    width: 100%;
    background-color: #f0f8ff;
    padding: 15px;
}

/* Parent container for left/right columns */
.form-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Space between columns */
    /* No need for negative margin hacks when using gap */
}

/* Base style for individual columns */
.form-column {
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-alt);
    /* CRITICAL: Must be non-flexible for width overrides to work */
    flex-grow: 0;
    flex-shrink: 0;
}

/* Explicit width overrides for 30%/70% split */
.form-columns > .col-4 {
    /* Left Column (30% width minus half the 20px gap) */
    flex: 0 0 calc(30% - 10px);
    max-width: calc(30% - 10px);
}

.form-columns > .col-8 {
    /* Right Column (70% width minus half the 20px gap) */
    flex: 0 0 calc(70% - 10px);
    max-width: calc(70% - 10px);
}

/* Button override for client-side disabled state */
.btn-danger-disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* -------------------------------------------------------------------

INVOICE ENTRY POPUP STYLES (InvoiceEntry.aspx)

------------------------------------------------------------------- */

.invoice-body {
    background-color: #f8f9fa;
    padding: 15px;
}

/* ... (Remaining invoice styles are fine and unchanged) ... */

.card {
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.info-panel {
    background-color: #e9ecef;
    padding: 10px;
    border-radius: 4px;
    font-size: 0.9em;
    margin-bottom: 15px;
}

.info-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
}

.header-section {
    display: grid;
    grid-template-columns: 4fr 3fr;
    gap: 20px;
}

.invoice-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Line Item Entry Controls - Stacking and Layout */
.line-item-entry {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background-color: #f0f3f6;
    border-radius: 4px;
}

.line-entry-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Inner GridView for Line Items */
.gridview-style-items th, .gridview-style-items td {
    padding: 5px;
    border: 1px solid #dee2e6;
    font-size: 0.85em;
    text-align: center;
}

.totals-section {
    padding-top: 15px;
    border-top: 1px dashed #ccc;
    margin-top: 15px;
}

.total-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.total-box {
    padding: 10px;
    background-color: #d1e7dd;
    border-radius: 4px;
    font-weight: bold;
}

.form-control {
    font-size: 0.9em;
}

.total-value {
    text-align: right;
}

.listview-container .gridview-style th,
.listview-container .gridview-style td {
    padding: 6px 8px; /* Reduced padding from 10px 12px */
    font-size: 14px; /* Slightly smaller font */
}