/* Content Map — frontend styles */

/* --- Filter bar --- */

.cmap-map-wrapper {
    position: relative;
}

.cmap-filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cmap-filter-bar select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    min-width: 160px;
}

.cmap-filter-bar select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.cmap-filter-bar select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- Map container --- */

.cmap-map {
    width: 100%;
    min-height: 300px;
    background: #e8ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
    /* border-radius and box-shadow can be overridden by inline styles from settings. */
}

/* --- Modal overlay --- */

.cmap-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 25, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: cmap-fade-in 120ms ease-out;
}

@keyframes cmap-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cmap-modal-card {
    background: #fff;
    color: #1a1a1a;
    border-radius: 8px;
    max-width: 720px;
    width: 100%;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: cmap-slide-up 180ms ease-out;
}

@keyframes cmap-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.cmap-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    gap: 16px;
}

.cmap-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}

.cmap-modal-close {
    background: none;
    border: 0;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.cmap-modal-close:hover,
.cmap-modal-close:focus {
    background: #f3f4f6;
    color: #111827;
    outline: none;
}

.cmap-modal-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    flex: 1;
}

.cmap-modal-meta {
    margin: 0 0 8px;
    font-size: 13px;
    color: #6b7280;
}

.cmap-modal-description {
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.55;
}

.cmap-modal-description p:first-child { margin-top: 0; }
.cmap-modal-description p:last-child  { margin-bottom: 0; }

.cmap-modal-empty {
    color: #6b7280;
    font-style: italic;
}

/* --- Post card grid (replaces video player in modal) --- */

.cmap-post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.cmap-post-card {
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.cmap-post-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.cmap-post-card-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

.cmap-post-card-info {
    padding: 8px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cmap-post-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #1a1a1a;
}

.cmap-post-card-excerpt {
    font-size: 12px;
    line-height: 1.4;
    color: #6b7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cmap-post-card-date {
    font-size: 11px;
    color: #9ca3af;
}

/* --- Video player (rendered by Channel Publisher bridge) --- */

.cmap-modal-player {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

@supports not (aspect-ratio: 16 / 9) {
    .cmap-modal-player {
        padding-top: 56.25%;
        height: 0;
    }
    .cmap-modal-player iframe {
        position: absolute;
        inset: 0;
    }
}

.cmap-modal-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* --- Video tab strip (multi-video locations) --- */

.cmap-video-tabs {
    padding: 4px 0 2px;
}

.cmap-tab-group-heading {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    padding: 8px 0 4px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 8px;
}

.cmap-tab-group-heading:first-child {
    padding-top: 0;
}

.cmap-tab-group-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
    margin-bottom: 8px;
}

.cmap-tab-group-row:last-child {
    margin-bottom: 0;
}

.cmap-video-tab {
    flex: 0 0 auto;
    width: 140px;
    padding: 0;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    transition: border-color 120ms ease, transform 120ms ease;
}

.cmap-video-tab:hover {
    transform: translateY(-1px);
}

.cmap-video-tab.is-active {
    border-color: #2563eb;
}

.cmap-video-tab img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.cmap-video-tab-label {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    color: #374151;
    padding: 2px 4px 6px;
}

/* --- Region aggregate markers --- */

.cmap-region-marker {
    background: none !important;
    border: none !important;
}

.cmap-region-marker-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0d9488;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: transform 120ms ease;
}

.cmap-region-marker-inner:hover {
    transform: scale(1.15);
}

/* --- Region modal — location headings --- */

.cmap-region-location-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #0d9488;
    padding: 10px 0 4px;
    border-bottom: 2px solid #0d9488;
    margin-bottom: 8px;
}

.cmap-region-location-heading:first-child {
    padding-top: 0;
}

/* --- Mobile --- */

@media (max-width: 520px) {
    .cmap-filter-bar select { width: 100%; min-width: 0; }
    .cmap-modal-overlay  { padding: 0; }
    .cmap-modal-card     { border-radius: 0; max-height: 100vh; height: 100vh; }
    .cmap-modal-title    { font-size: 16px; }
    .cmap-post-grid      { grid-template-columns: 1fr; }
    .cmap-video-tab      { width: 110px; }
}
