/* ASHRAE 62.1 OA Calculator - Modern Responsive Styles */

/* Reset and Base Styles */
.ashrae-calculator-container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #333;
    line-height: 1.6;
    background: #f5f7fa;
    min-height: 100vh;
}

/* Main Layout - Two Column */
.ashrae-main-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.ashrae-sidebar {
    width: 320px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.ashrae-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ashrae-sidebar-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.ashrae-tree-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

/* Tree Navigation Styles */
.ashrae-tree {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ashrae-tree-item {
    margin: 2px 0;
    user-select: none;
}

.ashrae-tree-item-content {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.ashrae-tree-item-content:hover {
    background: #f0f4ff;
}

.ashrae-tree-item.selected > .ashrae-tree-item-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 500;
}

.ashrae-tree-toggle {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #666;
    transition: transform 0.2s;
}

.ashrae-tree-item.selected > .ashrae-tree-item-content .ashrae-tree-toggle {
    color: white;
}

.ashrae-tree-toggle-empty {
    opacity: 0;
    pointer-events: none;
}

.ashrae-tree-icon {
    margin-right: 8px;
    font-size: 1rem;
}

.ashrae-tree-label {
    flex: 1;
    font-size: 0.95rem;
}

.ashrae-tree-duplicate {
    margin-left: auto;
    margin-right: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    padding: 4px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    position: relative;
}

.ashrae-tree-duplicate svg {
    width: 16px;
    height: 16px;
    display: block;
}

.ashrae-tree-duplicate:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(255, 255, 255, 0.2);
}

.ashrae-tree-item.selected > .ashrae-tree-item-content .ashrae-tree-duplicate {
    opacity: 0.85;
    color: white;
}

.ashrae-tree-item.selected > .ashrae-tree-item-content .ashrae-tree-duplicate:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
}

.ashrae-tree-item:not(.selected) > .ashrae-tree-item-content .ashrae-tree-duplicate {
    color: #666;
}

.ashrae-tree-item:not(.selected) > .ashrae-tree-item-content .ashrae-tree-duplicate:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* Tooltip for duplicate icon */
.ashrae-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ashrae-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
}

.ashrae-tree-duplicate:hover .ashrae-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ashrae-tree-children {
    list-style: none;
    margin: 0;
    padding-left: 24px;
    border-left: 1px dashed #ddd;
    margin-left: 10px;
}

.ashrae-tree-children.ashrae-tree-hidden {
    display: none;
}

.ashrae-tree-item[data-type="zone"] > .ashrae-tree-item-content {
    padding-left: 20px;
}

.ashrae-tree-item[data-type="space"] > .ashrae-tree-item-content {
    padding-left: 32px;
    cursor: pointer;
}

.ashrae-tree-item[data-type="space"] > .ashrae-tree-item-content:hover {
    background: #f0f4ff;
}

.ashrae-tree-item[data-type="space"].selected > .ashrae-tree-item-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 500;
}

/* Content Wrapper (contains scrollable content and footer) */
.ashrae-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f7fa;
}

/* Content Area (Scrollable - Scrollbar #1) */
.ashrae-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: 24px;
    background: #f5f7fa;
}

/* Section Styles */
.ashrae-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0; /* Don't shrink sections */
}

.ashrae-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #1a1a1a;
    border-bottom: 2px solid #667eea;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ashrae-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Form Styles */
.ashrae-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.ashrae-form-group {
    margin-bottom: 20px;
}

.ashrae-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
    font-size: 0.95rem;
}

.ashrae-label .required {
    color: #dc3545;
    margin-left: 4px;
}

.ashrae-input,
.ashrae-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.ashrae-input:focus,
.ashrae-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ashrae-input-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

.ashrae-input-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2) !important;
}

/* Calculated/Read-only input fields */
.ashrae-input[readonly],
input.ashrae-input[readonly],
input[readonly].ashrae-input {
    background-color: #f0f4f8 !important;
    color: #495057;
    cursor: not-allowed;
    border-color: #d0d7de;
}

