/* ==========================================================================
   schedule.css — Split indoor/outdoor schedule tables matching the
   PDF/Excel template layout, plus accessories notes section.
   Supports Mini Split, Multi Position Split, and Gas Pack column layouts.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Schedule Section Wrapper  (contains both tables + accessories)
   -------------------------------------------------------------------------- */
#schedule-section,
#mps-schedule-section,
#gp-schedule-section {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: content-fade-in 0.45s ease-out 0.1s both;
}


/* --------------------------------------------------------------------------
   Schedule Toolbar  (title bar)
   -------------------------------------------------------------------------- */
#schedule-toolbar,
#mps-schedule-toolbar,
#gp-schedule-toolbar {
    display: flex;
    align-items: baseline;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--color-border-light);
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
}

#schedule-title,
.schedule-title-text {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    letter-spacing: -0.02em;
}

#schedule-subtitle,
.schedule-subtitle-text {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    color: var(--color-brand);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--space-xxs) var(--space-sm);
    background-color: var(--color-brand-light);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 84, 166, 0.15);
}


/* --------------------------------------------------------------------------
   Table Wrappers  (scrollable containers for each table)
   -------------------------------------------------------------------------- */
.schedule-table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

#indoor-schedule-wrapper,
#mps-indoor-schedule-wrapper {
    border-bottom: none;
}

#outdoor-schedule-wrapper,
#mps-outdoor-schedule-wrapper {
    border-top: none;
}


/* --------------------------------------------------------------------------
   Section Labels  ("INDOOR UNIT" / "OUTDOOR UNIT" bars)
   -------------------------------------------------------------------------- */
.schedule-section-label {
    background: linear-gradient(160deg, #002B5C 0%, #17528F 60%, #1A6AB8 100%);
    color: var(--color-text-inverse);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    text-align: center;
    padding: var(--space-sm) var(--space-lg);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}


/* --------------------------------------------------------------------------
   Table Base
   -------------------------------------------------------------------------- */
.schedule-table {
    width: 100%;
    font-size: var(--font-size-sm);
    line-height: 1.35;
    table-layout: fixed;
}

#indoor-schedule-table {
    min-width: 1100px;
}

#outdoor-schedule-table {
    min-width: 900px;
}

#mps-indoor-schedule-table {
    min-width: 1300px;
}

#mps-outdoor-schedule-table {
    min-width: 1050px;
}

#gp-schedule-table {
    min-width: 1500px;
}


/* --------------------------------------------------------------------------
   Mini Split — Indoor Unit Column Widths
   -------------------------------------------------------------------------- */
.col-action             { width: 84px; }

.idu-col-symbol         { width: 5.8%; }
.idu-col-odu-symbol     { width: 7.2%; }
.idu-col-cfm            { width: 3.4%; }
.idu-col-cooling        { /* colspan 4 — no fixed width */ }
.idu-col-edb            { width: 3.2%; }
.idu-col-ewb            { width: 3.4%; }
.idu-col-total-cool     { width: 6.8%; }
.idu-col-sensible       { width: 6.8%; }
.idu-col-heating        { /* colspan 2 */ }
.idu-col-heat-edb       { width: 3.2%; }
.idu-col-heat-total     { width: 6.8%; }
.idu-col-weight         { width: 6.2%; }
.idu-col-type           { width: 8.6%; }
.idu-col-elec           { /* colspan 3 */ }
.idu-col-voltage        { width: 5.0%; }
.idu-col-mca            { width: 3.4%; }
.idu-col-mop            { width: 3.4%; }
.idu-col-mfg            { width: 11.0%; }


/* --------------------------------------------------------------------------
   Mini Split — Outdoor Unit Column Widths
   -------------------------------------------------------------------------- */
.odu-col-symbol         { width: 5.6%; }
.odu-col-cool-amb       { width: 7.8%; }
.odu-col-heat-amb       { width: 7.8%; }
.odu-col-weight         { width: 7.2%; }
.odu-col-seer           { width: 8.2%; }
.odu-col-elec           { /* colspan 3 */ }
.odu-col-voltage        { width: 5.6%; }
.odu-col-mca            { width: 3.4%; }
.odu-col-mop            { width: 3.4%; }
.odu-col-mfg            { width: 10.8%; }
.odu-col-refrig         { width: 8.6%; }
.odu-col-lineset        { width: 13.0%; }


