/* ═══════════════════════════════════════════════════
   CINEMATIC MAP OVERLAY - REFINED BLENDED EDITION
   ═══════════════════════════════════════════════════ */

:root {
    --cin-bg-dark: rgba(15, 23, 42, 1);
    --cin-bg-fade: rgba(15, 23, 42, 0.95);
    --cin-accent: #6366F1;
    --cin-accent-glow: rgba(99, 102, 241, 0.3);
    --cin-text-primary: #f0f0f5;
    --cin-text-secondary: #8891a5;
    --cin-text-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --cin-text-display: 'Plus Jakarta Sans', sans-serif;
    --cin-text-body: 'Inter', sans-serif;
    --cin-spring: cubic-bezier(0.22, 1, 0.36, 1);
    --cin-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

.cinematic-overlay-container {
    position: absolute; /* In-map bounded */
    inset: 0;
    z-index: 1000; /* Above Leaflet controls */
    overflow: hidden;
    font-family: var(--cin-text-body);
    color: var(--cin-text-primary);
    pointer-events: none;
    visibility: hidden;
}

.cinematic-overlay-container.active {
    pointer-events: auto;
    visibility: visible;
}

/* ── The Blended Panel ── */
.blended-right-panel {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 60%; /* Takes right half */
    background: linear-gradient(to right, transparent 0%, var(--cin-bg-fade) 20%, var(--cin-bg-dark) 100%);
    display: flex;
    justify-content: flex-end;
    transform: translateX(100%);
    opacity: 0;
    transition: all 500ms var(--cin-spring);
}

.cinematic-overlay-container.active .blended-right-panel {
    transform: translateX(0);
    opacity: 1;
}

.cinematic-overlay-container.exiting .blended-right-panel {
    transform: translateX(100%);
    opacity: 0;
}

.blended-gradient-fade {
    position: absolute;
    inset: 0;
    left: -50vw; /* Clickable dismissal area over the map */
    z-index: 0;
}

.profile-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 450px;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

/* ── Profile Header & Avatar ── */
.profile-banner {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, transparent 100%), 
                url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="dots" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle fill="rgba(255,255,255,0.05)" cx="2" cy="2" r="1"></circle></pattern></defs><rect width="100%" height="100%" fill="url(%23dots)"></rect></svg>');
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.profile-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin-top: -50px;
    margin-left: 30px;
    margin-bottom: 15px;
    z-index: 5;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--cin-bg-dark);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    background: var(--cin-bg-dark);
}

.status-dot-avatar {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    background: #10B981;
    border-radius: 50%;
    border: 3px solid var(--cin-bg-dark);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* ── Profile Details ── */
.profile-details-section {
    padding: 0 20px 20px 20px;
    position: relative;
    z-index: 5;
}

.profile-name {
    font-family: var(--cin-text-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.profile-specialty, .profile-address {
    font-size: 0.75rem;
    color: var(--cin-text-secondary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
}

.profile-specialty { color: var(--cin-accent); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }

.grade-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #FBBF24;
    margin: 0.5rem 0 1rem 0;
}

/* ── Metrics ── */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.05);
}

.metric-value { font-size: 1.1rem; font-weight: 700; font-family: var(--cin-text-mono); }
.metric-label { font-size: 0.6rem; text-transform: uppercase; color: var(--cin-text-secondary); letter-spacing: 1px; }

/* ── ETA Module ── */
.eta-module {
    background: rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,0.03);
}

.eta-time { font-family: var(--cin-text-mono); font-size: 2rem; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
.eta-ampm { font-size: 1rem; color: var(--cin-text-secondary); }
.eta-label { font-size: 0.85rem; color: var(--cin-accent); font-weight: 500; display: flex; align-items: center; gap: 6px; }

/* ── Actions ── */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.btn-cinematic {
    flex: 1 1 auto;
    padding: 0.6rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-width: 120px;
}

.btn-primary { background: var(--cin-accent); color: white; box-shadow: 0 4px 12px var(--cin-accent-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 16px var(--cin-accent-glow); }
.btn-secondary { background: rgba(255,255,255,0.1); color: white; }
.btn-secondary:hover { background: rgba(255,255,255,0.15); }
.btn-ghost { background: transparent; color: var(--cin-text-secondary); border: 1px solid rgba(255,255,255,0.1); }
.btn-ghost:hover { color: white; border-color: rgba(255,255,255,0.3); }

/* ── Content Stagger ── */
.content-stagger-item { opacity: 0; transform: translateY(16px); }
.cinematic-overlay-container.active .content-stagger-item {
    animation: fadeSlideUp 350ms ease-out forwards;
    animation-delay: calc(300ms + (var(--stagger-index) * 80ms));
}

@keyframes fadeSlideUp {
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
    .blended-right-panel { width: 100%; background: var(--cin-bg-dark); }
}

/* ── User Location Pulse ── */
.user-location-icon { background: none !important; border: none !important; }

.user-location-pulse {
    position: relative;
    width: 24px;
    height: 24px;
}

.user-location-dot {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    background: #4285F4;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.6);
    z-index: 2;
}

.user-location-ring {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(66, 133, 244, 0.2);
    border: 2px solid rgba(66, 133, 244, 0.4);
    animation: userPulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes userPulse {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
