/* NetZero Invoice — Styles
   Design: Fintech / Stripe-inspired, dark navy + emerald accent
   Fonts: DM Sans (headings), Inter (body), JetBrains Mono (numbers)
*/

/* ═══════════════ CSS CUSTOM PROPERTIES ═══════════════ */
:root {
    /* Colors — Brand */
    --navy: #0A2540;
    --navy-light: #1A3A5C;
    --emerald: #00D4AA;
    --emerald-dark: #00B892;
    --emerald-glow: rgba(0, 212, 170, 0.15);
    --coral: #FF6B6B;
    --coral-light: #FF8A8A;
    --coral-bg: rgba(255, 107, 107, 0.08);

    /* Colors — Neutrals */
    --white: #FFFFFF;
    --off-white: #F8F8F6;
    --gray-50: #F5F6F8;
    --gray-100: #EDF0F3;
    --gray-200: #D8DEE5;
    --gray-300: #A3ACB9;
    --gray-400: #6B7C93;
    --gray-500: #425466;
    --gray-600: #2D3A4A;

    /* Typography */
    --font-heading: 'DM Sans', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(10, 37, 64, 0.06), 0 1px 2px rgba(10, 37, 64, 0.04);
    --shadow-md: 0 4px 12px rgba(10, 37, 64, 0.08), 0 2px 4px rgba(10, 37, 64, 0.04);
    --shadow-lg: 0 10px 30px rgba(10, 37, 64, 0.10), 0 4px 8px rgba(10, 37, 64, 0.06);
    --shadow-xl: 0 20px 50px rgba(10, 37, 64, 0.12), 0 8px 16px rgba(10, 37, 64, 0.06);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 250ms;
}

/* ═══════════════ RESET & BASE ═══════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--gray-500);
    background: var(--white);
    line-height: 1.6;
    min-height: 100vh;
}

/* ═══════════════ UTILITIES ═══════════════ */
.container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ═══════════════ HEADER ═══════════════ */
.site-header {
    background: var(--navy);
    padding: var(--space-lg) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.site-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(0, 212, 170, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 30%, rgba(0, 212, 170, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.header-inner {
    position: relative;
    z-index: 1;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.brand-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(0, 212, 170, 0.4));
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
}

.brand-accent {
    color: var(--emerald);
}

.brand-tagline {
    font-size: 0.85rem;
    color: var(--gray-300);
    margin-top: var(--space-xs);
    letter-spacing: 0.02em;
}

/* ═══════════════ AD SLOTS ═══════════════ */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--gray-200);
    color: var(--gray-300);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    background: var(--gray-50);
    margin: var(--space-md) auto;
}

.ad-slot--mobile {
    width: 320px;
    height: 50px;
    max-width: 100%;
    border-radius: var(--radius-sm);
}

.ad-slot--desktop {
    display: none;
    width: 728px;
    height: 90px;
    max-width: 100%;
    border-radius: var(--radius-sm);
}

@media (min-width: 768px) {
    .ad-slot--mobile { display: none; }
    .ad-slot--desktop { display: flex; }
}

/* ═══════════════ HERO INPUT ═══════════════ */
.hero-input-section {
    text-align: center;
    padding: var(--space-2xl) 0 var(--space-xl);
}

.hero-label {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--gray-400);
    margin-bottom: var(--space-md);
    letter-spacing: 0.01em;
}

.hero-input-wrapper {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) 0;
    border-bottom: 3px solid var(--gray-200);
    transition: border-color var(--duration) var(--ease);
    max-width: 420px;
    margin: 0 auto;
}

.hero-input-wrapper:focus-within {
    border-color: var(--emerald);
}

.hero-currency-symbol {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--gray-300);
    transition: color var(--duration) var(--ease);
    line-height: 1;
}

.hero-input-wrapper:focus-within .hero-currency-symbol {
    color: var(--navy);
}

.hero-input {
    font-family: var(--font-mono);
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--navy);
    background: none;
    border: none;
    outline: none;
    text-align: center;
    width: 100%;
    max-width: 340px;
    padding: 0;
    line-height: 1.1;
    caret-color: var(--emerald);
}

.hero-input::placeholder {
    color: var(--gray-200);
}

.hero-sub-controls {
    margin-top: var(--space-lg);
    display: flex;
    justify-content: center;
}

.currency-select-wrapper {
    position: relative;
}

.currency-select {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gray-500);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-xl) var(--space-sm) var(--space-md);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%236B7C93'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all var(--duration) var(--ease);
}

.currency-select:hover {
    border-color: var(--gray-300);
}

.currency-select:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-glow);
}

