/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #222633;
    --border: #2e3345;
    --text: #e8eaed;
    --text-dim: #9aa0b0;
    --accent: #6c63ff;
    --accent-hover: #7d75ff;
    --accent-glow: rgba(108, 99, 255, 0.2);
    --green: #34d399;
    --yellow: #fbbf24;
    --red: #f87171;
    --orange: #fb923c;
    --blue: #60a5fa;
    --pink: #f472b6;
    --cyan: #22d3ee;
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===== Header ===== */
header {
    padding: 32px 0 16px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

header .subtitle {
    color: var(--text-dim);
    font-size: 1.05rem;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 8px;
    color: var(--text);
}

/* ===== Architecture Grid ===== */
.architecture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.arch-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: inherit;
}

.arch-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
}

.arch-card.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 12px var(--accent-glow);
}

.arch-icon {
    color: var(--accent);
    width: 40px;
    height: 40px;
}

.arch-name {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
}

.arch-services {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.3;
}

/* ===== Config Header & Toggle ===== */
.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.config-header h2 {
    margin-bottom: 0;
}

.billing-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    transition: color 0.2s;
}

.toggle-label.active {
    color: var(--accent);
    font-weight: 600;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--border);
    border: none;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0;
}

.toggle-switch.active {
    background: var(--accent);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--text);
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch.active .toggle-thumb {
    transform: translateX(20px);
}

/* ===== Sliders ===== */
.slider-group {
    margin-bottom: 20px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.slider-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.slider-value {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 0 6px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--surface);
    box-shadow: 0 0 6px var(--accent-glow);
}

.slider-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 2px;
}

/* ===== Instance Selector ===== */
.select-group {
    margin-bottom: 20px;
}

.select-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 6px;
}

.select-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
}

.select-group select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Results ===== */
.results-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.total-cost-box {
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.total-label {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.total-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.free-tier-note {
    font-size: 0.82rem;
    color: var(--green);
    margin-top: 8px;
}

.chart-and-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ===== Bar Chart ===== */
.chart-container {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 200px;
    padding-top: 20px;
}

.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 48px;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
    position: relative;
}

.bar-amount {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bar-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 6px;
    line-height: 1.2;
    word-break: break-word;
}

/* ===== Breakdown Table ===== */
.breakdown-table {
    font-size: 0.85rem;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-service {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.breakdown-cost {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.breakdown-row.total-row {
    border-top: 2px solid var(--border);
    margin-top: 4px;
    padding-top: 12px;
    font-weight: 700;
}

/* ===== Free Tier Section ===== */
.free-tier-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

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

.free-tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.free-tier-badge.covered {
    background: rgba(52, 211, 153, 0.15);
    color: var(--green);
}

.free-tier-badge.partial {
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow);
}

.free-tier-badge.not-covered {
    background: rgba(248, 113, 113, 0.1);
    color: var(--red);
}

/* ===== Tips ===== */
.tip-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 3px solid var(--accent);
}

.tip-item:last-child {
    margin-bottom: 0;
}

.tip-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.tip-text {
    font-size: 0.85rem;
    line-height: 1.5;
}

.tip-savings {
    color: var(--green);
    font-weight: 600;
}

/* ===== CTA ===== */
.cta-card {
    text-align: center;
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--surface) 0%, rgba(108, 99, 255, 0.08) 100%);
}

.cta-card h2 {
    color: var(--accent);
}

.cta-card p {
    color: var(--text-dim);
    margin-bottom: 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    display: inline-block;
    padding: 12px 32px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, transform 0.1s;
}

.cta-button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* ===== SEO Content ===== */
.seo-content {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.seo-content h2 {
    color: var(--text);
}

.seo-content h3 {
    color: var(--text);
}

.seo-content p {
    margin-bottom: 12px;
}

.seo-content ul {
    margin: 0 0 12px 20px;
}

.seo-content li {
    margin-bottom: 6px;
}

/* ===== Ad Slots ===== */
.ad-slot {
    margin-bottom: 20px;
    min-height: 50px;
    text-align: center;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 32px 0;
    border-top: 1px solid var(--border);
    margin-top: 20px;
    color: var(--text-dim);
    font-size: 0.82rem;
}

footer .disclaimer {
    margin-top: 8px;
    font-size: 0.72rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    header h1 {
        font-size: 1.5rem;
    }

    .architecture-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-and-breakdown {
        grid-template-columns: 1fr;
    }

    .total-amount {
        font-size: 2rem;
    }

    .card {
        padding: 16px;
    }

    .bar-chart {
        height: 160px;
    }
}

@media (max-width: 380px) {
    .architecture-grid {
        grid-template-columns: 1fr;
    }
}
