/* ============================================
   FITPLEX FREE TOOLS — Shared App Styles
   Reuses CSS variables from /css/style.css
   ============================================ */

/* ----- Apps Directory (Landing) ----- */
.apps-hero {
    padding: 9rem 0 4rem;
    background: var(--gradient-hero);
    position: relative;
    overflow: hidden;
}

.apps-hero::before {
    content: '';
    position: absolute;
    top: -100px; right: -100px;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(234, 88, 12, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.apps-hero::after {
    content: '';
    position: absolute;
    bottom: -100px; left: -100px;
    width: 350px; height: 350px;
    background: radial-gradient(circle, rgba(251, 146, 60, 0.18) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.apps-hero .container {
    position: relative;
    z-index: 1;
    text-align: center;
}

.apps-hero h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    margin-bottom: 1rem;
}

.apps-hero p.lead {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 720px;
    margin: 0 auto 2rem;
}

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

.app-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition);
}

.app-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.app-card:hover::before { opacity: 1; }

.app-card .app-icon {
    width: 64px; height: 64px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-primary);
}

.app-card h3 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.app-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex-grow: 1;
    margin-bottom: 1.25rem;
}

.app-card .app-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-light);
    color: var(--primary-dark);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
    margin-bottom: 1rem;
}

.app-card .app-cta {
    color: var(--primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap var(--transition);
}

.app-card:hover .app-cta { gap: 0.8rem; }

.app-card.coming-soon {
    opacity: 0.65;
    pointer-events: none;
}

.app-card.coming-soon .app-tag {
    background: #f1f5f9;
    color: #64748b;
}

/* ----- Calculator App ----- */
.calc-shell {
    padding: 7rem 0 5rem;
    background: linear-gradient(180deg, #FFF7ED 0%, #ffffff 280px);
    min-height: 100vh;
}

.calc-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 2.5rem;
}

.calc-header .badge {
    margin-bottom: 1rem;
}

.calc-header h1 {
    font-size: clamp(1.85rem, 4.5vw, 2.75rem);
    margin-bottom: 0.75rem;
}

.calc-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.calc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    gap: 2rem;
    align-items: start;
}

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

/* Input Panel */
.calc-inputs {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

@media (max-width: 1024px) {
    .calc-inputs { position: static; max-height: none; }
}

.calc-inputs::-webkit-scrollbar { width: 8px; }
.calc-inputs::-webkit-scrollbar-track { background: var(--bg-light); border-radius: 4px; }
.calc-inputs::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 4px; }

.input-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--border-light);
}

.input-group:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

.input-group h3 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 700;
}

.input-group h3 i {
    color: var(--primary);
    width: 28px; height: 28px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

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

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

.input-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.input-field label .help {
    color: var(--text-light);
    font-size: 0.7rem;
    cursor: help;
}

.input-field .input-wrap {
    position: relative;
}

.input-field .input-prefix,
.input-field .input-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    pointer-events: none;
}

.input-field .input-prefix { left: 0.7rem; }
.input-field .input-suffix { right: 0.7rem; }

.input-field input,
.input-field select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-family: var(--font-sans);
    color: var(--text-dark);
    background: #fff;
    transition: all var(--transition-fast);
    -moz-appearance: textfield;
}

.input-field input.has-prefix { padding-left: 1.7rem; }
.input-field input.has-suffix { padding-right: 1.9rem; }

.input-field input:focus,
.input-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

.input-field input::-webkit-outer-spin-button,
.input-field input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}

.fee-distribution {
    background: var(--bg-light);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}

.fee-distribution-label {
    font-size: 0.78rem;
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.fee-distribution-label .fee-total {
    font-weight: 700;
}
.fee-distribution-label .fee-total.warn { color: var(--accent-red); }
.fee-distribution-label .fee-total.ok { color: var(--accent-green); }

.calc-reset {
    width: 100%;
    margin-top: 1rem;
    padding: 0.6rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
}

.calc-reset:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
    border-style: solid;
}

