/* ===== BASE ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    position: relative;
    min-height: 100%;
    scroll-behavior: smooth;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ===== HERO HEADER ===== */
.calc-hero {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 40%, #0369a1 100%);
    padding: 3rem 1rem 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.calc-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.hero-logo {
    height: 60px;
    width: auto;
    margin-bottom: 1.25rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4)) drop-shadow(0 0 20px rgba(255, 255, 255, 0.15));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.hero-logo:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 30px rgba(255, 255, 255, 0.2));
}

.calc-hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.calc-hero .subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    max-width: 700px;
    margin: 0 auto 1rem;
    line-height: 1.6;
    font-weight: 400;
}

.calc-hero .cta-hint {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    animation: ctaPulse 2s ease-in-out 1s 3;
}

@keyframes ctaPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
    50% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.15); }
}

/* ===== CALCULATOR BODY ===== */
.calc-body {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

/* ===== SECTION CARDS ===== */
.calc-section {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    margin-bottom: 1.75rem;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.3s ease;
}

.calc-section:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.section-header {
    padding: 1.25rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-header .section-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-header .section-icon .marque {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
    color: #f1f5f9;
}

.section-desc {
    padding: 1rem 1.75rem 0;
    font-size: 0.875rem;
    color: #94a3b8;
    line-height: 1.6;
}

.section-body {
    padding: 1.25rem 1.75rem 1.5rem;
}

/* Section color accents */
.section-opportunity { border-left: 3px solid #10b981; }
.section-opportunity .section-header { background: linear-gradient(90deg, rgba(16, 185, 129, 0.1) 0%, transparent 100%); }
.section-cross { border-left: 3px solid #8b5cf6; }
.section-cross .section-header { background: linear-gradient(90deg, rgba(139, 92, 246, 0.1) 0%, transparent 100%); }
.section-automation { border-left: 3px solid #f59e0b; }
.section-automation .section-header { background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, transparent 100%); }
.section-referrals { border-left: 3px solid #ec4899; }
.section-referrals .section-header { background: linear-gradient(90deg, rgba(236, 72, 153, 0.1) 0%, transparent 100%); }

/* ===== FORM CONTROLS ===== */
.field-group {
    margin-bottom: 1rem;
}

.field-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.field-group label .info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
    font-size: 0.65rem;
    font-weight: 700;
    margin-left: 0.35rem;
    cursor: help;
    vertical-align: middle;
    position: relative;
    transition: background 0.2s ease, color 0.2s ease;
}

.field-group label .info-tip:hover {
    background: rgba(14, 165, 233, 0.3);
    color: #38bdf8;
}

.field-group label .info-tip::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.field-group label .info-tip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .currency-prefix {
    position: absolute;
    left: 0.875rem;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.input-wrapper .percent-suffix {
    position: absolute;
    right: 0.875rem;
    color: #64748b;
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.calc-input {
    width: 100%;
    background: #0f172a;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.7rem 0.875rem;
    color: #f1f5f9;
    font-size: 1rem;
    font-weight: 500;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
}

.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calc-input:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.calc-input.has-prefix {
    padding-left: 2rem;
}

.calc-input.has-suffix {
    padding-right: 2.5rem;
}

.calc-input.input-highlight {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.05);
}

.calc-input.input-highlight:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ===== RESULT DISPLAYS ===== */
.result-card {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(14, 165, 233, 0.05) 100%);
    border: 1px solid rgba(14, 165, 233, 0.2);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    text-align: center;
    transition: all 0.3s ease;
}

.result-card .result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.result-card .result-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #38bdf8;
    letter-spacing: -0.02em;
}

.result-card.has-value {
    transform: scale(1.02);
}

.result-card.result-green.has-value {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.15);
}

.result-card.result-purple.has-value {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15);
}

.result-card.result-amber.has-value {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
}

.result-card.result-pink.has-value {
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.15);
}

.result-value.pop {
    animation: resultPop 0.3s ease;
}

@keyframes resultPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.result-card.result-green {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-color: rgba(16, 185, 129, 0.2);
}

.result-card.result-green .result-value {
    color: #34d399;
}

.result-card.result-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    border-color: rgba(139, 92, 246, 0.2);
}

.result-card.result-purple .result-value {
    color: #a78bfa;
}

