/* RoadToKumbh Portal Styles */
:root {
    --primary: #e8590c;
    --primary-dark: #d9480f;
    --primary-light: #fff4e6;
    --secondary: #1864ab;
    --accent: #fcc419;
    --bg: #f8f9fa;
    --card-bg: #ffffff;
    --text: #212529;
    --text-muted: #868e96;
    --border: #dee2e6;
    --success: #2b8a3e;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ─── Navbar ─── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary);
}

.logo { font-size: 1.6rem; }

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover { color: var(--primary); }

.nav-ai {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    padding: 0.4rem 1rem;
    border-radius: 20px;
}

/* ─── Hero ─── */
.hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #fff;
    padding: 5rem 2rem 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(232,89,12,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }

.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero .accent { color: var(--accent); }

.hero-sub {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.stat { text-align: center; }
.stat-num {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}
.stat-label {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ─── Buttons ─── */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}

.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(232,89,12,0.35); }

.btn-secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover { background: rgba(255,255,255,0.25); }

.btn-block { width: 100%; justify-content: center; }

/* ─── Sections ─── */
.section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.section h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-sub {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ─── Persona ─── */
.persona-section { background: #fff; border-bottom: 1px solid var(--border); }

.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.persona-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.persona-card:hover, .persona-card.active {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.persona-card .emoji { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.persona-card .name { font-weight: 600; font-size: 0.8rem; }

/* ─── Cards ─── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

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

/* ─── Plan Result ─── */
.plan-card-result {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-top: 1rem;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.plan-hero {
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    color: #fff;
    margin-bottom: 1.5rem;
    text-align: center;
}

.plan-hero-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.plan-hero-city {
    font-size: 1.4rem;
    font-weight: 800;
}

.plan-hero-arrow {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    max-width: 200px;
}

.plan-hero-line {
    flex: 1;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    border-radius: 2px;
}

.plan-hero-bike {
    font-size: 1.6rem;
    animation: bikeBounce 1.2s ease infinite;
}

@keyframes bikeBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.plan-hero-quote {
    font-size: 0.9rem;
    font-style: italic;
    color: rgba(255,255,255,0.8);
}

/* ─── Journey Visual ─── */
.journey-visual {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 1rem 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.journey-start, .journey-end {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    min-width: 60px;
}

.journey-segment {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.journey-connector {
    width: 24px;
    height: 3px;
    background: linear-gradient(90deg, var(--border), var(--primary));
    border-radius: 2px;
    margin-top: 18px;
}

.journey-stop {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    min-width: 70px;
}

.journey-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--primary-light);
    border: 2px solid var(--primary);
    margin-bottom: 0.3rem;
}

.journey-stop-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.journey-stop-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.plan-narrative-md {
    background: linear-gradient(135deg, #fff9db, #fff3bf);
    border-left: 4px solid var(--accent);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    color: #5c4800;
}

.plan-narrative-md .md-h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0.8rem 0 0.4rem;
}

.plan-narrative-md .md-h3:first-child { margin-top: 0; }

.plan-narrative-md .md-p {
    margin: 0.4rem 0;
    line-height: 1.6;
}

.plan-narrative-md .md-list {
    margin: 0.5rem 0 0.5rem 1.2rem;
    padding: 0;
}

.plan-narrative-md .md-list li {
    margin: 0.3rem 0;
    line-height: 1.5;
}

.plan-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
}

.plan-stat {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.plan-stat-num {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.plan-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── Route Cards ─── */
.route-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.route-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

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

.route-title { font-weight: 700; font-size: 1.05rem; color: var(--text); flex: 1; }

.route-badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    margin-left: 0.5rem;
    white-space: nowrap;
}

.route-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.route-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.route-bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 80px;
    flex-shrink: 0;
}

.route-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}

.route-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.route-bar-val {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 24px;
    text-align: right;
}

.route-footer {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    align-items: center;
}

.route-explore {
    margin-left: auto;
    font-weight: 700;
    color: var(--primary);
    transition: transform 0.2s;
}

.route-card:hover .route-explore {
    transform: translateX(4px);
}

/* ─── Service Cards ─── */
.service-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: transform 0.2s;
}

.service-card:hover { transform: translateY(-2px); }

.service-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.service-body { flex: 1; }

.service-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.25rem; }

.service-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; }

.service-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.tag {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: capitalize;
}

.service-extras { margin-top: 0.4rem; font-size: 0.8rem; }

.extra { margin-right: 0.5rem; }

/* ─── Extension Cards ─── */
.extension-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 1.25rem;
    transition: transform 0.2s;
    border-top: 3px solid var(--secondary);
}

.extension-card:hover { transform: translateY(-3px); }

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

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

