/* ─── Brand variables (overridden per tenant by layout inline styles) ─────── */
/* These are fallback defaults — the layout <style> block sets the actual values */

header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}
header img {max-width: 300px;}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: absolute;
    right: 20px;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.dark-mode-toggle:hover {
    background: #e9ecef;
    transform: scale(1.1);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

body.dark-mode .dark-mode-icon::before {
    content: '☀️';
}

body.dark-mode .dark-mode-icon {
    display: none;
}

body.dark-mode .dark-mode-toggle::after {
    content: '☀️';
    font-size: 24px;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
    color: #f0f0f0;
}

body.dark-mode .unit-toggle-container,
body.dark-mode .templates-section,
body.dark-mode .deck-areas-section {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-mode .unit-toggle-btn,
body.dark-mode .template-btn,
body.dark-mode .deck-area-card {
    background: #383838;
    border-color: #505050;
    color: #e0e0e0;
}

body.dark-mode .unit-toggle-btn:hover,
body.dark-mode .template-btn:hover {
    background: #404040;
}

body.dark-mode .unit-toggle-btn.active,
body.dark-mode .template-btn.active {
    background: var(--brand-primary);
    color: white;
}

body.dark-mode input,
body.dark-mode select {
    background: #383838;
    border: 1px solid #505050;
    color: #e0e0e0;
}

body.dark-mode input:focus,
body.dark-mode select:focus {
    outline: 2px solid var(--brand-primary);
    background: #404040;
}

body.dark-mode .results {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode #visual {
    background: #2d2d2d;
    border-color: #505050;
}

body.dark-mode button {
    background-color: var(--brand-primary);
}

body.dark-mode button:hover {
    background-color: var(--brand-primary-dark);
}

body.dark-mode .dark-mode-toggle {
    background: #383838;
    border-color: #505050;
}

body.dark-mode .dark-mode-toggle:hover {
    background: #404040;
}

body.dark-mode fieldset {
    border-color: #505050;
}

body.dark-mode label {
    color: #e0e0e0;
}

body.dark-mode .toggle-group {
    border-top-color: #444;
}

body.dark-mode .fascia-section,
body.dark-mode .balustrade-section {
    border-top-color: #444;
}

body.dark-mode #fasciaOptions {
    border-left-color: var(--brand-primary);
}

body.dark-mode #balustradeOptions {
    border-left-color: var(--brand-primary);
}

body.dark-mode .fascia-button {
    background-color: #383838;
    border-color: #505050;
    color: #e0e0e0;
}

body.dark-mode .fascia-button.selected {
    background-color: var(--brand-primary);
    color: white;
}

body.dark-mode .waste-badge.excellent {
    background-color: #1e5631;
    color: #b8e6c5;
}

body.dark-mode .waste-badge.good {
    background-color: #5c4a1a;
    color: #ffe9b3;
}

body.dark-mode .waste-badge.moderate {
    background-color: #5c3317;
    color: #ffd4b3;
}

body.dark-mode .waste-badge.high {
    background-color: #5c1f1f;
    color: #ffb3b3;
}

body.dark-mode #wasteSummary {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #505050;
}

/* Tooltip Styles */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #6c757d;
    color: white;
    font-size: 12px;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: middle;
}

.tooltip:hover .tooltip-icon {
    background: var(--brand-primary);
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 280px;
    background-color: #333;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    font-size: 13px;
    font-weight: normal;
    line-height: 1.4;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

body.dark-mode .tooltip .tooltiptext {
    background-color: #f8f9fa;
    color: #212529;
}

body.dark-mode .tooltip .tooltiptext::after {
    border-color: #f8f9fa transparent transparent transparent;
}

body {
    font-family: var(--brand-font-body);
    padding: 20px;
    max-width: 1200px;
    margin: auto;
}
h1, h2, h3, h4, h5, h6 {
    font-family: var(--brand-font-heading);
}
h1 { text-align: center; }
h2 { color: #333; margin-top: 30px; }

/* Unit Toggle Styles */
.unit-toggle-container {
    text-align: center;
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.unit-toggle-container label {
    font-weight: bold;
    margin-right: 15px;
    color: #333;
}

.unit-toggle-buttons {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.unit-toggle-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #666;
}

.unit-toggle-btn:hover {
    background: #e8f5e9;
    border-color: var(--brand-primary);
}

.unit-toggle-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary-dark);
    color: white;
    font-weight: bold;
}

.label-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.unit-label {
    color: var(--brand-primary);
    font-weight: 600;
    font-size: 0.9em;
}

/* Template Section Styles */
.templates-section {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
}

.templates-section h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2c5f2d;
    font-size: 1.5rem;
}

