/* =============================================
   COMPOUND INTEREST CALCULATOR
   Colors: Teal (#0D9488, #14B8A6) + Navy (#0F172A, #1E293B)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---------- RESET & ROOT ---------- */
:root {
    --teal:         #0D9488;
    --teal-mid:     #14B8A6;
    --teal-light:   #CCFBF1;
    --teal-glow:    rgba(13,148,136,0.18);
    --navy:         #0F172A;
    --navy-mid:     #1E293B;
    --navy-light:   #334155;
    --navy-muted:   #64748B;
    --white:        #FFFFFF;
    --bg:           #F8FAFC;
    --border:       #E2E8F0;
    --border-mid:   #CBD5E1;
    --text:         #0F172A;
    --text-muted:   #64748B;
    --radius-sm:    8px;
    --radius-md:    14px;
    --radius-lg:    20px;
    --shadow-sm:    0 1px 4px rgba(0,0,0,0.07);
    --shadow-md:    0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg:    0 8px 32px rgba(0,0,0,0.13);
    --transition:   all 0.22s ease;
}

.ci-wrap *,
.ci-wrap *::before,
.ci-wrap *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.ci-wrap {
    font-family: 'Inter', system-ui, sans-serif;
    max-width: 1160px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    color: var(--text);
    background: var(--bg);
}

/* ---------- HEADER ---------- */
.ci-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #164E63 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 52px 40px;
    text-align: center;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}

.ci-header::before,
.ci-header::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.ci-header::before {
    width: 260px; height: 260px;
    top: -80px; right: -60px;
    background: var(--teal);
    opacity: 0.07;
}

.ci-header::after {
    width: 180px; height: 180px;
    bottom: -60px; left: -40px;
    background: var(--teal-mid);
    opacity: 0.06;
}

.ci-header-icon {
    font-size: 56px;
    margin-bottom: 14px;
    display: block;
}

.ci-header-title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-bottom: 10px;
}

.ci-header-sub {
    font-size: 16px;
    opacity: 0.65;
    font-weight: 400;
}

/* ---------- CURRENCY BAR ---------- */
.ci-currency-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--navy);
    border-radius: var(--radius-md);
    padding: 14px 22px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ci-currency-label {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.ci-currency-select {
    background: var(--navy-mid);
    color: #fff;
    border: 1px solid var(--navy-light);
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    min-width: 240px;
}

.ci-currency-select:hover,
.ci-currency-select:focus {
    border-color: var(--teal);
}

/* ---------- LAYOUT ---------- */
.ci-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    align-items: start;
}

/* ---------- INPUTS PANEL ---------- */
.ci-inputs-panel {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 24px;
}

/* Type Toggle */
.ci-toggle-group {
    display: flex;
    background: #F1F5F9;
    border-radius: var(--radius-md);
    padding: 5px;
    gap: 5px;
}

.ci-toggle {
    flex: 1;
    padding: 11px 8px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: var(--transition);
    white-space: nowrap;
}

.ci-toggle.active {
    background: var(--teal);
    color: #fff;
    box-shadow: 0 3px 10px var(--teal-glow);
}

/* Fields */
.ci-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ci-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ci-optional {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

/* Input Box */
.ci-input-box {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
}

.ci-input-box:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
}

.ci-unit {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    background: #F1F5F9;
    font-size: 15px;
    font-weight: 700;
    color: var(--teal);
    padding: 0 12px;
    border-right: 1px solid var(--border);
    white-space: nowrap;
}

.ci-unit-right {
    border-right: none;
    border-left: 1px solid var(--border);
}

.ci-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
    background: #fff;
    width: 100%;
}

/* Slider */
.ci-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}

.ci-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--teal);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(13,148,136,0.45);
    cursor: pointer;
}

.ci-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--teal);
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(13,148,136,0.45);
    cursor: pointer;
}

.ci-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Select */
.ci-select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--navy);
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

.ci-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-glow);
}

