/*
 * tool-invoice-generator.css
 * Forces a LIGHT theme for the invoice generator tool page regardless of the
 * global data-theme attribute set by clientflow.css / dark mode toggle.
 * These rules are NOT conditional on any theme variable.
 */

/* ── Edge-to-edge light background (overrides the marketing dark body) ── */
body:has(.ig-page) { background: #f7f8fa; }

/* ── Page root ─────────────────────────────────────────────────────────── */
.ig-page {
    padding: 40px 24px 80px;
    max-width: 1280px;
    margin: 0 auto;
    background: transparent;
    color: #1f2937;
}

/* Hero header */
.ig-page__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
}
.ig-page__header-inner h1 { font-size: 30px; margin: 0 0 6px; color: #111827; letter-spacing: -0.02em; }
.ig-page__sub { color: #6b7280; margin: 0 0 12px; font-size: 15px; }
.ig-page__benefits {
    display: flex; gap: 16px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none;
}
.ig-page__benefits li {
    font-size: 13px; color: #374151;
    display: inline-flex; align-items: center; gap: 6px;
}
.ig-page__benefits li::before {
    content: "✓"; color: #10b981; font-weight: 700;
}
.ig-page__my-invoices {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px;
    background: #ffffff; border: 1px solid #d1d5db;
    color: #1f2937; font-size: 14px; font-weight: 500;
    text-decoration: none;
}
.ig-page__my-invoices:hover { background: #f3f4f6; }

.ig-page__grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
@media (min-width: 980px) {
    .ig-page__grid { grid-template-columns: 460px 1fr; gap: 32px; }
}

/* ── Card (fieldset) ────────────────────────────────────────────────────── */
.ig-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 14px;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}
.ig-card legend {
    font-weight: 600;
    padding: 0 6px;
    font-size: 13px;
    color: #111827;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Form controls ──────────────────────────────────────────────────────── */
.ig-form label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
    color: #1f2937;
}

.ig-form input,
.ig-form select,
.ig-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    background: #ffffff;
    color: #1f2937;
    display: block;
    margin-top: 4px;
}

.ig-form input::placeholder,
.ig-form textarea::placeholder {
    color: #9ca3af;
}

.ig-form input:focus,
.ig-form select:focus,
.ig-form textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.ig-form textarea {
    min-height: 60px;
    resize: vertical;
}

/* ── Line-item row ──────────────────────────────────────────────────────── */
.ig-line {
    display: grid;
    /* description fills space; qty/unit/rate get enough room for 5-6 digits */
    grid-template-columns: minmax(0, 1fr) 60px 72px 92px auto;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}

.ig-line input,
.ig-line select {
    background: #ffffff;
    color: #1f2937;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 13px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0; /* allow grid cells to shrink without overflowing */
}

.ig-line input:focus,
.ig-line select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

#ig-add-line {
    margin-top: 4px;
    padding: 5px 12px;
    font-size: 13px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
}
#ig-add-line:hover { background: #f3f4f6; }

.ig-line button[data-act="remove"] {
    padding: 4px 8px;
    font-size: 15px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
}
.ig-line button[data-act="remove"]:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