.templates-description {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
}

.template-btn {
    background: white;
    border: 2px solid #ddd;
    border-radius: calc(var(--brand-border-radius) * 2);
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.template-btn:hover {
    background: #f0f7f0;
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.template-btn.active {
    background: var(--brand-primary);
    border-color: var(--brand-primary-dark);
    color: white;
}

.template-btn.active .template-size {
    color: #e8f5e9;
}

.template-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.template-name {
    font-weight: bold;
    font-size: 0.95rem;
    color: #333;
}

.template-btn.active .template-name {
    color: white;
}

.template-size {
    font-size: 0.85rem;
    color: #666;
}
form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 20px; }
label, fieldset { font-weight: bold; display: flex; flex-direction: column; }
input, select {
    padding: 8px;
    font-size: 1rem;
    font-family: var(--brand-font-body);
    border-radius: var(--brand-border-radius);
    border: 1px solid #ccc;
}
fieldset { grid-column: span 2; }
.checkbox-group { display: flex; gap: 10px; }
.results {
    background: #f4f4f4;
    padding: 15px;
    border-radius: var(--brand-border-radius);
    margin-bottom: 20px;
}
.results p { margin: 8px 0; }
#visual {
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
    min-height: 500px;
}

/* Canvas Container with Pan/Zoom */
.canvas-container {
    position: relative;
    overflow: auto;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #ffffff;
    margin: 20px 0;
    max-height: 80vh;
    cursor: grab;
}

.canvas-container:active {
    cursor: grabbing;
}

.canvas-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
    z-index: 10000;
    background: #fff;
}

#visual canvas {
    background: #ffffff;
    display: block;
    margin: auto;
    transition: transform 0.2s ease;
}

/* Canvas Controls */
.canvas-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 10001;
}

.canvas-control-btn {
    padding: 10px 16px;
    font-size: 1.1rem;
    background-color: #2196F3;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: bold;
    min-width: 50px;
    position: relative;
    z-index: 10002;
}