.ashrae-input[readonly]:focus,
input.ashrae-input[readonly]:focus,
input[readonly].ashrae-input:focus {
    border-color: #d0d7de;
    box-shadow: 0 0 0 3px rgba(208, 215, 222, 0.1);
}

/* Disabled input fields */
.ashrae-input:disabled,
input.ashrae-input:disabled,
input:disabled.ashrae-input {
    background-color: #e9ecef !important;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #ced4da;
    opacity: 0.7;
}

.ashrae-error-message {
    color: #dc3545;
    font-size: 0.875rem;
    display: block;
    margin-top: 5px;
    font-weight: 500;
}

.ashrae-help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #666;
}

/* Radio and Checkbox Styles */
.ashrae-radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ashrae-radio-label,
.ashrae-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.ashrae-radio-label:hover,
.ashrae-checkbox-label:hover {
    background-color: #f5f5f5;
}

.ashrae-radio-label input[type="radio"],
.ashrae-checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Zone Entry Styles */
.ashrae-zone-entry {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
}

.ashrae-zone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.ashrae-zone-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ashrae-zone-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #0066cc;
    min-width: 80px;
}

.ashrae-inline-input {
    flex: 1;
    max-width: 400px;
}

.ashrae-zone-config {
    margin-bottom: 20px;
    padding: 16px;
    background: #f0f0f0;
    border-radius: 4px;
}

.ashrae-zone-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.ashrae-spaces-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.ashrae-spaces-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ashrae-spaces-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.ashrae-btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Content Footer (inside content wrapper, below scrollable area - Scrollbar #2) */
.ashrae-content-footer {
    flex-shrink: 0; /* Don't shrink */
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.ashrae-footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    max-width: 100%;
}

.ashrae-footer-buttons-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ashrae-footer-note {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
    margin-right: 10px;
    white-space: nowrap;
}

.ashrae-content-footer .ashrae-btn-small {
    padding: 10px 20px;
    font-size: 1rem;
    min-width: auto;
    flex-shrink: 0;
}


.ashrae-spaces-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ashrae-space-entry {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 16px;
    margin-left: 20px;
    position: relative;
}

.ashrae-space-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8e8e8;
}

.ashrae-space-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: #666;
}

.ashrae-space-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.ashrae-space-remove:hover {
    background: #c82333;
}

.ashrae-space-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.ashrae-zone-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.ashrae-zone-remove:hover {
    background: #c82333;
}

.ashrae-zone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.ashrae-unit-toggle {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.ashrae-unit-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.ashrae-unit-btn.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* Button Styles */
.ashrae-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 2px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    text-align: center;
}

.ashrae-btn-primary {
    background: #0066cc;
    color: white;
}

.ashrae-btn-primary:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.2);
}

.ashrae-btn-secondary {
    background: #6c757d;
    color: white;
}

.ashrae-btn-secondary:hover {
    background: #5a6268;
}

.ashrae-btn-large {
    padding: 14px 28px;
    font-size: 1.1rem;
}

.ashrae-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.ashrae-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
    padding: 20px;
}

/* Table Styles */
.ashrae-results-table-container {
    overflow-x: auto;
    margin-bottom: 24px;
}

.ashrae-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ashrae-table thead {
    background: #0066cc;
    color: white;
}

.ashrae-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: normal;
    line-height: 1.3;
    vertical-align: middle;
}

.ashrae-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.95rem;
    text-align: center;
    vertical-align: middle;
}

.ashrae-table tbody tr:hover {
    background: #f5f5f5;
}

.ashrae-table tbody tr.critical-zone {
    background: #fff3cd;
    font-weight: 600;
    border: 2px solid #ffc107;
}

.ashrae-table tbody tr.zone-separator {
    height: 8px;
    background: transparent;
}

.ashrae-table tbody tr.zone-separator td {
    padding: 0;
    border: none;
}

.ashrae-table .zone-name-cell {
    vertical-align: middle;
    text-align: center;
    font-weight: 600;
    background: #f5f5f5;
}