/* ═══════════════ SECTION TITLES ═══════════════ */
.section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: var(--space-md);
    letter-spacing: -0.01em;
}

.section-subtitle {
    font-size: 0.85rem;
    color: var(--gray-400);
    margin-top: calc(-1 * var(--space-sm));
    margin-bottom: var(--space-lg);
}

/* ═══════════════ GATEWAY SELECTOR ═══════════════ */
.gateway-section {
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--gray-100);
}

.gateway-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

@media (min-width: 580px) {
    .gateway-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.gateway-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md) var(--space-sm);
    background: var(--white);
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.gateway-card:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.gateway-card.active {
    border-color: var(--emerald);
    background: var(--emerald-glow);
    box-shadow: 0 0 0 3px var(--emerald-glow), var(--shadow-md);
}

.gateway-card-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.gateway-card-name {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--navy);
}

.gateway-card-fee {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--gray-400);
    text-align: center;
    line-height: 1.3;
}

/* Fee type toggle (domestic / international) */
.fee-type-toggle,
.platform-order-toggle,
.tax-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--gray-400);
    transition: color var(--duration) var(--ease);
    cursor: default;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--gray-200);
    border: none;
    border-radius: 13px;
    cursor: pointer;
    transition: background var(--duration) var(--ease);
    padding: 0;
    flex-shrink: 0;
}

.toggle-switch[aria-checked="true"] {
    background: var(--emerald);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--white);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform var(--duration) var(--ease);
}

.toggle-switch[aria-checked="true"] .toggle-thumb {
    transform: translateX(22px);
}

/* Custom fee inputs */
.custom-fee-inputs {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    animation: slideDown 250ms var(--ease);
}

.custom-fee-inputs[hidden] {
    display: none;
}

.custom-fee-field {
    flex: 1;
}

.custom-fee-field label,
.form-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-400);
    margin-bottom: var(--space-xs);
}

.input-field {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--navy);
    background: var(--white);
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    transition: all var(--duration) var(--ease);
}

.input-field:focus {
    outline: none;
    border-color: var(--emerald);
    box-shadow: 0 0 0 3px var(--emerald-glow);
}

/* ═══════════════ COLLAPSIBLE SECTIONS ═══════════════ */
.collapsible-section {
    border-top: 1px solid var(--gray-100);
    padding: var(--space-md) 0;
}

.collapsible-trigger {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) 0;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--navy);
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--duration) var(--ease);
    text-align: left;
}

.collapsible-trigger:hover {
    color: var(--emerald-dark);
}

.collapsible-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--emerald);
    background: var(--emerald-glow);
    border-radius: 50%;
    transition: transform var(--duration) var(--ease);
    flex-shrink: 0;
    line-height: 1;
}

.collapsible-trigger[aria-expanded="true"] .collapsible-icon {
    transform: rotate(45deg);
}

.collapsible-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--gray-300);
    font-family: var(--font-body);
}

.collapsible-body {
    padding: var(--space-md) 0;
    animation: slideDown 250ms var(--ease);
}

.collapsible-body[hidden] {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-row {
    display: flex;
    gap: var(--space-md);
}

.form-field {
    flex: 1;
}

.tax-explainer {
    font-size: 0.8rem;
    color: var(--gray-400);
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--emerald);
    line-height: 1.5;
}

/* ═══════════════ RESULTS SECTION ═══════════════ */
.results-section {
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--gray-100);
}

.results-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-lg) var(--space-md);
    border-bottom: 1px solid var(--gray-100);
}

.results-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--navy);
}

.results-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 12px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--emerald-dark);
    background: var(--emerald-glow);
    border: 1px solid rgba(0, 212, 170, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.btn-copy:hover {
    background: rgba(0, 212, 170, 0.25);
    box-shadow: var(--shadow-sm);
}

.btn-copy:active {
    transform: scale(0.97);
}

.btn-copy--alt {
    color: var(--gray-500);
    background: var(--gray-50);
    border-color: var(--gray-200);
}

.btn-copy--alt:hover {
    background: var(--gray-100);
}

.copy-icon {
    font-size: 0.85rem;
}

/* Invoice lines */
.invoice-lines {
    padding: 0 var(--space-lg);
}

.invoice-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--gray-50);
    gap: var(--space-md);
}

.invoice-line:last-child {
    border-bottom: none;
}

.invoice-line[hidden] {
    display: none;
}

.invoice-line-label {
    font-size: 0.9rem;
    color: var(--gray-500);
    font-weight: 500;
}

.invoice-line-sub {
    font-size: 0.75rem;
    color: var(--gray-300);
    font-weight: 400;
}

.invoice-line-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: right;
}