.canvas-control-btn:hover {
    background-color: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.canvas-control-btn:active {
    transform: translateY(0);
}
.legend { margin-top: 10px; font-size: 14px; text-align: center; }
button {
    padding: 10px;
    font-size: 1rem;
    font-family: var(--brand-font-body);
    background-color: var(--brand-primary);
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 10px;
    border-radius: var(--brand-border-radius);
    transition: background-color 0.3s ease;
}
button:hover { background-color: var(--brand-primary-dark); }
#printButton { background-color: #2196F3; }
#printButton:hover { background-color: #0b7dda; }

/* Error handling styles */
.error-message {
    display: none;
    color: #d32f2f;
    font-size: 0.875rem;
    font-weight: normal;
    margin-top: 4px;
    margin-bottom: 0;
}

.input-error {
    border: 2px solid #d32f2f !important;
    background-color: #ffebee;
}

input.input-error:focus, select.input-error:focus {
    outline: none;
    border-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

/* Helper text styles */
.helper-text {
    display: block;
    color: #666;
    font-size: 0.85rem;
    font-style: italic;
    margin-top: 4px;
    margin-bottom: 0;
    line-height: 1.4;
}

body.dark-mode .helper-text {
    color: #999;
}

/* Button group for Calculate and Clear */
.button-group {
    display: flex;
    gap: 10px;
    grid-column: span 2;
}

.button-group button {
    flex: 1;
    margin-top: 0;
}

.clear-btn {
    background-color: #757575;
}

.clear-btn:hover {
    background-color: #616161;
}

/* Project Management Section */
.project-management {
    background: black;
    border-radius: 12px;
    padding: 20px;
    margin: 25px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.project-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.project-name-group,
.project-selector-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.project-name-group label,
.project-selector-group label {
    color: white;
    font-weight: 600;
    font-size: 13px;
}

.project-name-input,
.project-select {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.project-name-input:focus,
.project-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.project-notes-group {
    margin-bottom: 15px;
}

.project-notes-group label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.project-notes-input {
    width: 98%;
    padding: 10px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 50px;
    transition: all 0.3s ease;
}

.project-notes-input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.project-notes-input::placeholder {
    color: #999;
    font-style: italic;
}

.project-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: white;
    font-size: 14px;
}

/* Cloud Sync Section */

.cloud-sync-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: white;
}

.cloud-icon {
    font-size: 20px;
}

.cloud-sync-title {
    font-weight: 600;
    font-size: 14px;
}

.cloud-sync-status {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.cloud-sync-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cloud-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.cloud-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.cloud-btn:active:not(:disabled) {
    transform: translateY(0);
}

.cloud-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cloud-btn .btn-icon {
    font-size: 16px;
}

.config-btn:hover:not(:disabled) {
    background: rgb(103 172 91 / 47%);
}

.save-cloud-btn:hover:not(:disabled) {
    background: rgba(33, 150, 243, 0.3);
}

.load-cloud-btn:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.3);
}

.save-project-btn:hover:not(:disabled) {
    background: rgba(33, 150, 243, 0.3);
}

.save-project-btn.unsaved {
    background: rgba(255, 152, 0, 0.3);
    border-color: rgba(255, 152, 0, 0.6);
    animation: pulse 2s infinite;
}

.save-project-btn.unsaved:hover:not(:disabled) {
    background: rgba(255, 152, 0, 0.5);
}

@keyframes pulse {
    0%, 100% {
        border-color: rgba(255, 152, 0, 0.6);
    }
    50% {
        border-color: rgba(255, 152, 0, 1);
    }
}

.load-project-btn:hover:not(:disabled) {
    background: rgba(76, 175, 80, 0.3);
}

.new-project-btn:hover:not(:disabled) {
    background: rgba(33, 150, 243, 0.3);
}

.manage-projects-btn:hover:not(:disabled) {
    background: rgb(103 172 91 / 47%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .cloud-sync-actions {
        grid-template-columns: 1fr;
    }

    .cloud-btn {
        width: 100%;
    }
}

.label-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.label-with-icon svg {
    width: 20px;
    height: 20px;
    fill: #555;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    margin: 10px 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 28px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--brand-primary);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(22px);
}

.toggle-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-evenly;
    margin: 10px 0;
    grid-column: span 2;
    border-top: 1px solid var(--border-color, #ddd);
    padding-top: 12px;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.fascia-grid {
    display: grid;
    grid-template-areas:
        ". top ."
        "left center right"
        ". bottom .";
    grid-template-columns: auto auto auto;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    width: fit-content;
}

.fascia-button {
    padding: 6px 12px;
    border: 2px solid #aaa;
    border-radius: 5px;
    background-color: #eee;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
    text-align: center;
}

.fascia-button.selected {
    background-color: var(--brand-primary);
    color: white;
    border-color: var(--brand-primary);
}

.fascia-top { grid-area: top; }
.fascia-bottom { grid-area: bottom; }
.fascia-left { grid-area: left; }
.fascia-right { grid-area: right; }
.fascia-center {
    grid-area: center;
    font-size: 14px;
    font-weight: bold;
    color: #3b3b3b;
    margin-left: 17px;
}

.fascia-balustrade-group {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.fascia-section {
    border-top: 1px solid var(--border-color, #ddd);
    padding-top: 12px;
    margin-top: 4px;
}

#fasciaOptions {
    margin-top: 10px;
    border-left: 3px solid var(--brand-primary, #2e7d32);
    padding-left: 14px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.fascia-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Balustrade collapsible section */
.balustrade-section {
    padding-top: 12px;
}

.balustrade-toggle-label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}

.balustrade-toggle-label input[type="checkbox"],
.gate-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--brand-primary, #2e7d32);
}

.gate-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    user-select: none;
}

#balustradeOptions {
    margin-top: 10px;
    padding-left: 4px;
    border-left: 3px solid var(--brand-primary, #2e7d32);
    padding-left: 14px;
}

#calculateBtn.full-width {
    grid-column: span 2;
    width: 100%;
}

.results-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: space-between;
}

.results-grid > div {
    flex: 1 1 48%;
    min-width: 0;
}

#cutListSection {
    overflow-x: auto;
}