/* --------------------------------------------------------------------------
   Multi Position Split — Indoor AHU Column Widths
   -------------------------------------------------------------------------- */
.mps-idu-col-tag         { width: 4.2%; }
.mps-idu-col-model       { width: 8.0%; }
.mps-idu-col-fan         { /* colspan 3 */ }
.mps-idu-col-cfm         { width: 4.2%; }
.mps-idu-col-hp          { width: 3.6%; }
.mps-idu-col-motor-type  { width: 6.0%; }
.mps-idu-col-cool        { /* colspan 5 */ }
.mps-idu-col-eat-db      { width: 3.2%; }
.mps-idu-col-eat-wb      { width: 3.2%; }
.mps-idu-col-lat-db      { width: 3.2%; }
.mps-idu-col-total-cap   { width: 5.2%; }
.mps-idu-col-sensible    { width: 5.2%; }
.mps-idu-col-hp-total    { width: 5.4%; }
.mps-idu-col-aux         { /* colspan 2 */ }
.mps-idu-col-aux-kw      { width: 3.2%; }
.mps-idu-col-aux-rise    { width: 4.6%; }
.mps-idu-col-elec        { /* colspan 3 */ }
.mps-idu-col-voltage     { width: 5.0%; }
.mps-idu-col-mca         { width: 3.2%; }
.mps-idu-col-mop         { width: 3.2%; }
.mps-idu-col-weight      { width: 3.8%; }


/* --------------------------------------------------------------------------
   Multi Position Split — Outdoor Condensing Unit Column Widths
   -------------------------------------------------------------------------- */
.mps-odu-col-tag         { width: 4.2%; }
.mps-odu-col-model       { width: 8.0%; }
.mps-odu-col-heat        { /* colspan 3 */ }
.mps-odu-col-heat-amb    { width: 5.8%; }
.mps-odu-col-heat-total  { width: 5.6%; }
.mps-odu-col-heat-eff    { width: 6.0%; }
.mps-odu-col-elec        { /* colspan 3 */ }
.mps-odu-col-voltage     { width: 5.0%; }
.mps-odu-col-mca         { width: 3.2%; }
.mps-odu-col-mop         { width: 3.2%; }
.mps-odu-col-cool-amb    { width: 5.8%; }
.mps-odu-col-refrig      { width: 6.4%; }
.mps-odu-col-efficiency  { width: 10.0%; }
.mps-odu-col-weight      { width: 4.2%; }
.mps-odu-col-compressor  { width: 6.2%; }


/* --------------------------------------------------------------------------
   Gas Packs — Single Unit Column Widths
   -------------------------------------------------------------------------- */
.gp-col-make           { width: 3.8%; }
.gp-col-model          { width: 5.6%; }
.gp-col-tons           { width: 2.8%; }
.gp-col-fan            { /* colspan 3 */ }
.gp-col-cfm            { width: 3.2%; }
.gp-col-esp            { width: 2.8%; }
.gp-col-tesp           { width: 2.8%; }
.gp-col-cooling        { /* colspan 7 */ }
.gp-col-cool-total     { width: 5.2%; }
.gp-col-cool-sensible  { width: 5.2%; }
.gp-col-cool-eff       { width: 6.8%; }
.gp-col-edb            { width: 2.6%; }
.gp-col-ewb            { width: 2.6%; }
.gp-col-ldb            { width: 2.6%; }
.gp-col-lwb            { width: 2.6%; }
.gp-col-heating        { /* colspan 4 */ }
.gp-col-heat-input     { width: 3.2%; }
.gp-col-heat-output    { width: 3.2%; }
.gp-col-heat-eat       { width: 2.6%; }
.gp-col-heat-lat       { width: 2.6%; }
.gp-col-hgrh           { width: 3.0%; }
.gp-col-stages         { width: 3.0%; }
.gp-col-elec           { /* colspan 4 */ }
.gp-col-voltage        { width: 3.4%; }
.gp-col-motor-hp       { width: 3.4%; }
.gp-col-mca            { width: 3.0%; }
.gp-col-mocp           { width: 3.0%; }