/* Unit header rows in results table */
.ashrae-table tbody tr.unit-header-row {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ashrae-table tbody tr.unit-header-row td {
    padding: 15px 12px;
    font-size: 1.1rem;
    border-bottom: 2px solid #555;
    text-align: left;
}

.ashrae-table .unit-header-cell {
    color: white;
}

.ashrae-table .unit-config-info {
    font-size: 0.9rem;
    font-weight: normal;
    opacity: 0.9;
    margin-left: 15px;
}

.ashrae-table tbody tr.unit-summary-row {
    background: #f0f0f0;
    font-weight: 600;
}

.ashrae-table tbody tr.unit-summary-row td {
    padding: 12px;
    text-align: left;
    border-top: 2px solid #ddd;
    border-bottom: 2px solid #ddd;
}

.ashrae-table tbody tr.unit-separator {
    height: 20px;
    background: transparent;
}

.ashrae-table tbody tr.unit-separator td {
    padding: 0;
    border: none;
    background: #f9f9f9;
}

.ashrae-table th small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.9;
    margin-top: 2px;
}

/* Air Balancing Section */
.ashrae-air-balancing {
    margin-top: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.ashrae-section-subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0066cc;
    margin-bottom: 15px;
}

.ashrae-balancing-table {
    width: 100%;
    max-width: 500px;
    margin-top: 15px;
}

.ashrae-balancing-table th {
    background: #0066cc;
    color: white;
    padding: 10px;
    text-align: left;
}