.results ul {
    padding-left: 20px;
    margin-top: 5px;
}

.results li {
    margin-bottom: 5px;
}

/* ===== COST BREAKDOWN TOGGLES ===== */
#estimateBreakdown {
    padding-left: 0;
    list-style: none;
}

.cost-line {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    transition: opacity 0.2s ease;
}

.cost-line label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-direction: row;
    margin-bottom: 0;
    font-weight: normal;
    width: 100%;
}

.cost-toggle {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--brand-primary, #4CAF50);
}

.cost-total-line {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, #ddd);
    list-style: none;
}

/* ===== MOBILE IMPROVEMENTS ===== */
@media (max-width: 600px) {
    form {
        grid-template-columns: 1fr !important;
    }

    #fasciaOptions {
        flex-direction: column;
        gap: 20px;
    }

    .fascia-inputs {
        width: 100%;
    }

    .fascia-grid {
        justify-content: center;
    }

    /* Larger touch targets for mobile */
    button {
        min-height: 48px;
        font-size: 16px;
        padding: 14px 20px;
    }

    .fascia-balustrade-group {
        grid-column: span 1;
        grid-template-columns: 1fr;
    }

    .toggle-group {
        grid-column: span 1;
        justify-content: flex-start;
    }

    .button-group {
        grid-column: span 1;
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
        min-height: 50px;
    }

    .unit-toggle-btn {
        min-height: 48px;
        padding: 12px 18px;
        font-size: 15px;
    }

    .template-btn {
        min-height: 100px;
        padding: 18px 14px;
    }

    .fascia-button {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 16px;
        font-size: 16px;
    }

    .toggle-switch {
        width: 60px;
        height: 34px;
    }

    .toggle-switch .slider:before {
        height: 26px;
        width: 26px;
    }

    .toggle-switch input:checked + .slider:before {
        transform: translateX(26px);
    }

    /* Larger input fields */
    input,
    select {
        min-height: 44px;
        font-size: 16px;
        padding: 10px;
    }

    /* Larger dark mode toggle */
    .dark-mode-toggle {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }

    /* Deck area cards */
    .deck-area-card {
        min-height: 80px;
        padding: 18px;
    }

    .deck-area-remove {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .add-deck-btn,
    .combined-totals-btn {
        min-height: 50px;
        font-size: 16px;
    }

    #fasciaOptions > fieldset {
        margin: 0 auto;
    }

    .templates-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .template-icon {
        font-size: 2rem;
    }

    .template-name {
        font-size: 0.85rem;
    }

    .template-size {
        font-size: 0.75rem;
    }

    /* Larger tooltip for mobile */
    .tooltip .tooltip-icon {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
}

/* Waste Indicator Badges */
.waste-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.95em;
    margin: 5px 0;
    border: 2px solid;
}

.waste-badge.excellent {
    background-color: #d4edda;
    color: #155724;
    border-color: #28a745;
}

.waste-badge.good {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffc107;
}

.waste-badge.moderate {
    background-color: #ffe5d0;
    color: #8b4513;
    border-color: #fd7e14;
}

.waste-badge.high {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
}

.waste-percentage {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.85em;
    margin-left: 8px;
}

.waste-percentage.low {
    background-color: #d4edda;
    color: #155724;
}

.waste-percentage.medium {
    background-color: #fff3cd;
    color: #856404;
}

