/* Kissimmee Main Street CRM — warm, mobile-first, approachable */

:root {
    --primary: #2B7A78;
    --primary-dark: #1F5F5D;
    --accent: #F4A261;
    --accent-dark: #E08C3B;
    --bg: #FAFAF5;
    --bg-card: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --border: #DFE6E9;
    --danger: #D63031;
    --success: #00B894;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
        Ubuntu, Cantarell, sans-serif;
}

/* ── Reset & Base ───────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin-top: 0; line-height: 1.3; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }

/* ── Navigation ─────────────────────────────── */

.top-nav {
    background: var(--primary);
    color: white;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 56px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-brand {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-decoration: none;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    text-decoration: none;
}

/* ── Container ──────────────────────────────── */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* ── Buttons ────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    min-height: 44px;
    min-width: 44px;
    transition: background 0.15s, transform 0.1s;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }

.btn-accent { background: var(--accent); color: var(--text); }
.btn-accent:hover { background: var(--accent-dark); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #ccd5d8; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; color: white; }

.btn-link {
    background: none;
    color: var(--text-light);
    padding: 0.4rem;
    font-weight: normal;
    text-decoration: underline;
}

.btn-small { padding: 0.4rem 0.8rem; font-size: 0.85rem; min-height: 36px; }

/* ── Dashboard ──────────────────────────────── */

.dashboard h1 { margin-bottom: 0.25rem; }
.subtitle { color: var(--text-light); margin-top: 0; margin-bottom: 1.5rem; }

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    color: var(--text-light);
    font-size: 0.85rem;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: var(--radius);
    text-decoration: none;
    color: white;
    padding: 0.75rem;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: var(--shadow);
}

.action-tile:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.action-tile:active { transform: scale(0.97); }

.tile-icon {
    font-size: 1.75rem;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.tile-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.tile-primary  { background: var(--primary); }
.tile-accent   { background: var(--accent); }
.tile-teal     { background: var(--primary-dark); }
.tile-green    { background: var(--success); }

/* ── Page Header ────────────────────────────── */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── Search ─────────────────────────────────── */

.search-bar { margin-bottom: 1.5rem; }

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    min-height: 44px;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Contact Grid ───────────────────────────── */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 600px) {
    .contact-grid { grid-template-columns: repeat(2, 1fr); }
}

.contact-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    display: block;
    color: var(--text);
    transition: border-color 0.15s;
}

.contact-card:hover {
    border-color: var(--primary);
    text-decoration: none;
}

.contact-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.contact-name { font-weight: 700; font-size: 1.05rem; }