/* Action Buttons */
.ci-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ci-btn-primary {
    background: var(--teal);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.ci-btn-primary:hover {
    background: var(--teal-mid);
    box-shadow: 0 4px 14px var(--teal-glow);
    transform: translateY(-1px);
}

.ci-btn-secondary {
    background: transparent;
    color: var(--navy);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.ci-btn-secondary:hover {
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
}

/* Compare Toggle */
.ci-compare-toggle {
    width: 100%;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.ci-compare-toggle:hover {
    background: var(--teal);
}

/* ---------- RESULTS PANEL ---------- */
.ci-results-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Hero */
.ci-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 38px 32px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ci-hero::before {
    content: '';
    position: absolute;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: var(--teal);
    opacity: 0.07;
    top: -60px; right: -40px;
    pointer-events: none;
}

.ci-hero-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.6;
    margin-bottom: 10px;
}

.ci-hero-amount {
    font-size: clamp(36px, 5.5vw, 58px);
    font-weight: 900;
    color: var(--teal-mid);
    letter-spacing: -1px;
    margin-bottom: 20px;
    word-break: break-word;
}

.ci-hero-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
    padding: 16px;
}

.ci-hero-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 100px;
    padding: 6px 12px;
}

.ci-hero-meta-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.15);
}

.ci-hero-meta-label {
    font-size: 11px;
    opacity: 0.55;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.ci-hero-meta-val {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
}

/* Stats Grid */
.ci-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.ci-stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.ci-stat-card:hover {
    border-color: var(--teal);
    box-shadow: 0 4px 14px var(--teal-glow);
    transform: translateY(-2px);
}

.ci-stat-icon {
    font-size: 26px;
    flex-shrink: 0;
}

.ci-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.ci-stat-val {
    font-size: 17px;
    font-weight: 800;
    color: var(--navy);
}

/* Generic Card */
.ci-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.ci-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.ci-card-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--navy);
}

/* Chart Tabs */
.ci-chart-tabs {
    display: flex;
    gap: 6px;
}

.ci-chart-tab {
    padding: 6px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.ci-chart-tab.active {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.ci-chart-wrap {
    position: relative;
    height: 280px;
}

.ci-chart-wrap canvas {
    max-height: 280px;
}

/* Tables */
.ci-table-wrap {
    overflow-x: auto;
    max-height: 340px;
    overflow-y: auto;
    border-radius: var(--radius-sm);
}

.ci-table-wrap::-webkit-scrollbar { height: 4px; width: 4px; }
.ci-table-wrap::-webkit-scrollbar-track { background: var(--bg); }
.ci-table-wrap::-webkit-scrollbar-thumb { background: var(--teal); border-radius: 4px; }

.ci-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 480px;
}

.ci-table thead th {
    background: var(--navy);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.ci-table thead th:first-child { border-radius: 0; }

.ci-table tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-weight: 500;
}

.ci-table tbody tr:nth-child(even) td {
    background: #F8FAFC;
}

.ci-table tbody tr:hover td {
    background: var(--teal-light);
}

.ci-table tbody tr.ci-row-last td {
    background: rgba(13,148,136,0.10);
    font-weight: 800;
    color: var(--teal-dark, #0F766E);
    border-top: 2px solid var(--teal);
}

.ci-positive { color: #16A34A; font-weight: 700; }
.ci-negative { color: #DC2626; font-weight: 700; }

/* Export Bar */
.ci-export-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}

.ci-export-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    margin-right: 4px;
}

.ci-export-btn {
    flex: 1;
    min-width: 90px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.ci-export-btn:hover {
    background: var(--teal);
    transform: translateY(-1px);
}

.ci-export-wa { background: #0D9488; }
.ci-export-wa:hover { background: #0F766E; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 960px) {
    .ci-layout { grid-template-columns: 1fr; }
    .ci-inputs-panel { position: static; }
    .ci-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
    .ci-header { padding: 36px 20px; }
    .ci-hero { padding: 28px 18px; }
    .ci-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .ci-hero-meta { flex-direction: column; gap: 10px; }
    .ci-hero-meta-divider { display: none; }
    .ci-actions { grid-template-columns: 1fr; }
    .ci-export-bar { flex-direction: column; }
    .ci-card { padding: 16px; }
}