.waste-percentage.high {
    background-color: #ffe5d0;
    color: #8b4513;
}

.waste-percentage.very-high {
    background-color: #f8d7da;
    color: #721c24;
}

#wasteSummary {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 10px;
    margin-top: 8px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Deck Areas Section */
.deck-areas-section {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.deck-areas-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95em;
}

.deck-areas-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.deck-area-card {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    cursor: move;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.deck-area-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.deck-area-card.drag-over {
    border-color: #2196F3;
    border-style: dashed;
    background: #e3f2fd;
}

.deck-area-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.deck-area-card.active {
    border-color: var(--brand-primary);
    background: #e8f5e9;
}

.deck-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.deck-area-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.deck-area-status {
    background: var(--brand-primary);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
}

.deck-area-preview {
    width: 100%;
    height: 120px;
    background: #f5f5f5;
    border-radius: 6px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
}

.deck-area-preview canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
}

.deck-area-preview-placeholder {
    color: #999;
    font-size: 0.85em;
    text-align: center;
}

.deck-area-info {
    font-size: 0.9em;
    color: #666;
    margin: 5px 0 0 0;
}

.deck-area-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.deck-area-action-btn {
    flex: 1;
    padding: 6px 12px;
    font-size: 0.85em;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.deck-area-action-btn:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.deck-area-action-btn.clone-btn {
    color: #2196F3;
}

.deck-area-action-btn.clone-btn:hover {
    background: #e3f2fd;
    border-color: #2196F3;
}

.deck-area-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.deck-area-card:hover .deck-area-remove {
    display: flex;
}

.deck-area-remove:hover {
    background: #c82333;
}

.combined-totals-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.export-combined-btn, .print-combined-btn {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-combined-btn {
    background: #2196F3;
    color: white;
}

.export-combined-btn:hover {
    background: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(33, 150, 243, 0.3);
}

.print-combined-btn {
    background: #9C27B0;
    color: white;
}

.print-combined-btn:hover {
    background: #7B1FA2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(156, 39, 176, 0.3);
}

.add-deck-btn, .combined-totals-btn {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
}

.add-deck-btn {
    background: var(--brand-primary);
    color: white;
}

.add-deck-btn:hover {
    background: var(--brand-primary-dark);
}

.combined-totals-btn {
    background: #2196F3;
    color: white;
}

.combined-totals-btn:hover {
    background: #0b7dda;
}

/* Combined Totals Section */
.combined-totals {
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    color: white;
}

.combined-totals h2 {
    color: white;
    margin-top: 0;
}

.combined-totals h3, .combined-totals h4 {
    color: #f0f0f0;
}

.combined-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.combined-areas-summary {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.combined-areas-summary p {
    margin: 5px 0;
    font-size: 0.95em;
}

#combinedCostBreakdown {
    list-style: none;
    padding: 0;
}

#combinedCostBreakdown li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== PRINT STYLESHEET ===== */
@media print {
    /* Hide interactive elements */
    .unit-toggle-container,
    .templates-section,
    .deck-areas-section,
    #addDeckAreaBtn,
    #showCombinedTotalsBtn,
    .button-group,
    #printButton,
    .dark-mode-toggle,
    .project-management,
    button,
    .toggle-group,
    .toggle-wrapper,
    .fascia-grid {
        display: none !important;
    }

    /* Hide form inputs */
    form {
        display: none !important;
    }

    /* Clean page breaks */
    body {
        background: white !important;
        color: black !important;
        padding: 0;
        margin: 0;
        max-width: 100%;
    }

    header {
        text-align: center;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
        margin-bottom: 20px;
        page-break-after: avoid;
    }

    h1, h2, h3 {
        color: #000 !important;
        page-break-after: avoid;
    }

    /* Results section */
    .results {
        background: white !important;
        border: 1px solid #000;
        padding: 15px;
        margin-bottom: 20px;
        page-break-inside: avoid;
    }

    .results p {
        margin: 8px 0;
        font-size: 12pt;
    }

    .results-grid {
        display: block !important;
    }

    .results-grid > div {
        page-break-inside: avoid;
        margin-bottom: 15px;
    }

    /* Canvas/Visual */
    #visual {
        background: white !important;
        border: 1px solid #000;
        page-break-inside: avoid;
        page-break-before: always;
    }

    #deckCanvas {
        max-width: 100%;
        height: auto;
    }

    /* Waste badges */
    .waste-badge {
        border: 1px solid #000 !important;
        background: white !important;
        color: #000 !important;
    }

    #wasteSummary {
        background: white !important;
        border: 2px solid #000;
        color: #000 !important;
        page-break-inside: avoid;
    }

    /* Combined totals */
    .combined-totals {
        background: white !important;
        border: 2px solid #000;
        color: #000 !important;
        page-break-before: always;
    }

    .combined-totals h2,
    .combined-totals h3,
    .combined-totals h4 {
        color: #000 !important;
    }

    .combined-areas-summary {
        background: #f0f0f0 !important;
        border: 1px solid #000;
    }

    /* Lists */
    ul {
        page-break-inside: avoid;
    }

    /* Add header/footer */
    @page {
        margin: 2cm;

        @top-center {
            content: "EstiFlow - Deck Estimate";
        }

        @bottom-right {
            content: "Page " counter(page) " of " counter(pages);
        }
    }

    /* Print company info on first page */
    header::after {
        content: "EstiFlow | Professional Deck Installation";
        display: block;
        font-size: 10pt;
        color: #666;
        margin-top: 10px;
    }
}

