/* ABOUTME: Styles for calculator pages - inputs, results, and calculator-specific layout. */
/* ABOUTME: Supplements existing Tailwind/Zentra design system classes. */

/* Calculator input fields */
.calc-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    font-size: 1rem;
    color: #101828;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.calc-input:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.calc-input::placeholder {
    color: #98a2b3;
}

.calc-input.calc-input-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Calculator select fields */
.calc-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    font-size: 1rem;
    color: #101828;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='%23667085' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.calc-select:focus {
    outline: none;
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

/* Form field groups */
.calc-field {
    margin-bottom: 1.25rem;
}

.calc-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #344054;
    margin-bottom: 0.375rem;
}

.calc-hint {
    font-size: 0.75rem;
    color: #667085;
    margin-top: 0.25rem;
}

/* Input with currency prefix */
.calc-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.calc-input-prefix {
    position: absolute;
    left: 1rem;
    color: #667085;
    font-size: 1rem;
    pointer-events: none;
    z-index: 1;
}

.calc-input-group .calc-input {
    padding-left: 1.75rem;
}

.calc-input-suffix {
    position: absolute;
    right: 1rem;
    color: #667085;
    font-size: 0.875rem;
    pointer-events: none;
}

.calc-input-group .calc-input.has-suffix {
    padding-right: 2.5rem;
}

/* Primary action button */
.calc-btn-primary {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: linear-gradient(to right, #f97316, #ea580c);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
}

.calc-btn-primary:hover {
    background: linear-gradient(to right, #ea580c, #c2410c);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.calc-btn-primary:active {
    transform: scale(0.98);
}

#calculator .calc-btn-primary,
#calcForm .calc-btn-primary {
    width: 100%;
    padding: 1rem 2rem;
}

/* Secondary/outline button */
.calc-btn-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #fff;
    color: #344054;
    font-weight: 500;
    font-size: 0.875rem;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-family: inherit;
}

.calc-btn-secondary:hover {
    background: #fafafa;
    border-color: #d0d5dd;
}

/* Results section */
.calc-results {
    display: none;
    margin-top: 2rem;
}

.calc-results.visible {
    display: block;
    animation: calcFadeIn 0.3s ease;
}

@keyframes calcFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-result-primary {
    font-size: 2.25rem;
    font-weight: 700;
    color: #101828;
    line-height: 1.2;
}

.calc-result-label {
    font-size: 0.875rem;
    color: #667085;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.calc-result-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #101828;
}

.calc-result-card {
    background: #f6f9fc;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    transition: box-shadow 0.15s;
}

.calc-result-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Warning and error messages */
.calc-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: #92400e;
    font-size: 0.875rem;
    margin-top: 0.75rem;
    display: none;
}

.calc-warning.visible {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.calc-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: #991b1b;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: none;
}

.calc-error.visible {
    display: block;
}

/* Breadcrumbs */
.calc-breadcrumbs {
    font-size: 0.875rem;
    color: #667085;
    margin-bottom: 1.5rem;
    background-color: transparent;
}

.calc-breadcrumbs a {
    color: #667085;
    text-decoration: none;
}

.calc-breadcrumbs a:hover {
    color: #f97316;
}

.calc-breadcrumbs span {
    margin: 0 0.5rem;
}

/* Calculator form grid */
.calc-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.calc-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

/* Toggle switch for unit systems */
.calc-toggle {
    display: inline-flex;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 0.25rem;
    gap: 0.125rem;
}

.calc-toggle-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #667085;
    transition: all 0.15s;
    font-family: inherit;
}

.calc-toggle-btn.active {
    background: #fff;
    color: #101828;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Section separators */
.calc-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #101828;
    margin-bottom: 1.25rem;
    margin-top: 2rem;
    border-left: 3px solid #f97316;
    padding-left: 12px;
}

/* Updated timestamp */
.calc-updated {
    font-size: 0.75rem;
    color: #98a2b3;
    margin-top: 1rem;
}

/* Checkbox-style add-back items (SDE calculator) */
.calc-addback-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: background 0.15s;
}

.calc-addback-item:hover {
    background: #f8fafc;
}

.calc-addback-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #D0D5DD;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.calc-addback-item input[type="checkbox"]:checked {
    background: #f97316;
    border-color: #f97316;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.calc-addback-item input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.calc-addback-item label {
    cursor: pointer;
    font-size: 0.875rem;
    color: #344054;
    flex: 1;
}

