/* Kissimmee Main Street CRM — v2
   Mobile-first, lean, focused on what staff actually need. */

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

:root {
    --primary: #1a365d;
    --primary-light: #2a4a7f;
    --accent: #c9952e;
    --accent-light: #e0b85c;
    --teal: #0d7377;
    --blue: #1565c0;
    --bg: #f8f7f4;
    --card: #ffffff;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --border: #e0ddd7;
    --border-light: #f0ede8;
    --success: #2e7d32;
    --error: #c62828;
    --warning: #f57c00;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --radius: 6px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

.top-nav {
    background: var(--primary);
    color: white;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.75rem 0;
    text-decoration: none;
}

.hamburger {
    display: block;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0.5rem;
}

.nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    padding-bottom: 0.5rem;
}

.nav-links.open { display: flex; }

.nav-links a {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 0;
    text-decoration: none;
    font-size: 0.95rem;
}

.nav-links a:hover, .nav-links a.active {
    color: white;
    text-decoration: none;
}

@media (min-width: 768px) {
    .hamburger { display: none; }
    .nav-links {
        display: flex;
        flex-direction: row;
        width: auto;
        gap: 1.5rem;
        margin-left: auto;
        padding-bottom: 0;
    }
    .nav-links a { padding: 0.75rem 0; }
}

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

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

/* ── Page Headers ─────────────────────────────────────── */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.page-header h1 { flex: 1; min-width: 200px; }

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

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

.section-header h2 { margin: 0; }

h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-light); margin-bottom: 1rem; }

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

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; text-decoration: none; }

.btn-primary { background: var(--primary); color: white; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-accent { background: var(--accent); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-large { padding: 0.75rem 2rem; font-size: 1rem; }
.btn-block { display: block; width: 100%; margin-bottom: 0.5rem; }

.btn-link {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem;
    text-decoration: underline;
}

.btn-link.btn-danger { color: var(--error); }

.link-more {
    font-size: 0.85rem;
    color: var(--primary);
}

/* ── Stats ────────────────────────────────────────────── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stats-row.compact { margin-bottom: 1rem; }

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

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

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

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ── Quick Actions ────────────────────────────────────── */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    border-radius: var(--radius);
    color: white;
    text-decoration: none;
    font-weight: 500;
    min-height: 70px;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}

.action-tile:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.tile-primary { background: var(--primary); }
.tile-accent { background: var(--accent); }
.tile-teal { background: var(--teal); }
.tile-blue { background: var(--blue); }
.tile-secondary { background: var(--text-light); }

.tile-icon { font-size: 1.3rem; margin-bottom: 0.25rem; }
.tile-label { font-size: 0.85rem; }

/* ── Cards ────────────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

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

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

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

.card-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

/* ── Info Cards ───────────────────────────────────────── */

.info-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.info-rows { margin-top: 0.75rem; }

.info-row {
    display: flex;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

.info-row:last-child { border-bottom: none; }

.info-label {
    flex: 0 0 120px;
    color: var(--text-light);
    font-weight: 500;
}

.info-value { flex: 1; }

/* ── Detail Layout ────────────────────────────────────── */

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

@media (min-width: 768px) {
    .detail-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.sidebar-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.sidebar-section h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

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

/* ── Tables ───────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--border-light);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-light);
}

.data-table td {
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--border-light);
}

.data-table tr:hover { background: var(--bg); }

.row-total td { font-weight: 600; background: var(--border-light); }
.row-warning td { background: #fff8e1; }

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

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.badge-large { font-size: 0.85rem; padding: 0.25rem 0.75rem; }

.badge-business { background: #e3f2fd; color: #1565c0; }
.badge-person { background: #f3e5f5; color: #7b1fa2; }
.badge-organization { background: #e8f5e9; color: #2e7d32; }
.badge-member { background: #fff8e1; color: #f57c00; }

.badge-visit { background: #e3f2fd; color: #1565c0; }
.badge-call { background: #f3e5f5; color: #7b1fa2; }
.badge-email { background: #e0f2f1; color: #00695c; }
.badge-meeting { background: #fff8e1; color: #f57c00; }
.badge-note { background: #f5f5f5; color: #666; }
.badge-purpose { background: #e8eaf6; color: #283593; }

.badge-status-submitted { background: #fff8e1; color: #f57c00; }
.badge-status-approved { background: #e8f5e9; color: #2e7d32; }
.badge-status-denied { background: #ffebee; color: #c62828; }
.badge-status-inactive { background: #f5f5f5; color: #999; }

.badge-tier-residential { background: #e8f5e9; color: #2e7d32; }
.badge-tier-cra { background: #e3f2fd; color: #1565c0; }
.badge-tier-outside-cra { background: #f3e5f5; color: #7b1fa2; }
.badge-tier-brickless { background: #fff8e1; color: #f57c00; }

.badge-draft { background: #f5f5f5; color: #666; }
.badge-review { background: #fff8e1; color: #f57c00; }
.badge-submitted { background: #e3f2fd; color: #1565c0; }
.badge-accepted { background: #e8f5e9; color: #2e7d32; }

.badge-pass { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff8e1; color: #f57c00; }
.badge-error { background: #ffebee; color: #c62828; }
.badge-overdue { background: #ffebee; color: #c62828; }

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

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

.tag {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    background: var(--border-light);
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ── Interactions ─────────────────────────────────────── */

.interaction-list {
    list-style: none;
}

.interaction-list.compact .interaction-item {
    padding: 0.6rem 0;
}

.interaction-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.interaction-item:last-child { border-bottom: none; }

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

.interaction-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.interaction-topic {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
}

.interaction-body {
    font-size: 0.9rem;
    color: var(--text);
}

.interaction-body p { margin-bottom: 0.25rem; }
.interaction-body ul { padding-left: 1.5rem; }

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

.form-stack {
    max-width: 600px;
}

.form-stack.form-wide {
    max-width: none;
}

.form-stack label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.form-stack label:first-child { margin-top: 0; }

.form-stack input[type="text"],
.form-stack input[type="email"],
.form-stack input[type="tel"],
.form-stack input[type="url"],
.form-stack input[type="date"],
.form-stack input[type="number"],
.form-stack select,
.form-stack textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--card);
    color: var(--text);
}

.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(26, 54, 93, 0.15);
}

