/* frontend/css/tools.css
   Shared styling for invosend.com mini-tools (Fase 1 reusable template,
   MONETIZATION_BLUEPRINT_TRACKER.md). Same brand palette as frontend/index.html
   so the tools feel like part of the same site, not a bolted-on page. */

:root {
    --brand: #54bd95;
    --brand-dark: #2f9b77;
    --ink: #111827;
    --muted: #64748b;
    --line: #dbe7e2;
    --paper: #f7fbf9;
    --panel: #ffffff;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    color: var(--ink);
    background: var(--paper);
}

a {
    color: var(--brand-dark);
}

.shell {
    width: min(960px, 100%);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 19px;
    font-weight: 800;
    text-decoration: none;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
    font-weight: 600;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--brand-dark);
}

.site-nav .btn {
    color: white;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    line-height: 1;
}

.btn-primary {
    color: white;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    box-shadow: 0 10px 24px rgba(84, 189, 149, 0.28);
}

.btn-primary:hover {
    filter: brightness(1.04);
}

.btn-secondary {
    color: var(--ink);
    background: var(--panel);
    border-color: var(--line);
}

.btn-ghost {
    color: var(--brand-dark);
    background: transparent;
    border-color: rgba(84, 189, 149, 0.35);
    padding: 8px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* Tool hero */

.tool-hero {
    padding: 40px 0 8px;
}

.tool-hero h1 {
    margin: 0 0 10px;
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.15;
}

.tool-hero p {
    margin: 0;
    max-width: 640px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

/* Card / form */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.05);
    padding: 24px;
    margin: 24px 0;
}

.card h2 {
    margin: 0 0 16px;
    font-size: 17px;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field.full {
    grid-column: 1 / -1;
}

.field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.field input,
.field textarea,
.field select {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--ink);
    background: white;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: 2px solid rgba(84, 189, 149, 0.45);
    outline-offset: 1px;
}

.field textarea {
    resize: vertical;
    min-height: 64px;
}

.terbilang-preview {
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    font-size: 13px;
    font-style: italic;
    color: var(--muted);
    background: var(--paper);
    min-height: 20px;
    display: flex;
    align-items: center;
}

/* Items table */

.items-table-wrap {
    overflow-x: auto;
}

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

.items-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    padding: 0 8px 8px;
    border-bottom: 1px solid var(--line);
}

.items-table td {
    padding: 8px;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

.items-table input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.items-table .col-qty,
.items-table .col-price,
.items-table .col-total,
.items-table .col-action {
    width: 100px;
}

.items-table .row-total {
    font-weight: 700;
    white-space: nowrap;
}

.remove-row {
    border: none;
    background: transparent;
    color: var(--danger);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 6px;
}

/* Totals summary */

.totals {
    margin-top: 16px;
    margin-left: auto;
    width: min(320px, 100%);
    display: grid;
    gap: 8px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--muted);
}

.totals-row.grand {
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 17px;
    font-weight: 800;
}

/* Exit-intent overlay — shown at most once per session, never during
   upload/generate, only when someone looks like they're leaving. */

.exit-intent-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.exit-intent-overlay.visible {
    display: flex;
}

.exit-intent-card {
    position: relative;
    width: min(380px, 100%);
    background: var(--panel);
    border-radius: 14px;
    padding: 28px 24px 24px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.25);
}

.exit-intent-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.exit-intent-card p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.exit-intent-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: none;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
}

/* Success / CTA panel, shown only after value is delivered */

.success-panel {
    display: none;
    margin-top: 24px;
    padding: 22px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(84, 189, 149, 0.1), rgba(47, 155, 119, 0.06));
    border: 1px solid rgba(84, 189, 149, 0.3);
}

.success-panel.visible {
    display: block;
}

.success-panel h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.success-panel p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

/* FAQ */

.faq {
    padding: 8px 0 48px;
}

.faq h2 {
    font-size: 22px;
    margin-bottom: 16px;
}

.faq-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.faq-item h3 {
    margin: 0 0 8px;
    font-size: 15px;
}

.faq-item p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

/* Related tools */

.related-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 0 40px;
}

/* Footer */

.site-footer {
    padding: 24px 0 40px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.site-footer a {
    color: var(--brand-dark);
    font-weight: 600;
    text-decoration: none;
}

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

    .site-nav {
        display: none;
    }
}