/* --------------------------------------------------------------------------
   Table Header  (thead)
   -------------------------------------------------------------------------- */
.schedule-table thead th {
    background-color: var(--color-header-bg);
    color: var(--color-header-text);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--space-sm) var(--space-xs);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
    line-height: 1.35;
}

/* Row 1: group headers */
.header-row-1 th {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    background: linear-gradient(180deg, #1E72B8 0%, #17528F 100%);
    padding: var(--space-sm) var(--space-sm);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

/* Row 1 action column: blank dark cell */
.header-row-1 .col-action {
    background: linear-gradient(180deg, #1E72B8 0%, #17528F 100%);
}

/* Row 2: detail sub-headers */
.header-row-2 th {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    background: linear-gradient(180deg, #2A7BC5 0%, var(--color-header-bg-sub) 100%);
    padding: var(--space-xs) var(--space-xs);
}


/* --------------------------------------------------------------------------
   Table Body  (tbody)
   -------------------------------------------------------------------------- */
.schedule-table tbody td {
    padding: var(--space-sm) var(--space-xs);
    border: 1px solid var(--color-border-light);
    text-align: center;
    vertical-align: middle;
    transition: background-color var(--transition-fast);
}


/* --------------------------------------------------------------------------
   Row Striping  (alternating system backgrounds)
   -------------------------------------------------------------------------- */
.schedule-row {
    background-color: var(--color-row-even);
}

.schedule-row:nth-child(even) {
    background-color: var(--color-row-odd);
}


/* --------------------------------------------------------------------------
   Unit Type Color Coding  (left border accent by indoor unit type)
   -------------------------------------------------------------------------- */
.schedule-row[data-unit-type="wall"] td:first-child {
    border-left: 3px solid #2196F3;
}

.schedule-row[data-unit-type="ducted"] td:first-child {
    border-left: 3px solid #4CAF50;
}

.schedule-row[data-unit-type="floor"] td:first-child {
    border-left: 3px solid #FF9800;
}

.schedule-row[data-unit-type="ceiling"] td:first-child {
    border-left: 3px solid #9C27B0;
}


/* --------------------------------------------------------------------------
   System Boundaries  (visual grouping of multi-row systems)
   -------------------------------------------------------------------------- */
.schedule-row.system-first-row td {
    border-top: 2px solid var(--color-brand);
}

.schedule-row.system-last-row td {
    border-bottom: 2px solid var(--color-brand);
}


/* --------------------------------------------------------------------------
   Cross-Table Hover  (highlight entire system on hover)
   -------------------------------------------------------------------------- */
.schedule-row.system-hover td {
    background-color: var(--color-row-hover);
}


/* --------------------------------------------------------------------------
   Cell Types
   -------------------------------------------------------------------------- */
.cell-numeric {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    text-align: center;
}

.cell-text {
    font-size: var(--font-size-xs);
    color: var(--color-text);
    text-align: center;
}

/* Model number — same format as other data cells (no bold/color accent) */
.cell-model {
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    text-align: center;
    letter-spacing: 0.02em;
}

.cell-empty {
    color: var(--color-text-muted);
    opacity: 0.35;
}

/* "Indoor Powered From Outdoor Unit" merged cell */
.cell-powered-from-outdoor {
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    text-align: center;
    font-style: italic;
    letter-spacing: 0.02em;
    background-color: var(--color-surface-alt);
}


/* --------------------------------------------------------------------------
   Action Column  (+ button, PDF button)
   -------------------------------------------------------------------------- */
.schedule-table tbody td.cell-action {
    padding: var(--space-xs);
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

/* The add-to-project button — vivid orange */
.btn-add-system {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: #FFFFFF;
    background-color: #F57C00;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 2px 5px rgba(245, 124, 0, 0.45);
}

.btn-add-system:hover {
    background-color: #E65100;
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(230, 81, 0, 0.5);
}

.btn-add-system:active {
    transform: scale(0.95);
}

/* "Added" state — vivid green checkmark (still clickable for duplicates) */
.btn-add-system.added {
    color: #FFFFFF;
    background-color: #2E7D32;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(46, 125, 50, 0.45);
}

.btn-add-system.added:hover {
    background-color: #1B5E20;
    transform: scale(1.15);
}

/* View PDF button — vivid red */
.btn-view-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 24px;
    border-radius: var(--border-radius);
    color: #FFFFFF;
    background-color: #E53935;
    font-size: 9px;
    font-weight: var(--font-weight-bold);
    letter-spacing: 0.02em;
    line-height: 1;
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: 0 1px 4px rgba(229, 57, 53, 0.4);
}

.btn-view-pdf:hover {
    background-color: #C62828;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.5);
}

.btn-view-pdf:active {
    transform: scale(0.95);
}

/* Layout: PDF + Add button side by side in action cell */
.schedule-table tbody td.cell-action .btn-view-pdf {
    margin-right: 4px;
    vertical-align: middle;
}

.schedule-table tbody td.cell-action .btn-add-system {
    vertical-align: middle;
}

/* Merged action cell for multi-zone indoor systems */
.schedule-table tbody td.cell-action-merged {
    vertical-align: middle;
    text-align: center;
    padding: 0;
    background-color: var(--color-surface-alt);
    border-bottom-color: var(--color-brand);
}

.schedule-table tbody tr.system-hover td.cell-action-merged {
    background-color: var(--color-brand-light);
}


/* --------------------------------------------------------------------------
   Accessories Notes Section  (below both tables)
   -------------------------------------------------------------------------- */
#accessories-notes,
#mps-accessories-notes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    padding: var(--space-xl) var(--space-2xl);
    border-top: 2px solid var(--color-border);
    background-color: var(--color-surface);
}

.accessories-heading {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--color-brand-light);
}

.accessories-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.accessories-line {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.accessories-line-number {
    flex-shrink: 0;
    width: 28px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-muted);
    text-align: right;
}

.accessories-line-input {
    flex: 1;
    height: 32px;
    padding: 0 var(--space-md);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.accessories-line-input:hover {
    border-color: var(--color-border);
}

.accessories-line-input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(0, 84, 166, 0.1);
}

.accessories-line-input:not(:placeholder-shown) {
    border-color: var(--color-border);
    background-color: var(--color-cell-editable-bg);
}


/* --------------------------------------------------------------------------
   Schedule Empty State
   -------------------------------------------------------------------------- */
#schedule-empty,
#mps-schedule-empty,
#gp-schedule-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: var(--space-3xl);
    gap: var(--space-lg);
}

/* Empty state icon — SVG illustration placeholder via CSS */
#schedule-empty::before,
#mps-schedule-empty::before,
#gp-schedule-empty::before {
    content: '';
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--color-brand-light);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 24 24' fill='none' stroke='%230054A6' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'/%3E%3Cpolyline points='2 17 12 22 22 17'/%3E%3Cpolyline points='2 12 12 17 22 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