.form-stack textarea { resize: vertical; }

.form-stack fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
}

.form-stack legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: var(--text-light);
}

.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-intro {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.checkbox-group {
    margin-top: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    margin-top: 0.5rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
}

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

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

.selected-contact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--border-light);
    border-radius: var(--radius);
}

.inline-form { display: inline; }

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

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

.search-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    background: var(--card);
}

/* ── Flash Messages ───────────────────────────────────── */

.flash-messages { margin-bottom: 1rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.flash-success { background: #e8f5e9; color: #2e7d32; border-left: 3px solid #2e7d32; }
.flash-error { background: #ffebee; color: #c62828; border-left: 3px solid #c62828; }
.flash-warning { background: #fff8e1; color: #f57c00; border-left: 3px solid #f57c00; }

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

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

.alert-list {
    list-style: none;
}

.alert-item {
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--border);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    background: var(--card);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.deadline-alert { border-left-color: var(--warning); }
.overdue-alert { border-left-color: var(--error); }
.renewal-alert { border-left-color: var(--accent); }
.vendor-alert { border-left-color: var(--teal); }

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

.benefit-list { list-style: none; }

.benefit-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.benefit-item.completed { color: var(--success); }

.benefit-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    color: inherit;
}

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

/* ── Status Actions ───────────────────────────────────── */

.status-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-actions { margin-bottom: 0.5rem; }

/* ── Quotes ───────────────────────────────────────────── */

.quote-card {
    background: var(--card);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.quote-card p { font-style: italic; margin-bottom: 0.5rem; }
.quote-card footer { font-size: 0.85rem; color: var(--text-light); }

/* ── Health Check ─────────────────────────────────────── */

.health-check {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.health-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.health-icon { font-size: 1.1rem; }
.health-pass .health-icon { color: var(--success); }
.health-warning .health-icon { color: var(--warning); }
.health-error .health-icon { color: var(--error); }

.health-details {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

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

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

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

/* ── Markdown ─────────────────────────────────────────── */

.markdown-body h1 { font-size: 1.3rem; }
.markdown-body h2 { font-size: 1.1rem; }
.markdown-body h3 { font-size: 1rem; }
.markdown-body p { margin-bottom: 0.5rem; }
.markdown-body ul { padding-left: 1.5rem; margin-bottom: 0.5rem; }
.markdown-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.25rem 0.75rem;
    color: var(--text-light);
    font-style: italic;
    margin: 0.5rem 0;
}

.checklist { list-style: none; padding-left: 0; }
.checklist li { padding: 0.2rem 0; }
.checklist .checked { color: var(--success); }
.checklist .checked::before { content: "✓ "; }
.checklist .unchecked::before { content: "○ "; color: var(--text-muted); }

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

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

.empty-state h1, .empty-state h2 { color: var(--text); }

/* ── Thank You (public) ──────────────────────────────── */

.thank-you {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    margin: 2rem auto;
}

.thank-you h2 { color: var(--success); margin-bottom: 1rem; }
.thank-you p { margin-bottom: 1rem; line-height: 1.6; }

/* ── Public Page ──────────────────────────────────────── */

.public-page { background: var(--bg); }

.public-header {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
}

.public-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.public-header p { opacity: 0.85; }

.public-form {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

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

/* ── Utilities ────────────────────────────────────────── */

.text-muted { color: var(--text-muted); font-size: 0.85rem; }

section { margin-bottom: 1.5rem; }

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

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .data-table {
        font-size: 0.8rem;
    }
    .data-table th, .data-table td {
        padding: 0.4rem 0.5rem;
    }
}
