/* ───────────────────────────────────────────────
   HVAC Duct Calculator Pro – Scoped Styles
   Prefix: hdc-
   Wrapper: .hdc-tool
   ─────────────────────────────────────────────── */

/* Base Reset inside tool */
.hdc-tool,
.hdc-tool *,
.hdc-tool *::before,
.hdc-tool *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hdc-tool {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #1a1d23;
    color: #e2e8f0;
    line-height: 1.6;
    padding: 2rem 1rem;
}

.hdc-container {
    max-width: 960px;
    margin: 0 auto;
}

/* Typography */
.hdc-tool h1, .hdc-tool h2, .hdc-tool h3 {
    color: #f1f3f9;
    margin-bottom: 1rem;
}

.hdc-title {
    font-size: 2rem;
    font-weight: 700;
}

.hdc-description {
    font-size: 1.1rem;
    color: #a0aec0;
    margin-bottom: 0.5rem;
}

.hdc-estimate-note {
    font-size: 0.9rem;
    color: #718096;
    border-left: 3px solid #3b82f6;
    padding-left: 1rem;
    margin-bottom: 2rem;
}

/* Section titles */
.hdc-section-title {
    font-size: 1.5rem;
    border-bottom: 1px solid #2c2f38;
    padding-bottom: 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

/* Mode & Shape Selectors */
.hdc-mode-selector,
.hdc-shape-selector {
    border: 1px solid #2c2f38;
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    background: #21242b;
}

.hdc-legend {
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: #cbd5e0;
    font-size: 0.95rem;
}

.hdc-mode-options,
.hdc-shape-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hdc-mode-option,
.hdc-shape-option {
    display: flex;
    align-items: center;
}

.hdc-mode-option input,
.hdc-shape-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.hdc-mode-label,
.hdc-shape-label {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid #2c2f38;
    border-radius: 8px;
    cursor: pointer;
    background: #1a1d23;
    transition: all 0.2s ease;
    user-select: none;
    font-size: 0.9rem;
}

.hdc-mode-option input:checked + .hdc-mode-label,
.hdc-shape-option input:checked + .hdc-shape-label {
    background: rgba(59, 130, 246, 0.18);
    border-color: #3b82f6;
    color: #fff;
}

.hdc-mode-label:hover,
.hdc-shape-label:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

/* Input Fields */
.hdc-input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.hdc-field {
    display: flex;
    flex-direction: column;
}

.hdc-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: #a0aec0;
}

.hdc-input,
.hdc-select {
    background: #21242b;
    border: 1px solid #2c2f38;
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    color: #f1f3f9;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.hdc-input:focus,
.hdc-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.hdc-input-invalid {
    border-color: #f87171;
}

.hdc-error {
    font-size: 0.8rem;
    color: #f87171;
    margin-top: 0.25rem;
    min-height: 1.2em;
}

/* Buttons */
.hdc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.hdc-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    user-select: none;
}

.hdc-button-primary {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.hdc-button-primary:hover {
    background: #5a9cff;
    border-color: #5a9cff;
}

.hdc-button-primary:active {
    transform: scale(0.98);
}

.hdc-button-secondary {
    background: rgba(59, 130, 246, 0.12);
    color: #f1f3f9;
    border-color: #2c2f38;
}

.hdc-button-secondary:hover {
    background: rgba(59, 130, 246, 0.22);
    border-color: #3b82f6;
}

.hdc-button:disabled {
    opacity: 0.55;
    pointer-events: none;
}

.hdc-button:focus-visible {
    outline: 2px solid #5a9cff;
    outline-offset: 2px;
}

/* Results Dashboard */
.hdc-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hdc-card {
    background: #21242b;
    border: 1px solid #2c2f38;
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    transition: border-color 0.2s;
}

.hdc-card-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a0aec0;
    margin-bottom: 0.5rem;
}

.hdc-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
}

/* Velocity status colors */
.hdc-card.velocity-low .hdc-card-value { color: #facc15; }
.hdc-card.velocity-typical .hdc-card-value { color: #4ade80; }
.hdc-card.velocity-high .hdc-card-value { color: #fb923c; }
.hdc-card.velocity-very-high .hdc-card-value { color: #f87171; }

/* Aspect ratio status */
.hdc-card.good .hdc-card-value { color: #4ade80; }
.hdc-card.acceptable .hdc-card-value { color: #fbbf24; }
.hdc-card.high .hdc-card-value { color: #f87171; }

/* Result action buttons */
.hdc-result-actions {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

/* Warnings */
.hdc-warning-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.hdc-warning-item {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    background: rgba(248, 113, 113, 0.1);
    border-left: 3px solid #f87171;
    color: #fca5a5;
}

.hdc-warning-disclaimer {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #93c5fd;
}

/* Formula section */
.hdc-formula-list {
    display: grid;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.hdc-formula-item {
    background: #21242b;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #2c2f38;
}

.hdc-worked-example {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    background: #1e2127;
    border-radius: 8px;
    font-style: italic;
}

/* Education & FAQ */
.hdc-article {
    margin-bottom: 1.5rem;
}

.hdc-article h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.hdc-faq-list {
    margin-top: 1rem;
}

.hdc-faq-question {
    font-weight: 600;
    margin-top: 1.2rem;
    color: #f1f3f9;
}

.hdc-faq-answer {
    margin: 0.3rem 0 1rem 1rem;
    color: #a0aec0;
}

/* Disclaimer */
.hdc-disclaimer {
    margin-top: 2rem;
    padding: 1rem;
    background: #1e2026;
    border: 1px solid #2c2f38;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #718096;
}

/* Responsive */
@media (max-width: 640px) {
    .hdc-tool {
        padding: 1.5rem 0.5rem;
    }
    .hdc-input-grid {
        grid-template-columns: 1fr;
    }
    .hdc-results-grid {
        grid-template-columns: 1fr 1fr;
    }
    .hdc-mode-options,
    .hdc-shape-options {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .hdc-results-grid {
        grid-template-columns: 1fr;
    }
}