/* Modern Professional SaaS Dashboard Styles */
:root {
    --brand-indigo: #4f46e5;
    --brand-indigo-soft: #eef2ff;
    --brand-success: #10b981;
    --brand-warning: #f59e0b;
    --surface-bg: #fcfdfe;
    --surface-card: #ffffff;
    --border-subtle: #f1f5f9;
    --border-main: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-tool: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    background-color: var(--surface-bg);
}

.saas-layout {
    max-width: 1200px;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .saas-layout { grid-template-columns: 1fr; }
}

.saas-card {
    background: var(--surface-card);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    box-shadow: var(--shadow-tool);
    overflow: hidden;
}

.saas-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}

.saas-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.saas-card-body {
    padding: 1.5rem;
}

.section-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--brand-indigo);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.load-row {
    background: #fcfdfe;
    border: 1px solid var(--border-main);
    border-radius: 8px;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 40px;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    align-items: center;
    transition: all 0.2s;
}

.load-row:hover {
    border-color: var(--brand-indigo);
    box-shadow: 0 0 0 1px var(--brand-indigo);
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-remove { background: #fff1f2; color: #e11d48; }
.btn-remove:hover { background: #e11d48; color: white; }

.btn-add-category {
    background: var(--brand-indigo-soft);
    color: var(--brand-indigo);
    border: 1px dashed var(--brand-indigo);
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0.5rem;
}

.btn-add-category:hover { background: #e0e7ff; }

/* Sticky Sidebar Results */
.saas-sidebar {
    position: sticky;
    top: 2rem;
}

.result-stat {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.result-stat:last-child { border-bottom: none; }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.main-result-box {
    background: var(--brand-indigo);
    color: white;
    padding: 2rem 1.5rem;
    text-align: center;
    border-radius: 12px;
    margin-top: 1.5rem;
}

.main-result-value {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.main-result-unit {
    font-size: 1.25rem;
    opacity: 0.8;
}

/* Global Button */
.btn-primary-action {
    background: var(--brand-indigo);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1rem;
    width: 100%;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.2);
    transition: transform 0.2s;
}

.btn-primary-action:hover {
    transform: translateY(-2px);
    background: var(--brand-indigo-dark, #4338ca);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* FAQ Accordion Styling */
.faq-accordion {
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    margin-top: 2rem;
}

.faq-item {
    border-bottom: 1px solid var(--border-subtle);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    width: 100%;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s;
}

.faq-question:hover {
    background: #f8fafc;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: #fafbfc;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
    padding: 0 1.5rem;
}

.faq-item.active .faq-answer {
    max-height: 800px;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    border-top: 1px solid var(--border-subtle);
    border-left: 4px solid var(--brand-indigo);
    background: linear-gradient(to right, #f8fafc, #ffffff);
}

.faq-icon {
    transition: transform 0.3s;
    color: var(--text-muted);
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
    color: var(--brand-indigo);
}

.faq-item.active .faq-question {
    color: var(--brand-indigo);
}

/* MOBILE RESPONSIVENESS OVERRIDES */
@media (max-width: 768px) {
    /* Stage Results Grids (Stage 2, 3, 4) */
    #stage-2-card .saas-card-body > div,
    #stage-3-card .saas-card-body > div,
    #stage-4-card .saas-card-body > div {
        grid-template-columns: 1fr !important;
    }

    #stage-2-card div[style*="border-right"],
    #stage-3-card div[style*="border-right"],
    #stage-4-card div[style*="border-right"] {
        border-right: none !important;
        border-bottom: 1px solid var(--border-main) !important;
    }

    /* Inner Form Grids */
    .saas-grid, 
    #stage-2-card .saas-grid,
    #stage-3-card .saas-grid, 
    #stage-4-card .saas-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Load Analysis Table Responsive Stacking */
    div[style*="grid-template-columns: 2fr 1fr 1fr 40px"] {
        display: none !important; /* Hide column headers on mobile */
    }

    .load-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        padding: 1.25rem !important;
        position: relative !important;
        background: #f8fafc !important;
    }

    .load-row .btn-remove {
        position: absolute !important;
        top: 0.75rem !important;
        right: 0.75rem !important;
        background: white !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05) !important;
    }

    /* Floating Action Bar */
    #global-actions-bottom {
        flex-direction: column !important;
        gap: 0.8rem !important;
        bottom: 1rem !important;
        width: calc(100% - 1.5rem) !important;
        margin: 2rem auto !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        position: sticky !important;
    }

    #global-actions-bottom button {
        flex: 1 1 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        padding: 0.8rem !important;
        font-size: 0.9rem !important;
    }

    #global-actions-bottom div[style*="width: 1px"] {
        display: none !important;
    }

    /* Recommended Equipment Section */
    #recommended-equipment .content-block > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Additional Info & Use Cases Sections */
    #calculation-breakdown .content-block > div[style*="display: grid"],
    #engineering-assumptions .content-block > div[style*="display: grid"],
    #use-cases .content-block > div[style*="display: grid"],
    #calculation-breakdown details > div > div[style*="display: grid"] {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    /* Flex box components (Info boxes, notice boxes) */
    div[style*="display: flex; gap: 1.5rem"], 
    div[style*="display: flex; gap: 1rem"],
    #calculation-breakdown details > div {
        flex-direction: column !important;
        padding: 1.25rem !important;
        gap: 1rem !important;
    }

    /* Text sizing for small headers */
    h2[style*="font-size: 2.25rem"],
    h2[style*="font-size: 1.75rem"] {
        font-size: 1.5rem !important;
    }
}
