﻿/* ============================================
   RESET & BASE
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #0f3460;
    --primary-light: #1a4a7a;
    --accent: #e94560;
    --accent-hover: #d63851;
    --bg: #f0f4f8;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #e2e8f0;
    --success: #10b981;
    --shadow: 0 4px 24px rgba(15, 52, 96, 0.08);
    --shadow-hover: 0 8px 32px rgba(15, 52, 96, 0.12);
    --radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 50%, #1a1a2e 100%);
    color: #fff;
    padding: 36px 20px 56px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg);
    clip-path: ellipse(75% 100% at 50% 100%);
}

.hero h1 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.hero .tagline {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero .badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.hero .badge {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ============================================
   MAIN LAYOUT (Calculator Only)
   ============================================ */
main {
    max-width: 780px;
    margin: -40px auto 40px;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 28px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 24px;
    background: var(--accent);
    border-radius: 2px;
}

/* ============================================
   INPUTS
   ============================================ */
.input-group {
    margin-bottom: 14px;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .prefix,
.input-wrapper .suffix {
    position: absolute;
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.95rem;
    pointer-events: none;
}

.input-wrapper .prefix {
    left: 14px;
}

.input-wrapper .suffix {
    right: 14px;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 11px 14px 11px 36px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    background: #fafbfc;
    transition: all 0.2s ease;
    appearance: none;
}

.input-wrapper select {
    padding-left: 14px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(15, 52, 96, 0.08);
}

.input-wrapper input:hover,
.input-wrapper select:hover {
    border-color: #cbd5e1;
}

.hint {
    display: block;
    font-size: 0.82rem;
    color: var(--text-light);
    margin-top: 6px;
    font-weight: 500;
}

/* ============================================
   BUTTON
   ============================================ */
.btn-calculate {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--accent) 0%, #c73250 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    box-shadow: 0 4px 14px rgba(233, 69, 96, 0.3);
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.4);
}

.btn-calculate:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

/* ============================================
   RESULTS
   ============================================ */
.results {
    display: none;
    animation: fadeInUp 0.4s ease;
}

.results.visible {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.total-payment-card {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    color: #fff;
    padding: 32px;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 24px;
    box-shadow: 0 8px 24px rgba(15, 52, 96, 0.2);
}

.total-payment-card .label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.75;
    margin-bottom: 8px;
}

.total-payment {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.total-payment-card .sub {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-top: 8px;
}

/* Result Action Buttons */
.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Breakdown */
.breakdown {
    list-style: none;
    margin-top: 8px;
}

.breakdown li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.breakdown li:last-child {
    border-bottom: none;
}

.breakdown li span:first-child {
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.breakdown li span:first-child::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.breakdown li:nth-child(2) span:first-child::before { background: #3b82f6; }
.breakdown li:nth-child(3) span:first-child::before { background: #f59e0b; }
.breakdown li:nth-child(4) span:first-child::before { background: #ef4444; }
.breakdown li:nth-child(5) span:first-child::before { background: #8b5cf6; }

.breakdown li span:last-child {
    font-weight: 700;
    color: var(--text);
}

.breakdown li.total-row {
    border-top: 2px solid var(--primary);
    margin-top: 8px;
    padding-top: 16px;
    font-size: 1.05rem;
}

.breakdown li.total-row span:first-child::before {
    display: none;
}

.breakdown li.total-row span:last-child {
    color: var(--primary);
    font-size: 1.2rem;
}

/* ============================================
   TABLE
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

th, td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

th:first-child, td:first-child {
    text-align: left;
}

th {
    background: #f8fafc;
    font-weight: 700;
    color: var(--text);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background: #f8fafc;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   CONTENT SECTION (Full Width, Left-Aligned)
   ============================================ */
.content {
    max-width: 1100px;
    margin: 0 auto 40px;
    background: var(--card-bg);
    padding: 48px 60px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    line-height: 1.8;
    text-align: left;
}

.content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary);
    text-align: left;
}

.content h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 12px;
    color: var(--primary-light);
    text-align: left;
}

.content p {
    margin-bottom: 16px;
    color: #374151;
    text-align: left;
    max-width: 100%;
}

.content ul {
    margin-left: 24px;
    margin-bottom: 20px;
    text-align: left;
}

.content li {
    margin-bottom: 10px;
    color: #374151;
    text-align: left;
}

.formula {
    background: #f1f5f9;
    padding: 16px;
    border-radius: 10px;
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.95rem;
    text-align: center;
    margin: 16px 0;
    color: var(--primary);
    font-weight: 600;
    border-left: 4px solid var(--primary);
}

details {
    background: #f8fafc;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

details:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

details[open] {
    background: #fff;
    border-color: var(--primary);
}

summary {
    font-weight: 600;
    color: var(--primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::after {
    content: "+";
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text-light);
    transition: transform 0.2s ease;
}

details[open] summary::after {
    content: "−";
}

details p {
    margin-top: 12px;
    color: #4b5563;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    max-width: 1100px;
    margin: 40px auto;
    padding: 24px 20px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-light);
    border-top: 1px solid var(--border);
}

footer p {
    margin-bottom: 8px;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .hero,
    .calculator,
    .btn-calculate,
    .result-actions,
    .content,
    footer {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    main {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .total-payment-card {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000;
        box-shadow: none;
        page-break-inside: avoid;
    }

    .total-payment-card .label,
    .total-payment-card .sub {
        color: #000 !important;
        opacity: 1 !important;
    }

    .total-payment {
        color: #000 !important;
    }

    .breakdown li span:first-child::before {
        background: #000 !important;
    }

    .table-wrapper {
        border: 1px solid #000;
    }

    th {
        background: #f0f0f0 !important;
        color: #000 !important;
    }

    table, th, td {
        color: #000 !important;
    }
}

/* ============================================
   RESPONSIVE (Mobile Only)
   ============================================ */
@media (max-width: 640px) {
    .hero {
        padding: 28px 16px 44px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero .tagline {
        font-size: 0.85rem;
    }

    .hero .badge {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    main {
        margin-top: -24px;
        padding: 0 12px;
    }

    .card {
        padding: 20px;
    }

    .content {
        padding: 28px 20px;
        margin-left: 12px;
        margin-right: 12px;
    }

    .total-payment {
        font-size: 2.2rem;
    }

    .total-payment-card {
        padding: 24px;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }

    th, td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
}