.invoice-line-value--hero {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--emerald-dark);
}

.invoice-line-value--fee {
    color: var(--coral);
}

.invoice-line-value--total {
    font-size: 1.15rem;
    color: var(--emerald-dark);
}

.invoice-line--hero {
    padding: var(--space-lg) 0;
    border-bottom: 2px solid var(--gray-100);
}

.invoice-line--total {
    padding: var(--space-lg) 0;
    border-top: 2px solid var(--gray-100);
    border-bottom: none;
    background: linear-gradient(135deg, var(--emerald-glow), transparent);
    margin: 0 calc(-1 * var(--space-lg));
    padding-left: var(--space-lg);
    padding-right: var(--space-lg);
}

/* ═══════════════ STATS SECTION ═══════════════ */
.stats-section {
    padding: var(--space-xl) 0;
    border-top: 1px solid var(--gray-100);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

@media (min-width: 580px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-lg) var(--space-md);
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card--warning {
    border-color: var(--coral);
    background: var(--coral-bg);
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}

.stat-label-sub {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--gray-300);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}

.stat-value--fee {
    color: var(--coral);
}

.stat-value--warning {
    color: var(--coral);
}

.stat-sub {
    font-size: 0.7rem;
    color: var(--gray-300);
}

/* ═══════════════ COMPARISON TABLE ═══════════════ */
.comparison-section {
    padding: var(--space-xl) 0 var(--space-2xl);
    border-top: 1px solid var(--gray-100);
}

.comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 520px;
}

.comparison-table thead {
    background: var(--navy);
    color: var(--white);
}

.comparison-table th {
    padding: var(--space-md) var(--space-md);
    text-align: left;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.comparison-table th:nth-child(n+3) {
    text-align: right;
}

.comparison-table td {
    padding: var(--space-md) var(--space-md);
    border-bottom: 1px solid var(--gray-50);
    vertical-align: middle;
}

.comparison-table td:nth-child(n+3) {
    text-align: right;
    font-family: var(--font-mono);
    font-weight: 500;
}

.comparison-table tbody tr {
    transition: background var(--duration) var(--ease);
}

.comparison-table tbody tr:hover {
    background: var(--gray-50);
}

.comparison-table tbody tr.cheapest {
    background: var(--emerald-glow);
}

.comparison-table tbody tr.cheapest td:first-child {
    font-weight: 700;
    color: var(--emerald-dark);
}

.comparison-table tbody tr.active-row {
    outline: 2px solid var(--emerald);
    outline-offset: -2px;
}

.cheapest-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    background: var(--emerald);
    color: var(--white);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: var(--space-xs);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gateway-name-cell {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 500;
    color: var(--navy);
    white-space: nowrap;
}

.gateway-name-cell .icon {
    font-size: 1.1rem;
}

.fee-structure-cell {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--gray-400);
    white-space: nowrap;
}

.fee-pct-cell {
    color: var(--coral);
    font-weight: 600;
}

/* ═══════════════ FOOTER ═══════════════ */
.site-footer {
    background: var(--navy);
    padding: var(--space-xl) 0;
    text-align: center;
}

.footer-text {
    font-size: 0.8rem;
    color: var(--gray-300);
    line-height: 1.6;
}

.footer-text--muted {
    color: var(--gray-400);
    margin-top: var(--space-xs);
    font-size: 0.72rem;
}

/* ═══════════════ TOAST ═══════════════ */
.toast {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--navy);
    color: var(--white);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: all 300ms var(--ease);
    z-index: 1000;
    pointer-events: none;
}

.toast[hidden] {
    display: block;
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ═══════════════ RESPONSIVE ═══════════════ */
@media (min-width: 768px) {
    .site-header {
        padding: var(--space-xl) 0;
    }

    .brand-name {
        font-size: 2rem;
    }

    .brand-tagline {
        font-size: 0.95rem;
    }

    .hero-input-section {
        padding: var(--space-3xl) 0 var(--space-2xl);
    }

    .hero-label {
        font-size: 1.25rem;
    }

    .hero-currency-symbol {
        font-size: 2.8rem;
    }

    .hero-input {
        font-size: 3.5rem;
    }

    .hero-input-wrapper {
        max-width: 500px;
    }

    .invoice-line-value--hero {
        font-size: 1.8rem;
    }

    .results-header {
        flex-wrap: nowrap;
    }
}

/* Number animation */
@keyframes pulseGreen {
    0% { color: var(--emerald-dark); }
    50% { color: var(--emerald); }
    100% { color: var(--emerald-dark); }
}

.value-updated {
    animation: pulseGreen 400ms var(--ease);
}