.contact-address, .contact-last-seen {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* ── Badges ─────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-business { background: #DFE6E9; color: var(--primary-dark); }
.badge-person { background: #FFEAA7; color: #856404; }
.badge-organization { background: #C8E6C9; color: #2E7D32; }
.badge-visit { background: #BBDEFB; color: #1565C0; }
.badge-phone { background: #E1BEE7; color: #7B1FA2; }
.badge-email { background: #FFE0B2; color: #E65100; }
.badge-meeting { background: #B2DFDB; color: #00695C; }
.badge-event { background: #F8BBD0; color: #AD1457; }
.badge-note { background: #CFD8DC; color: #37474F; }

/* ── Tags ───────────────────────────────────── */

.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }

.tag {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ── Contact Dossier ────────────────────────── */

.dossier-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dossier-title { display: flex; align-items: center; gap: 0.75rem; }
.dossier-title h1 { margin: 0; }

.dossier-actions { display: flex; gap: 0.5rem; }

.inline-form { display: inline; }

.dossier-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    gap: 1rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--bg);
}

.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 600; min-width: 80px; color: var(--text-light); font-size: 0.9rem; }
.info-value { flex: 1; }

.dossier-notes {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.dossier-notes h1, .dossier-notes h2, .dossier-notes h3 { color: var(--primary-dark); }
.dossier-notes blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-light);
    font-style: italic;
}

.dossier-notes .checklist { list-style: none; padding-left: 0; }
.dossier-notes .task { padding: 0.25rem 0; }
.dossier-notes .task.done { text-decoration: line-through; color: var(--text-light); }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* ── Interaction List ───────────────────────── */

.interaction-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.interaction-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

.interaction-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.interaction-date { font-weight: 600; font-size: 0.9rem; }
.interaction-staff { color: var(--text-light); font-size: 0.85rem; }
.interaction-summary, .interaction-body { color: var(--text-light); font-size: 0.9rem; }

.interaction-metrics {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.metric {
    background: #E8F5E9;
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2E7D32;
}

/* ── Forms ──────────────────────────────────── */

.form-page { max-width: 700px; }

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select,
.form-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    min-height: 44px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.textarea-large {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: var(--font);
    resize: vertical;
    min-height: 120px;
}

.textarea-large:focus {
    outline: none;
    border-color: var(--primary);
}

.form-actions-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.form-context {
    color: var(--text-light);
    margin-bottom: 1rem;
}

.manual-form {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-card);
}

.manual-form summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    min-height: 44px;
    display: flex;
    align-items: center;
}

.contact-form { margin-top: 1rem; }

/* ── AI Review Panel ────────────────────────── */

.ai-review-panel {
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.ai-review-panel h2 { color: var(--primary-dark); margin-bottom: 0.25rem; }

.review-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

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

.validation-badge {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}

.validation-badge.valid {
    background: #E8F5E9;
    color: #2E7D32;
}

.validation-badge.invalid {
    background: #FFEBEE;
    color: #C62828;
}

.review-hint {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.review-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.review-original h3, .review-structured h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.original-text {
    background: var(--bg);
    padding: 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.structured-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
}

.structured-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.plain-save-fallback {
    margin-top: 1rem;
    text-align: center;
}

.extracted-metrics {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.metrics-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.metric-card {
    background: #E8F5E9;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    text-align: center;
}

.metric-value { display: block; font-size: 1.5rem; font-weight: 700; color: #2E7D32; }
.metric-label { font-size: 0.8rem; color: #388E3C; }

/* ── Activity Log ───────────────────────────── */

.activity-feed { margin-top: 1rem; }

.activity-line {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg);
    font-size: 0.9rem;
    color: var(--text-light);
}

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

.link-more {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
}

/* ── Empty State ────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-state h2 { color: var(--primary); }
.empty-hint { color: var(--text-light); font-size: 0.9rem; }

/* ── Error ──────────────────────────────────── */

.error { color: var(--danger); font-weight: 600; }

.error-page {
    text-align: center;
    padding: 3rem 1rem;
}

/* ── HTMX Indicator ─────────────────────────── */

.htmx-indicator {
    display: none;
    color: var(--accent-dark);
    font-weight: 600;
}

.htmx-request .htmx-indicator,
.htmx-indicator.htmx-request {
    display: inline-block;
}

/* ── Footer ─────────────────────────────────── */

.site-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
}

/* ── Volunteer Badges ──────────────────────────── */

.badge-volunteer-active { background: #C8E6C9; color: #2E7D32; }
.badge-volunteer-inactive { background: #CFD8DC; color: #37474F; }
.badge-hours { background: #BBDEFB; color: #1565C0; }
.badge-warning { background: #FFE0B2; color: #E65100; }

/* ── Tier Badges ──────────────────────────────── */

.badge-tier-silver { background: #E0E0E0; color: #424242; }
.badge-tier-gold { background: #FFF8E1; color: #F57F17; border: 1px solid #FFD54F; }

/* ── Roster Table ──────────────────────────────── */

.roster-table { overflow-x: auto; margin-bottom: 1.5rem; }

.roster-table table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.roster-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--bg);
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

.roster-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--bg);
    font-size: 0.9rem;
}

.roster-table tr:last-child td { border-bottom: none; }
.roster-table tr:hover { background: var(--bg); }

/* ── Milestones ────────────────────────────────── */

.milestone-section { margin-bottom: 1.5rem; }
.milestone-section h3 { font-size: 1rem; color: var(--text-light); }

.milestone-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.milestone {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.milestone-reached {
    background: var(--accent);
    color: var(--text);
}

.milestone-pending {
    background: var(--border);
    color: var(--text-light);
}

.milestone-hours { text-align: center; }

/* ── Benefits ──────────────────────────────────── */

.benefits-list { margin-bottom: 1.5rem; }

.benefit-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.benefit-item.completed {
    background: #F1F8E9;
}

.benefit-toggle-form { display: inline; }

.benefit-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font);
    min-height: 44px;
    padding: 0.25rem;
}

.benefit-toggle:hover { opacity: 0.8; }

.benefit-label { font-weight: 600; }

.benefit-date {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-left: auto;
}

.benefit-notes {
    color: var(--text-light);
    font-size: 0.8rem;
    font-style: italic;
}

.benefits-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.benefit-quick-item {
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--bg);
    border: 1px solid var(--border);
}

.benefit-quick-item.completed {
    background: #E8F5E9;
    border-color: #C8E6C9;
}

/* Benefits matrix */
.benefits-matrix .benefit-col-header {
    font-size: 0.75rem;
    text-align: center;
    max-width: 80px;
    word-wrap: break-word;
}

.benefit-cell { text-align: center; font-size: 1.1rem; }

/* ── Renewals ──────────────────────────────────── */

.renewal-soon { color: var(--accent-dark); font-weight: 600; }
.overdue-row { background: #FFF3F0; }
.overdue-days { color: var(--danger); font-weight: 600; }

/* ── Alerts ────────────────────────────────────── */

.alert-section { margin-bottom: 1.5rem; }

.alert-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alert-item {
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.overdue-alert { background: #FFEBEE; color: #C62828; }
.renewal-alert { background: #FFF3E0; color: #E65100; }
.milestone-alert { background: #E8F5E9; color: #2E7D32; }

/* ── QR Code ───────────────────────────────────── */

.qr-display {
    margin: 2rem 0;
}

.qr-image {
    max-width: 280px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: white;
}

.qr-hint {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ── Checked-in state ──────────────────────────── */

.checked-in {
    color: var(--success);
    font-size: 1.1rem;
}

/* ── Payment review card ──────────────────────── */

.payment-review-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

/* ── Responsive ─────────────────────────────── */

@media (max-width: 600px) {
    .top-nav {
        flex-direction: column;
        padding: 0.5rem 1rem;
        gap: 0.25rem;
    }

    .nav-links { width: 100%; justify-content: center; flex-wrap: wrap; }
    .nav-links a { font-size: 0.8rem; padding: 0.35rem 0.5rem; }

    .stats-row { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .stat-card { padding: 0.75rem; }
    .stat-number { font-size: 1.5rem; }

    .dossier-header { flex-direction: column; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }

    .roster-table { font-size: 0.85rem; }
    .roster-table th, .roster-table td { padding: 0.5rem; }

    .benefits-matrix .benefit-col-header { font-size: 0.65rem; }
}

@media print {
    .top-nav, .site-footer, .dossier-actions, .form-actions { display: none; }
    .qr-image { max-width: 200px; }
    body { background: white; }
}
