/* ============================================
   TRANE TD1 DUCTULATOR CALCULATOR STYLES
   ============================================ */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Trane-inspired colors */
    --trane-blue: #003DA5;
    --trane-light-blue: #60a5fa;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    /* UI Colors */
    --background: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */

header {
    background: linear-gradient(135deg, var(--trane-blue) 0%, #1d4ed8 100%);
    color: white;
    padding: 2.5rem 1rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.branding h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
}

/* Unit Toggle */
.unit-toggle {
    display: inline-block;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    padding: 0.25rem;
    display: inline-flex;
    gap: 0.25rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.toggle-option {
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    color: white;
    white-space: nowrap;
}

.toggle-option.active {
    background: white;
    color: var(--trane-blue);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Breadcrumb */
.breadcrumb {
    background: white;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ============================================
   CONTAINER
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    flex: 1;
    padding: 3rem 1rem;
}

/* ============================================
   SECTIONS
   ============================================ */

section {
    margin-bottom: 4rem;
}

section h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--primary-color);
    display: inline-block;
}

.section-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

/* Intro Section */
.intro-section {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    border-left: 5px solid var(--trane-blue);
}

.intro-section h2 {
    color: var(--trane-blue);
    border-bottom-color: var(--trane-blue);
}

.intro-section p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
}

.feature-list {
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
}

.feature-list li {
    padding: 0.75rem 0 0.75rem 2rem;
    position: relative;
    font-size: 1.05rem;
    line-height: 1.6;
}

.feature-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.3rem;
}

.highlight-box {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    border-left: 4px solid var(--trane-blue);
    padding: 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    margin-top: 2rem;
}

/* ============================================
   DUCTULATOR MAIN INTERFACE
   ============================================ */

.ductulator-main {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.ductulator-container {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 3rem;
    margin-top: 2rem;
}

/* Visual Ductulator */
.visual-ductulator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ductulator-wheel {
    max-width: 400px;
    width: 100%;
    padding: 1rem;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-xl);
    border: 5px solid #e2e8f0;
}

.ductulator-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.visual-note {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
}

/* Calculator Inputs */
.calculator-inputs {
    display: flex;
    flex-direction: column;
}

.calculator-inputs h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.calc-description {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Input Grid */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.label-icon {
    font-size: 1.2rem;
}

.unit-label {
    color: var(--text-secondary);
    font-weight: 400;
}

input[type="number"],
select {
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--card-background);
    color: var(--text-primary);
    font-family: inherit;
}

input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

input[type="number"]:hover,
select:hover {
    border-color: var(--primary-hover);
}

.input-helper {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
    font-style: italic;
}

/* Buttons */
.btn-calculate {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 1.1rem 2.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
    max-width: 100%;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.3rem;
}

/* Conversion Toggle */
.conversion-toggle {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.conversion-btn {
    flex: 1;
    padding: 1rem;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.conversion-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.conversion-btn:hover:not(.active) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

/* Result Box */
.result-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-box h3 {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
    opacity: 0.95;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 0.75rem;
}

.result-box p {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.result-box strong {
    font-weight: 700;
    opacity: 0.9;
}

.result-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 1rem 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ============================================
   TABS
   ============================================ */

.calculator-tabs {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 1rem 2rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.tab-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tab-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* ============================================
   REFERENCE SECTION
   ============================================ */

.reference-section {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.reference-card {
    background: var(--background);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.reference-card h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--trane-blue);
}

.reference-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.reference-table thead {
    background: var(--trane-blue);
    color: white;
}

.reference-table th,
.reference-table td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid var(--border-color);
}

.reference-table tbody tr:nth-child(even) {
    background: rgba(0, 61, 165, 0.05);
}

.reference-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.1);
}

/* ============================================
   FAQ SECTION
   ============================================ */

.faq-section {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

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

.faq-item h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.faq-item h3:before {
    content: "Q:";
    color: var(--trane-blue);
    font-weight: 700;
    flex-shrink: 0;
}

.faq-item p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
    padding-left: 2.5rem;
}

/* ============================================
   FOOTER
   ============================================ */

footer {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #cbd5e1;
    padding: 3rem 1rem 2rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.footer-section p {
    line-height: 1.8;
    font-size: 0.95rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: var(--trane-light-blue);
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 2rem;
    text-align: center;
}

.footer-bottom p {
    margin: 0.5rem 0;
}

.disclaimer {
    font-size: 0.85rem;
    color: #64748b;
    font-style: italic;
    max-width: 900px;
    margin: 1rem auto 0;
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

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

    .visual-ductulator {
        order: -1;
    }
}

@media (max-width: 768px) {
    .branding h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .input-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
        bottom: 0;
    }

    .tab-btn.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
        background: rgba(37, 99, 235, 0.05);
    }

    .conversion-toggle {
        flex-direction: column;
    }

    .reference-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .branding h1 {
        font-size: 1.75rem;
    }

    section h2 {
        font-size: 1.5rem;
    }

    .intro-section,
    .ductulator-main,
    .calculator-tabs,
    .reference-section,
    .faq-section {
        padding: 1.5rem;
    }

    .result-value {
        font-size: 1.5rem;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --card-background: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --border-color: #334155;
    }

    .ductulator-wheel {
        background: #1e293b;
        border-color: #334155;
    }

    .reference-card {
        background: #0f172a;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.error-message {
    background: #fef2f2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #fecaca;
    margin-top: 1rem;
}

/* Print Styles */
@media print {
    header,
    footer,
    .unit-toggle,
    .breadcrumb {
        display: none;
    }

    .calculator-card,
    .reference-card {
        break-inside: avoid;
    }
}