.ig-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.ig-actions .btn { width: 100%; padding: 12px 16px; font-size: 15px; font-weight: 600; }
.ig-actions__hint { font-size: 12px; color: #6b7280; text-align: center; margin: 0; }

/* AI hint card (anonymous users — soft nudge, not pushy) */
.ig-ai-hint {
    margin-top: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #faf5ff 0%, #eef2ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    font-size: 13px;
    color: #4338ca;
    display: flex; align-items: center; gap: 10px;
}
.ig-ai-hint__icon { font-size: 16px; }
.ig-ai-hint__text { flex: 1; }
.ig-ai-hint a { color: #4338ca; font-weight: 600; text-decoration: underline; }

/* ── Preview panel ──────────────────────────────────────────────────────── */
.ig-preview { position: sticky; top: 24px; }
.ig-preview__paper {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    min-height: 600px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
    font-size: 13px;
    color: #1f2937;
    line-height: 1.5;
    --ig-accent: #4F46E5;
}
.ig-preview__placeholder {
    color: #9ca3af;
    text-align: center;
    padding: 200px 0;
    font-style: italic;
}

/* ── Preview document styles ────────────────────────────────────────────── */
.ig-pv { display: flex; flex-direction: column; gap: 24px; }
.ig-pv__header {
    display: grid; grid-template-columns: 1fr auto auto; gap: 16px;
    align-items: flex-start;
    background: var(--ig-accent); color: #fff;
    padding: 20px 24px; border-radius: 6px;
    margin: -20px -20px 0;
}
.ig-pv__title { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.ig-pv__brand { font-size: 12px; opacity: 0.9; margin-top: 2px; }
.ig-pv__logo { max-height: 44px; max-width: 100px; background: #fff; padding: 4px; border-radius: 4px; }
.ig-pv__meta { font-size: 11px; text-align: right; line-height: 1.6; }

.ig-pv__addresses { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.ig-pv__label { font-size: 10px; font-weight: 600; color: #6b7280; letter-spacing: 0.5px; margin-bottom: 4px; }

.ig-pv__items { width: 100%; border-collapse: collapse; font-size: 12px; }
.ig-pv__items th { text-align: left; padding: 8px 6px; font-size: 10px; color: #6b7280;
                   font-weight: 600; letter-spacing: 0.5px; border-bottom: 1px solid #d0d5dd; }
.ig-pv__items td { padding: 8px 6px; border-bottom: 1px solid #f0f1f4; vertical-align: top; }
.ig-pv__num { text-align: right; white-space: nowrap; }

.ig-pv__totals { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12px; }
.ig-pv__totals > div { display: grid; grid-template-columns: auto 90px; gap: 24px; min-width: 220px; }
.ig-pv__grand { font-weight: 700; font-size: 15px; color: var(--ig-accent); padding-top: 6px;
                border-top: 1px solid var(--ig-accent); margin-top: 4px; }

.ig-pv__notes { font-size: 11px; color: #6b7280; border-top: 1px solid #f0f1f4; padding-top: 12px; }
.ig-pv__muted { color: #9ca3af; font-style: italic; }

/* Classic layout — serif, monochrome, hairline rules */
.ig-pv--classic .ig-pv__header {
    background: transparent; color: #111; border-bottom: 1px solid #111;
    padding-bottom: 16px; margin: 0; border-radius: 0; text-align: center;
    grid-template-columns: 1fr;
}
.ig-pv--classic .ig-pv__title { font-family: 'Times New Roman', Georgia, serif; font-weight: 400; }
.ig-pv--classic .ig-pv__meta { text-align: center; }
.ig-pv--classic { font-family: 'Times New Roman', Georgia, serif; }
.ig-pv--classic .ig-pv__grand { color: #111; border-top: 1px solid #111; }

/* Minimal — accent only on totals, sparse */
.ig-pv--minimal .ig-pv__header { background: transparent; color: #111; padding: 0; margin: 0; border-radius: 0; }
.ig-pv--minimal .ig-pv__brand,
.ig-pv--minimal .ig-pv__meta { color: #6b7280; }
.ig-pv--minimal .ig-pv__title { color: #111; }

/* ── CTA block ──────────────────────────────────────────────────────────── */
.ig-cta {
    margin-top: 56px;
    padding: 32px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: center;
}
@media (min-width: 760px) {
    .ig-cta { grid-template-columns: 1fr auto; padding: 36px 40px; }
}
.ig-cta__lead h2 { margin: 0 0 8px; font-size: 22px; color: #111827; letter-spacing: -0.01em; }
.ig-cta__lead p { margin: 0 0 16px; color: #4b5563; font-size: 15px; }
.ig-cta__bullets { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ig-cta__bullets li {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 14px; color: #374151; line-height: 1.5;
}
.ig-cta__bullets li::before {
    content: "→"; color: #4f46e5; font-weight: 700; flex: 0 0 auto;
}
.ig-cta__action { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.ig-cta__action .btn { padding: 14px 28px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.ig-cta__action small { color: #6b7280; font-size: 12px; text-align: center; }

.ig-bridge-banner {
    display: grid; gap: 16px; align-items: center;
    grid-template-columns: 1fr;
    padding: 18px 22px; margin: 0 0 24px;
    border-radius: 12px;
    background: linear-gradient(180deg, #eef2ff 0%, #ffffff 100%);
    border: 1px solid #c7d2fe;
}
@media (min-width: 640px) {
    .ig-bridge-banner { grid-template-columns: 1fr auto; padding: 20px 28px; }
}
.ig-bridge-banner__lead strong { display: block; color: #111827; font-size: 16px; margin-bottom: 4px; letter-spacing: -0.01em; }
.ig-bridge-banner__lead p { margin: 0; color: #4b5563; font-size: 14px; line-height: 1.5; }
.ig-bridge-banner .btn { white-space: nowrap; }