.ashrae-balancing-table td {
    padding: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.ashrae-balancing-table tbody tr:last-child td {
    border-bottom: none;
}

/* Summary Box */
.ashrae-summary-box {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    color: white;
    padding: 24px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ashrae-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ashrae-summary-item:last-child {
    border-bottom: none;
}

.ashrae-summary-total {
    font-size: 1.3rem;
    font-weight: 700;
    padding-top: 16px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.ashrae-summary-label {
    font-size: 1.1rem;
}

.ashrae-summary-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.ashrae-summary-total .ashrae-summary-value {
    font-size: 2rem;
}

/* Air Balancing Styles */
.ashrae-air-balancing {
    margin-top: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.ashrae-section-subtitle {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #333;
}

.ashrae-balancing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.ashrae-balancing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.ashrae-balancing-label {
    font-weight: 500;
    color: #666;
    font-size: 0.95rem;
}

.ashrae-balancing-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0066cc;
}

.ashrae-balancing-value.negative {
    color: #dc3545;
}

.ashrae-balancing-value.positive {
    color: #28a745;
}

/* Modal Styles */
.ashrae-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.ashrae-modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.ashrae-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.ashrae-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.ashrae-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ashrae-modal-close:hover {
    color: #000;
}

.ashrae-modal-body {
    padding: 24px;
}

.ashrae-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ashrae-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e0e0e0;
}

/* Print View Styles */
.ashrae-print-view {
    display: none;
}

@media print {
    @page {
        size: landscape;
        margin: 1cm;
    }
    body * {
        visibility: hidden;
    }
    
    .ashrae-print-view,
    .ashrae-print-view * {
        visibility: visible;
    }
    
    .ashrae-print-view {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        background: white;
    }
    
    .ashrae-print-section {
        margin-bottom: 30px;
        page-break-inside: avoid;
    }
    
    .ashrae-print-section h2 {
        color: #0066cc;
        border-bottom: 2px solid #0066cc;
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .ashrae-print-table {
        width: 100%;
        border-collapse: collapse;
        margin: 15px 0;
    }
    
    .ashrae-print-table th,
    .ashrae-print-table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
    }
    
    .ashrae-print-table th {
        background: #0066cc;
        color: white;
        font-weight: 600;
    }
    
    .ashrae-print-table tbody tr:nth-child(even) {
        background: #f9f9f9;
    }
    
    .ashrae-print-table tbody tr.critical-zone {
        background: #fff3cd !important;
        font-weight: 600;
        border: 2px solid #ffc107;
    }
    
    
    .ashrae-print-section h3 {
        margin-top: 25px;
        margin-bottom: 15px;
        color: #333;
        font-size: 1.1em;
        border-bottom: 2px solid #5C6BC0;
        padding-bottom: 5px;
    }
    
    .ashrae-print-section p {
        margin-top: 10px;
        margin-bottom: 20px;
        line-height: 1.6;
    }
    
    /* Ensure diagrams don't break across pages */
    .ashrae-print-section > div {
        page-break-inside: avoid;
    }
    
    .ashrae-print-table th {
        color: white;
    }
    
    .ashrae-print-summary {
        background: #f0f0f0;
        padding: 15px;
        border-radius: 4px;
        margin-top: 20px;
    }
    
    .ashrae-formulas-container {
        line-height: 1.8;
    }
    
    .ashrae-formulas-container h3 {
        border-bottom: 2px solid #0066cc;
        padding-bottom: 5px;
    }
    
    .ashrae-formulas-container h4 {
        font-size: 1rem;
        margin-top: 15px;
    }
    
    .ashrae-formulas-container ul {
        line-height: 1.6;
    }
    
    .ashrae-formulas-container li {
        margin: 5px 0;
    }
    
    .ashrae-print-unit-section {
        page-break-before: always;
        margin-top: 30px;
        min-height: 100px; /* Prevent empty pages */
    }
    
    .ashrae-print-unit-section:first-child {
        page-break-before: auto;
    }
    
    /* Prevent empty pages from empty sections */
    .ashrae-print-section:empty {
        display: none !important;
    }
    
    /* Ensure sections have content before page breaks */
    .ashrae-print-section {
        min-height: 50px;
    }
    
    /* Hide sections with only empty paragraphs */
    .ashrae-print-section > p:only-child:empty {
        display: none;
    }
    
    .ashrae-print-unit-title {
        color: #667eea;
        border-bottom: 3px solid #667eea;
        padding-bottom: 10px;
        margin-bottom: 20px;
        font-size: 1.8rem;
        page-break-after: avoid;
    }
    
    /* Ensure result tables print correctly */
    .ashrae-print-section table {
        width: 100%;
        border-collapse: collapse;
        margin: 15px 0;
    }
    
    .ashrae-print-section table th,
    .ashrae-print-section table td {
        border: 1px solid #ddd;
        padding: 8px;
        text-align: left;
        font-size: 0.9rem;
    }
    
    .ashrae-print-section table th {
        background: #0066cc;
        color: white;
        font-weight: 600;
    }
    
    
    /* Ensure proper spacing in print */
    .ashrae-print-section {
        break-inside: avoid;
    }
    
    .ashrae-print-section h2,
    .ashrae-print-section h3 {
        break-after: avoid;
    }
}

#pressurization-section,
#zone-balancing-section,
#verification-report-section {
    margin-top: 20px;
}

/* Results Section Styling */
.ashrae-results {
    display: block;
}

.ashrae-results .ashrae-section {
    margin-bottom: 24px;
}

.ashrae-results-table-container {
    overflow-x: auto;
    margin-bottom: 24px;
    -webkit-overflow-scrolling: touch;
}

.ashrae-results #zone-results-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ashrae-results #zone-results-table thead {
    background: #0066cc;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ashrae-results #zone-results-table th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: normal;
    line-height: 1.3;
    vertical-align: middle;
}

.ashrae-results #zone-results-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.95rem;
    text-align: center !important;
    vertical-align: middle;
}

.ashrae-results #zone-results-table tbody tr:hover {
    background: #f5f5f5;
}

.ashrae-results #zone-results-table tbody tr.critical-zone {
    background: #fff3cd;
    font-weight: 600;
    border: 2px solid #ffc107;
}


/* Building Pressurization & Air Balancing Styles */
.ashrae-balancing-summary {
    margin: 20px 0;
}

.ashrae-balancing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.ashrae-balancing-card {
    background: #ffffff;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    min-height: 130px;
    transition: box-shadow 0.2s;
}

.ashrae-balancing-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ashrae-balancing-card-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 16px;
    font-weight: 500;
    line-height: 1.4;
}

.ashrae-balancing-card-value {
    font-size: 1.6rem;
    font-weight: bold;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.ashrae-balancing-card-detail {
    font-size: 0.85rem;
    color: #999;
    margin-top: auto;
    line-height: 1.4;
}

/* Legacy support for old class names */
.ashrae-balancing-item {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.ashrae-balancing-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ashrae-balancing-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.2;
}

.ashrae-balancing-detail {
    font-size: 0.85rem;
    color: #999;
    margin-top: auto;
}

/* Zone Balancing Table Styles */
#zone-balancing-content .ashrae-table {
    margin-top: 15px;
}