/* Results Panel */
.calc-results {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Hero Result Card */
.result-hero {
    background: linear-gradient(135deg, #0F172A 0%, #1e293b 50%, #422006 100%);
    border-radius: var(--radius-lg);
    padding: 2rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.result-hero::before {
    content: '';
    position: absolute;
    top: -80px; right: -80px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(251, 146, 60, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(40px);
}

.result-hero .hero-row {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.result-hero .hero-label {
    font-size: 0.85rem;
    color: #fdba74;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-hero .hero-value {
    font-size: clamp(2rem, 5vw, 2.85rem);
    font-weight: 800;
    line-height: 1;
    color: #fff;
    margin-bottom: 0.4rem;
    font-variant-numeric: tabular-nums;
}

.result-hero .hero-value.loss { color: #fca5a5; }

.result-hero .hero-sub {
    color: rgba(255,255,255,0.75);
    font-size: 0.95rem;
}

.health-badge {
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.health-badge.excellent { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.health-badge.good { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.health-badge.average { background: rgba(251, 146, 60, 0.2); color: #fdba74; }
.health-badge.poor { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.result-hero .quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.12);
    position: relative;
    z-index: 1;
}

.result-hero .quick-stat .label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.result-hero .quick-stat .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 540px) {
    .result-hero .quick-stats { grid-template-columns: 1fr 1fr; }
}

/* Generic result card */
.result-card {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.result-card .card-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 700;
    margin-bottom: 1rem;
}

.result-card .card-title i {
    color: var(--primary);
    width: 30px; height: 30px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

/* Two-column row of cards */
.result-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 720px) {
    .result-row { grid-template-columns: 1fr; }
}

/* Pie chart */
.pie-chart {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.pie-svg {
    width: 140px; height: 140px;
    flex-shrink: 0;
}

.pie-legend {
    flex: 1;
    min-width: 150px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.85rem;
}

.pie-legend .legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pie-legend .legend-item .lbl {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.pie-legend .legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pie-legend .val {
    color: var(--text-dark);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}

/* Stat lines */
.stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.55rem 0;
    border-bottom: 1px dashed #f1f5f9;
}

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

.stat-item .stat-label {
    color: var(--text-secondary);
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-item .stat-label i {
    color: var(--text-light);
    font-size: 0.7rem;
}

.stat-item .stat-value {
    color: var(--text-dark);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
}

.stat-item .stat-value.positive { color: var(--accent-green-dark); }
.stat-item .stat-value.negative { color: var(--accent-red); }
.stat-item .stat-value.neutral { color: var(--primary-dark); }

/* Bar visualization */
.bar-vis {
    margin-top: 0.5rem;
}

.bar-row {
    margin-bottom: 0.85rem;
}

.bar-row:last-child { margin-bottom: 0; }

.bar-row .bar-head {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 0.3rem;
}

.bar-row .bar-head .lbl { color: var(--text-secondary); }
.bar-row .bar-head .val { color: var(--text-dark); font-weight: 600; font-variant-numeric: tabular-nums; }

.bar-row .bar-track {
    background: #f1f5f9;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.bar-row .bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Insights */
.insight-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.insight {
    display: flex;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    border-left: 3px solid var(--primary);
    align-items: flex-start;
}

.insight.success { background: #ecfdf5; border-left-color: var(--accent-green); }
.insight.warning { background: #fffbeb; border-left-color: var(--accent-amber); }
.insight.danger  { background: #fef2f2; border-left-color: var(--accent-red); }
.insight.info    { background: #eff6ff; border-left-color: #3b82f6; }

.insight .ic {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
    font-size: 0.85rem;
    box-shadow: var(--shadow-sm);
}

.insight.success .ic { color: var(--accent-green-dark); }
.insight.warning .ic { color: #b45309; }
.insight.danger .ic { color: var(--accent-red); }
.insight.info .ic { color: #1d4ed8; }

.insight .body { flex: 1; }
.insight h5 { font-size: 0.9rem; color: var(--text-dark); margin-bottom: 0.2rem; font-weight: 700; }
.insight p { font-size: 0.85rem; color: var(--text-secondary); margin: 0; line-height: 1.55; }

/* Projection Table */
.proj-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.proj-table th,
.proj-table td {
    padding: 0.6rem 0.75rem;
    text-align: right;
    border-bottom: 1px dashed #f1f5f9;
    font-variant-numeric: tabular-nums;
}

.proj-table th:first-child,
.proj-table td:first-child {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
}

.proj-table th {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-light);
}

.proj-table tr:last-child td { border-bottom: none; font-weight: 700; color: var(--text-dark); }

/* CTA */
.calc-cta {
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow-primary);
}

.calc-cta h3 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.calc-cta p {
    color: rgba(255,255,255,0.9);
    margin-bottom: 1.25rem;
}

.calc-cta .cta-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.calc-cta .btn-white {
    background: #fff;
    color: var(--primary-dark);
}
.calc-cta .btn-white:hover {
    background: #fff;
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.calc-cta .btn-ghost {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.4);
}
.calc-cta .btn-ghost:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* Skeleton when no input */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-bottom: 0.75rem;
    opacity: 0.6;
}

.empty-state h4 { color: var(--text-dark); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.9rem; }

/* Print */
@media print {
    .navbar, .footer, .footer-bottom-bar, .whatsapp-float,
    .calc-inputs, .calc-cta, .calc-header .badge,
    .breadcrumb { display: none !important; }
    .calc-shell { padding: 1rem 0; background: #fff; }
    .calc-layout { grid-template-columns: 1fr; }
    .result-hero { background: #1e293b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body { background: #fff; }
}
