/* ============================================================
   CDD State Map — Dark Professional Styles
   v1.0.0
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.cdd-state-map-wrapper {
    position: relative;
    background: #0f1117;
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    color: #e2e8f0;
}

/* ── Header ──────────────────────────────────────────────── */
.cdd-map-header {
    padding: 32px 32px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cdd-map-title {
    margin: 0 0 8px;
    font-size: 1.6rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.25;
}

.cdd-map-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: #94a3b8;
}

/* ── Canvas ──────────────────────────────────────────────── */
.cdd-map-canvas {
    position: relative;
    width: 100%;
    background: #0f1117;
    transition: height 0.4s ease;
}

.cdd-map-canvas svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── States ──────────────────────────────────────────────── */
.cdd-state-path {
    stroke: #1e2533;
    stroke-width: 0.8;
    cursor: pointer;
    transition: filter 0.15s ease, opacity 0.15s ease;
}

.cdd-state-path:hover {
    filter: brightness(1.3) drop-shadow(0 0 6px rgba(37, 99, 235, 0.6));
    opacity: 0.95;
}

.cdd-state-path.cdd-state-active {
    filter: brightness(1.5) drop-shadow(0 0 10px rgba(37, 99, 235, 0.8));
    stroke: #60a5fa;
    stroke-width: 1.5;
}

.cdd-state-path.cdd-state-no-listings {
    cursor: default;
}

.cdd-state-path.cdd-state-no-listings:hover {
    filter: brightness(1.1);
}

/* ── State count badges ──────────────────────────────────── */
.cdd-state-badge {
    pointer-events: none;
    font-size: 9px;
    font-weight: 700;
    fill: #f1f5f9;
    text-anchor: middle;
    dominant-baseline: central;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    letter-spacing: 0.3px;
}

.cdd-state-label {
    pointer-events: none;
    font-size: 7px;
    font-weight: 500;
    fill: rgba(255,255,255,0.5);
    text-anchor: middle;
    dominant-baseline: central;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Tooltip ─────────────────────────────────────────────── */
.cdd-map-tooltip {
    position: fixed;
    padding: 8px 12px;
    background: #1e293b;
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: 6px;
    font-size: 0.78rem;
    color: #e2e8f0;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.cdd-map-tooltip.cdd-tooltip-visible {
    opacity: 1;
    transform: translateY(0);
}

.cdd-map-tooltip strong {
    display: block;
    color: #f1f5f9;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.cdd-map-tooltip .cdd-tt-count {
    color: #60a5fa;
}

/* ── Loading spinner ─────────────────────────────────────── */
.cdd-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #0f1117;
    z-index: 10;
    color: #64748b;
    font-size: 0.85rem;
}

.cdd-map-loading p { margin: 0; }

.cdd-map-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(96, 165, 250, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: cdd-spin 0.8s linear infinite;
}

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

/* ── Side panel (attorney list) ──────────────────────────── */
.cdd-map-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    background: #131924;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.cdd-map-panel.cdd-panel-open {
    transform: translateX(0);
}

.cdd-panel-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    background: #131924;
    z-index: 1;
}

.cdd-panel-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: #60a5fa;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-bottom: 8px;
    letter-spacing: 0.3px;
    transition: color 0.15s;
}

.cdd-panel-back:hover { color: #93c5fd; }

.cdd-panel-state-name {
    margin: 0 0 4px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #f1f5f9;
}

.cdd-panel-count {
    font-size: 0.78rem;
    color: #94a3b8;
}

.cdd-panel-list {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Attorney card ───────────────────────────────────────── */
.cdd-attorney-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.15s, background 0.15s;
}

.cdd-attorney-card:hover {
    border-color: rgba(96, 165, 250, 0.3);
    background: #243044;
}

.cdd-card-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cdd-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: #334155;
    flex-shrink: 0;
}

.cdd-card-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e40af, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #bfdbfe;
    font-size: 1rem;
    font-weight: 700;
}

.cdd-card-info { flex: 1; min-width: 0; }

.cdd-card-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cdd-card-firm {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cdd-card-location {
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cdd-card-location svg { flex-shrink: 0; }

.cdd-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

/* ── Tier badge ──────────────────────────────────────────── */
.cdd-tier-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
}

.cdd-tier-standard {
    background: rgba(71, 85, 105, 0.4);
    color: #94a3b8;
    border: 1px solid rgba(71, 85, 105, 0.5);
}

.cdd-tier-premium {
    background: rgba(30, 64, 175, 0.3);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.cdd-tier-elite {
    background: rgba(120, 53, 15, 0.4);
    color: #fcd34d;
    border: 1px solid rgba(217, 119, 6, 0.5);
}

/* ── View Profile button ─────────────────────────────────── */
.cdd-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #fff;
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
}

.cdd-card-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Empty state ─────────────────────────────────────────── */
.cdd-panel-empty {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

.cdd-panel-empty svg {
    opacity: 0.4;
    margin-bottom: 12px;
}

.cdd-panel-empty p {
    margin: 0 0 16px;
    font-size: 0.85rem;
}

.cdd-panel-empty a {
    color: #60a5fa;
    font-size: 0.8rem;
}

/* ── Panel loading state ─────────────────────────────────── */
.cdd-panel-loading {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
}

/* ── Map attribution ─────────────────────────────────────── */
.cdd-map-attr {
    padding: 8px 16px;
    text-align: right;
    font-size: 0.65rem;
    color: #334155;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .cdd-map-header {
        padding: 20px 16px 12px;
    }

    .cdd-map-title {
        font-size: 1.2rem;
    }

    .cdd-map-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        border-left: none;
        transform: translateY(100%);
    }

    .cdd-map-panel.cdd-panel-open {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .cdd-map-canvas {
        height: 320px !important;
    }
}