/* ===== NOTIFICATION SYSTEM ===== */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
    pointer-events: all;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid #28a745;
}

.notification.success {
    border-left-color: #28a745;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.warning {
    border-left-color: #ffc107;
}

.notification.info {
    border-left-color: #17a2b8;
}

.notification-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.notification.success .notification-icon::before {
    content: '✓';
    color: #28a745;
}

.notification.error .notification-icon::before {
    content: '✕';
    color: #dc3545;
}

.notification.warning .notification-icon::before {
    content: '⚠';
    color: #ffc107;
}

.notification.info .notification-icon::before {
    content: 'ℹ';
    color: #17a2b8;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #333;
}

.notification-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.notification-close:hover {
    background: #f0f0f0;
    color: #333;
}

.notification.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Dark mode support for notifications */
body.dark-mode .notification {
    background: #2d2d2d;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .notification-title {
    color: #e0e0e0;
}

body.dark-mode .notification-message {
    color: #b0b0b0;
}

body.dark-mode .notification-close {
    color: #999;
}

body.dark-mode .notification-close:hover {
    background: #3d3d3d;
    color: #e0e0e0;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .notification {
        min-width: auto;
        max-width: none;
    }
}

/* ===== LOADING INDICATOR ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.loading-spinner {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: scaleIn 0.3s ease-out;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--brand-primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Dark mode support for loading indicator */
body.dark-mode .loading-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .loading-spinner {
    background: #2d2d2d;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

body.dark-mode .loading-text {
    color: #e0e0e0;
}

body.dark-mode .spinner {
    border-color: #444;
    border-top-color: var(--brand-primary);
}

/* ── Shared JS-created modal styles ─────────────────────────────────────── */
.js-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.js-modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Width variants */
.js-modal-content--sm  { max-width: 500px; }
.js-modal-content--md  { max-width: 600px; }
.js-modal-content--lg  { max-width: 700px; }

/* Shared project-card style used in all three modals */
.js-project-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    transition: all 0.3s ease;
}

.js-project-card--current {
    border-color: var(--brand-primary);
    background: #f1f8f4;
}

/* Shared project-select button (Load From Cloud modal) */
.js-project-btn {
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

.js-project-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Shared close/cancel button */
.js-modal-close-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.js-modal-close-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

.js-modal-cancel-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: #757575;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

body.dark-mode .js-modal-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .js-project-card {
    background: #3a3a3a;
    border-color: #555;
}

body.dark-mode .js-modal-close-btn {
    background: #3a3a3a;
    color: #ccc;
    border-color: #555;
}