/* Results table (for price sensitivity grid) */
.calc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.calc-table th {
    text-align: left;
    padding: 0.75rem;
    background: #f6f9fc;
    color: #344054;
    font-weight: 600;
    border-bottom: 2px solid #e6e6e6;
}

.calc-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    color: #344054;
}

.calc-table tr.highlight {
    background: #fff7ed;
}

.calc-table tr.highlight td {
    font-weight: 600;
    color: #c2410c;
}

/* Email capture card animation */
.calc-email-capture {
    animation: calcFadeIn 0.5s ease;
}

/* Hero section for calculator pages */
.calc-hero {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 40%, #fed7aa 80%, #fdba74 100%);
    padding: 48px 24px 40px 24px;
    text-align: center;
}

.calc-hero-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    border-radius: 9999px;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #C2410C;
    margin-bottom: 1rem;
}

.calc-hero-title {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 30%, #1e293b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calc-hero-subtitle {
    font-size: 1.125rem;
    color: #475467;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Breadcrumbs in hero */
.calc-breadcrumbs-hero a {
    color: rgba(120, 80, 50, 0.7);
}

.calc-breadcrumbs-hero a:hover {
    color: #c2410c;
}

.calc-breadcrumbs-hero {
    color: rgba(120, 80, 50, 0.5);
}

/* Calculator form card accent bar */
.calc-card-accent {
    position: relative;
    overflow: hidden;
}

.calc-card-accent::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #f97316, #ea580c);
    border-radius: 16px 16px 0 0;
}

/* Primary result card */
.calc-result-primary-card {
    background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
    border: 1px solid rgba(249, 115, 22, 0.15);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(249, 115, 22, 0.08);
    text-align: center;
    margin-bottom: 1.5rem;
}

.calc-result-primary-card .calc-result-label {
    color: #92400e;
}

.calc-result-primary-card .calc-result-primary {
    color: #EA580C;
    font-size: 2.5rem;
}

/* Formula box */
.calc-formula-box {
    background: #FFFBF5;
    border-left: 3px solid #FDBA74;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.calc-formula-box p {
    font-family: monospace;
    font-size: 0.875rem;
    color: #101828;
    line-height: 1.8;
    margin: 0;
}

.calc-formula-box p + p {
    margin-top: 0.25rem;
}

/* Content card */
.calc-content-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(230, 230, 230, 0.5);
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

/* CTA warm treatment */
.calc-cta-warm {
    background: linear-gradient(135deg, #FFF7ED, #FFFFFF);
    border: 1px solid rgba(230, 230, 230, 0.5);
    border-radius: 24px;
    padding: 48px 32px;
    text-align: center;
}

.calc-cta-warm .calc-btn-primary {
    padding: 16px 40px;
    font-size: 1.125rem;
    border-radius: 16px;
}

.calc-cta-warm .calc-btn-primary:hover {
    transform: scale(1.05);
}

/* Page enter animation */
.calc-page-enter {
    animation: calcPageEnter 0.3s ease;
}

@keyframes calcPageEnter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Staggered result card animation */
.calc-results.visible .calc-result-card,
.calc-results.visible .calc-result-primary-card {
    animation: calcFadeIn 0.3s ease both;
}

.calc-results.visible .calc-result-primary-card { animation-delay: 0ms; }
.calc-results.visible .calc-result-card:nth-child(1) { animation-delay: 0ms; }
.calc-results.visible .calc-result-card:nth-child(2) { animation-delay: 80ms; }
.calc-results.visible .calc-result-card:nth-child(3) { animation-delay: 160ms; }
.calc-results.visible .calc-result-card:nth-child(4) { animation-delay: 240ms; }

/* Related tools section */
.calc-related-section {
    background: #fff;
    border-radius: 24px;
    padding: 2.5rem 2rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .calc-grid-2,
    .calc-grid-3 {
        grid-template-columns: 1fr;
    }

    .calc-result-primary {
        font-size: 1.75rem;
    }

    .calc-btn-primary {
        width: 100%;
    }

    .calc-hero-title {
        font-size: 1.75rem;
    }

    .calc-result-primary-card .calc-result-primary {
        font-size: 2rem;
    }

    .calc-grid-3 {
        grid-template-columns: 1fr 1fr;
    }

    .calc-grid-3 > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .calc-addback-item {
        flex-wrap: wrap;
    }

    .calc-addback-item .calc-input-group {
        width: 100% !important;
        margin-top: 0.5rem;
        margin-left: 2rem;
    }

    .calc-formula-box p {
        font-size: 0.75rem;
        word-break: break-word;
    }
}