.ext-type {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.ext-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.ext-narrative-md {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
}

.ext-narrative-md .md-h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0.6rem 0 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ext-narrative-md .md-h3:first-child { margin-top: 0; }

.ext-narrative-md .md-list {
    margin: 0.3rem 0 0.3rem 1.2rem;
    padding: 0;
}

.ext-narrative-md .md-list li {
    margin: 0.2rem 0;
    color: var(--text-muted);
}

.ext-thumbs {
    position: relative;
    margin-top: 0.75rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    height: 160px;
}

.ext-thumb-main {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ext-thumb-count {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.ext-gallery {
    margin-top: 0.75rem;
    animation: fadeInUp 0.3s ease;
}

.ext-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.ext-gallery-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s;
}

.ext-gallery-img:hover {
    transform: scale(1.03);
}

/* ─── Lightbox ─── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox.active { display: flex; }

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
}

.lightbox img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 24px 48px rgba(0,0,0,0.4);
}

.lightbox-caption {
    margin-top: 0.75rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
}

/* ─── Group Cards ─── */
.group-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.2s;
    cursor: pointer;
}

.group-card:hover { transform: translateY(-3px); }

.group-cover {
    height: 140px;
    overflow: hidden;
}

.group-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.group-card:hover .group-cover img {
    transform: scale(1.05);
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem 0.5rem;
}

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

.group-privacy {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.group-privacy.public { background: #ebfbee; color: #2b8a3e; }
.group-privacy.private { background: #fff5f5; color: #c92a2a; }
.group-privacy.invite_only { background: #fff9db; color: #e67700; }

.group-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 1.25rem;
    margin-bottom: 0.5rem;
}

.group-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0 1.25rem;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.group-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem 1rem;
    font-size: 0.8rem;
}

.group-planned { color: var(--text-muted); }

.group-explore {
    font-weight: 700;
    color: var(--primary);
    transition: transform 0.2s;
}

.group-card:hover .group-explore {
    transform: translateX(4px);
}

/* ─── Group Modal ─── */
.group-modal-content {
    max-width: 700px;
}

.group-modal-scroll {
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.group-modal-cover {
    height: 200px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.group-modal-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-modal-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 1rem;
}

.group-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.group-modal-section-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.group-avatar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

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

.group-ride-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.group-ride-title {
    font-weight: 700;
    font-size: 0.9rem;
}

.group-ride-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.group-ride-join {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.group-ride-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* ─── Forms ─── */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: #fff;
    transition: border-color 0.2s;
}

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

/* ─── Filter Bar ─── */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-bar select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    font-size: 0.9rem;
}

/* ─── Tabs ─── */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    padding: 0.5rem 1.2rem;
    border: none;
    background: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.tab-btn.active, .tab-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ─── Plan Result ─── */
.plan-result { margin-top: 1.5rem; display: none; }
.plan-result.visible { display: block; }

/* ─── Chat ─── */
.chat-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    max-width: 800px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f8f9fa;
}

.chat-msg {
    display: flex;
    margin-bottom: 1rem;
}

.chat-msg.bot { justify-content: flex-start; }
.chat-msg.user { justify-content: flex-end; }

.chat-bubble {
    max-width: 75%;
    padding: 0.9rem 1.2rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.chat-msg.bot .chat-bubble {
    background: #fff;
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-msg.bot .chat-bubble .md-h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.6rem 0 0.3rem;
}

.chat-msg.bot .chat-bubble .md-h3:first-child { margin-top: 0; }

.chat-msg.bot .chat-bubble .md-list {
    margin: 0.3rem 0 0.3rem 1.2rem;
    padding: 0;
}

.chat-msg.bot .chat-bubble .md-list li {
    margin: 0.25rem 0;
}

.chat-msg.user .chat-bubble {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-input-row {
    display: flex;
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: #fff;
    gap: 0.75rem;
}

.chat-input-row input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

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

/* ─── Modal ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active { display: flex; }

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.5);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover { background: rgba(0,0,0,0.7); }

.modal-layout {
    display: flex;
    height: 90vh;
    max-height: 800px;
}

.modal-map-wrap {
    flex: 1.4;
    min-width: 0;
    position: relative;
}

#route-map {
    width: 100%;
    height: 100%;
    background: #e9ecef;
}

.modal-sidebar {
    flex: 1;
    min-width: 320px;
    max-width: 420px;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    background: #fff;
}

.modal-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.modal-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

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

.modal-stat {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.modal-stat-num {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
}

.modal-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-section-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.modal-spots {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-spot {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.modal-spot:hover {
    background: #fff;
    border-color: var(--border);
    box-shadow: var(--shadow);
    transform: translateX(4px);
}

.modal-spot-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
    border: 2px solid;
}

.modal-spot-body { flex: 1; min-width: 0; }

.modal-spot-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.1rem;
}

.modal-spot-type {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.modal-spot-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Leaflet Custom Markers ─── */
.custom-marker { background: none !important; border: none !important; }

.marker-pin {
    width: 36px;
    height: 36px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    transition: transform 0.2s;
}

.marker-pin:hover {
    transform: rotate(-45deg) scale(1.15);
}

/* ─── Spot Popup ─── */
.spot-popup .leaflet-popup-content-wrapper {
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 0;
    overflow: hidden;
}

.spot-popup .leaflet-popup-content {
    margin: 0;
    width: 300px !important;
}

.spot-popup .leaflet-popup-tip {
    background: #fff;
}

.spot-popup-card {
    background: #fff;
}

.spot-popup-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.95rem;
}

.spot-popup-icon { font-size: 1.1rem; }

.spot-popup-body {
    padding: 0.75rem 1rem 1rem;
}

.spot-popup-type {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.spot-popup-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.spot-popup-significance {
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

/* ─── Loading ─── */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Footer ─── */
.footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
}

.footer-sub {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    margin-top: 0.5rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .nav-links { display: none; }
    .hero-actions { flex-direction: column; }
    .card-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .hero-stats { gap: 1.5rem; }
    .plan-stats-row { grid-template-columns: repeat(2, 1fr); }
    .journey-visual { gap: 0.25rem; }
    .journey-connector { width: 12px; }

    .modal-layout { flex-direction: column; }
    .modal-map-wrap { flex: none; height: 50vh; }
    .modal-sidebar { max-width: none; min-width: auto; border-left: none; border-top: 1px solid var(--border); }

    .ext-gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .group-ride-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