.result-card.result-amber {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-color: rgba(245, 158, 11, 0.2);
}

.result-card.result-amber .result-value {
    color: #fbbf24;
}

.result-card.result-pink {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1) 0%, rgba(236, 72, 153, 0.05) 100%);
    border-color: rgba(236, 72, 153, 0.2);
}

.result-card.result-pink .result-value {
    color: #f472b6;
}

/* ===== AUTOMATION DEPARTMENT ROWS ===== */
.dept-row {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-left: 3px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition: background 0.2s ease, border-left-color 0.2s ease;
}

.dept-row:hover {
    background: rgba(15, 23, 42, 0.7);
    border-left-color: #f59e0b;
}

.dept-row .dept-name {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    min-height: 100%;
}

.dept-row .dept-saving {
    text-align: right;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

.dept-row .dept-saving .saving-label {
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.dept-row .dept-saving .saving-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fbbf24;
    white-space: nowrap;
}

.dept-row .dept-saving .saving-value.has-value {
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

/* ===== TOTAL PROFIT SECTION ===== */
.total-section {
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #7c3aed 100%);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(14, 165, 233, 0.3);
}

.total-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 70% 30%, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.total-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

.total-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}

.total-item .total-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.total-item .total-value {
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.total-item .total-value.pop {
    animation: resultPop 0.3s ease;
}

.disclaimer {
    text-align: center;
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 1.5rem;
    padding: 0 1rem;
    line-height: 1.5;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767px) {
    .calc-hero h1 {
        font-size: 1.75rem;
    }

    .section-body .row > [class*="col-"] {
        margin-bottom: 0.5rem;
    }

    .total-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .total-item .total-value {
        font-size: 2rem;
    }

    .dept-row .row {
        gap: 0.5rem;
    }

    .dept-row .dept-saving {
        text-align: center;
        align-items: center;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .dept-row .dept-name {
        font-size: 0.9rem;
    }
}

/* ===== ANIMATIONS ===== */
.calc-section {
    animation: fadeInUp 0.5s ease-out both;
}

.calc-section:nth-child(1) { animation-delay: 0.1s; }
.calc-section:nth-child(2) { animation-delay: 0.2s; }
.calc-section:nth-child(3) { animation-delay: 0.3s; }
.calc-section:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-value {
    transition: all 0.3s ease;
}

/* Footer */
.calc-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: #475569;
    font-size: 0.85rem;
}

.footer-logo {
    height: 36px;
    width: auto;
    opacity: 0.65;
    margin-bottom: 0.75rem;
    transition: opacity 0.3s ease;
}

.footer-logo:hover {
    opacity: 0.9;
}

.calc-footer p {
    margin: 0;
}

.calc-footer a {
    color: #0ea5e9;
    text-decoration: none;
}

.calc-footer a:hover {
    text-decoration: underline;
}

/* ===== SHARE BAR ===== */
.share-bar {
    text-align: center;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.share-bar-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-btn,
.reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.share-btn {
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #38bdf8;
}

.reset-btn {
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.reset-btn:hover {
    background: rgba(148, 163, 184, 0.15);
    border-color: rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
    transform: translateY(-1px);
}

.reset-btn:active {
    transform: translateY(0);
}

.share-btn:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.5);
    transform: translateY(-1px);
}

.share-btn:active {
    transform: translateY(0);
}

.share-btn svg {
    flex-shrink: 0;
}

.share-feedback {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #34d399;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.share-feedback.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background: #ffffff;
        color: #1e293b;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .calc-hero {
        background: #0284c7 !important;
        padding: 1.5rem 1rem;
    }

    .calc-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #cbd5e1;
        animation: none;
    }

    .calc-section:hover {
        box-shadow: none;
    }

    .calc-input {
        background: #ffffff;
        border: 1px solid #94a3b8;
        color: #1e293b;
    }

    .calc-input.input-highlight {
        background: #f0fdf4;
        border-color: #86efac;
    }

    .dept-row {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
    }

    .total-section {
        background: #0284c7 !important;
        box-shadow: none;
    }

    .share-bar,
    .share-btn,
    .share-feedback {
        display: none !important;
    }

    .calc-body {
        padding: 1rem 0;
    }

    .calc-footer {
        padding: 1rem 0;
    }
}