/* Verification Report Styles */
.ashrae-verification-report {
    margin: 20px 0;
}

.ashrae-compliance-status {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.ashrae-compliance-details {
    margin: 20px 0;
}

.ashrae-compliance-details h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.ashrae-compliance-details ul li {
    padding: 10px;
    margin: 8px 0;
    border-radius: 4px;
    font-weight: 500;
}

.ashrae-oa-verification {
    margin-top: 20px;
}

.ashrae-oa-verification h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}

/* Mobile Optimization - Enhanced Touch Targets */
@media (max-width: 768px) {
    /* Larger touch targets for mobile */
    .ashrae-btn {
        min-height: 44px; /* iOS recommended minimum */
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .ashrae-input,
    .ashrae-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    /* Improved form spacing on mobile */
    .ashrae-form-group {
        margin-bottom: 20px;
    }
    
    /* Better table scrolling on mobile */
    .ashrae-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Balancing grid stacks on mobile */
    .ashrae-balancing-grid {
        grid-template-columns: 1fr;
    }
    
    /* Improved sidebar on mobile */
    .ashrae-sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .ashrae-main-layout {
        flex-direction: column;
    }
    
    /* Content wrapper adjustments */
    .ashrae-content-wrapper {
        width: 100%;
    }
    
    /* Footer buttons stack better on mobile */
    .ashrae-footer-buttons-row {
        flex-direction: column;
        width: 100%;
    }
    
    .ashrae-footer-buttons-row .ashrae-btn {
        width: 100%;
        margin: 5px 0;
    }
    
    /* Tree navigation improvements */
    .ashrae-tree-item-content {
        padding: 12px 8px;
        min-height: 44px;
    }
    
    /* Section improvements */
    .ashrae-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    /* Better spacing for radio buttons */
    .ashrae-radio-group label {
        padding: 12px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ashrae-main-layout {
        height: 100vh;
    }
    
    .ashrae-calculator-container {
        padding: 12px;
    }
    
    .ashrae-section {
        padding: 16px;
    }
    
    .ashrae-form-grid {
        grid-template-columns: 1fr;
    }
    
    .ashrae-zone-grid {
        grid-template-columns: 1fr;
    }
    
    .ashrae-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .ashrae-actions {
        flex-direction: column;
    }
    
    .ashrae-btn-large {
        width: 100%;
    }
    
    .ashrae-table {
        font-size: 0.85rem;
    }
    
    .ashrae-table th,
    .ashrae-table td {
        padding: 8px 6px;
    }
    
    .ashrae-summary-box {
        padding: 16px;
    }
    
    .ashrae-summary-value {
        font-size: 1.2rem;
    }
    
    .ashrae-summary-total .ashrae-summary-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .ashrae-section-title {
        font-size: 1.2rem;
    }
    
    .ashrae-table {
        font-size: 0.75rem;
    }
    
    .ashrae-table th,
    .ashrae-table td {
        padding: 6px 4px;
    }
    
    /* Extra small screens - further optimizations */
    .ashrae-balancing-value {
        font-size: 1.1rem;
    }
    
    /* Compact button layout */
    .ashrae-footer-content {
        padding: 8px;
    }
    
    .ashrae-footer-note {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger hit areas for touch */
    .ashrae-btn,
    .ashrae-tree-toggle,
    .ashrae-tree-item-content {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .ashrae-btn:hover {
        transform: none;
    }
    
    /* Better focus states for touch */
    .ashrae-input:focus,
    .ashrae-select:focus {
        outline: 3px solid #667eea;
        outline-offset: 2px;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .ashrae-main-layout {
        height: auto;
        min-height: 100vh;
    }
    
    .ashrae-sidebar {
        max-height: 100vh;
        overflow-y: auto;
    }
    
    .ashrae-content-area {
        max-height: calc(100vh - 80px);
    }
}