#empty-message,
.empty-message-text {
    font-size: var(--font-size-md);
    color: var(--color-text-muted);
    text-align: center;
}


/* --------------------------------------------------------------------------
   Schedule Loading State
   -------------------------------------------------------------------------- */
#schedule-section.loading .schedule-table-wrapper,
#mps-schedule-section.loading .schedule-table-wrapper,
#gp-schedule-section.loading .schedule-table-wrapper {
    opacity: 0.4;
    pointer-events: none;
}


/* --------------------------------------------------------------------------
   Product Content Show/Hide
   -------------------------------------------------------------------------- */
.product-content.hidden {
    display: none;
}


/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    #schedule-toolbar,
    #mps-schedule-toolbar,
    #gp-schedule-toolbar {
        padding: var(--space-sm) var(--space-lg);
    }

    .schedule-table {
        font-size: var(--font-size-xs);
    }

    .schedule-table thead th {
        font-size: 9px;
        padding: var(--space-xxs) var(--space-xs);
    }

    .schedule-table tbody td {
        font-size: var(--font-size-xs);
        padding: var(--space-xxs) var(--space-xs);
    }

    .schedule-section-label {
        font-size: var(--font-size-sm);
        padding: var(--space-xs) var(--space-md);
    }

    #accessories-notes,
    #mps-accessories-notes {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
        padding: var(--space-lg);
    }
}