/* ===================================================================
   Pontos de Memória — Public Dashboard & Cluster Map
   =================================================================== */

/* ── Indicators Dashboard ──────────────────────────────────────── */

.pdm-indicators {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.pdm-indicators-header {
    text-align: center;
    margin-bottom: 28px;
}

.pdm-indicators-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--pdm-text, #1e293b);
    margin: 0 0 8px;
}

.pdm-indicators-subtitle {
    font-size: 15px;
    color: var(--pdm-text-light, #64748b);
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ── Filters ───────────────────────────────────────────────────── */

.pdm-indicators-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: var(--pdm-card-bg, #fff);
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: var(--pdm-radius, 8px);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.pdm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
    flex: 1;
}

.pdm-filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--pdm-text-light, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pdm-filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
    color: var(--pdm-text, #1e293b);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.pdm-filter-group select:focus {
    outline: none;
    border-color: var(--pdm-primary, #1a4480);
    box-shadow: 0 0 0 3px rgba(26, 68, 128, 0.1);
}

.pdm-filter-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pdm-filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-bottom: 1px;
}

/* ── Loading ───────────────────────────────────────────────────── */

.pdm-indicators-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 0;
    color: var(--pdm-text-light, #64748b);
    font-size: 15px;
}

.pdm-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--pdm-border, #e2e8f0);
    border-top-color: var(--pdm-primary, #1a4480);
    border-radius: 50%;
    animation: pdm-spin 0.7s linear infinite;
}

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

/* ── Section Tabs ──────────────────────────────────────────────── */

.pdm-ind-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--pdm-card-bg, #fff);
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: var(--pdm-radius, 8px);
    padding: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.pdm-ind-tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--pdm-text-light, #64748b);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.pdm-ind-tab:hover {
    color: var(--pdm-primary, #1a4480);
    background: var(--pdm-primary-bg, #e8f4fd);
}

.pdm-ind-tab.active {
    color: #fff;
    background: var(--pdm-primary, #1a4480);
    box-shadow: 0 1px 3px rgba(26, 68, 128, 0.3);
}

.pdm-ind-section {
    display: none;
}

.pdm-ind-section.active {
    display: block;
    animation: pdm-card-appear 0.25s ease;
}

/* ── Chart Grid ────────────────────────────────────────────────── */

.pdm-indicators-charts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 24px;
}

.pdm-chart-card {
    background: var(--pdm-card-bg, #fff);
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: var(--pdm-radius, 8px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    animation: pdm-card-appear 0.3s ease;
}

.pdm-chart-card--full {
    grid-column: 1 / -1;
}

.pdm-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 0;
}

.pdm-chart-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--pdm-text, #1e293b);
}

.pdm-chart-body {
    padding: 16px 20px 20px;
    position: relative;
    height: 280px;
}

.pdm-chart-body--tall {
    height: 360px;
}

.pdm-chart-body canvas {
    max-width: 100%;
}

/* ── Help button ───────────────────────────────────────────────── */

.pdm-help-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid var(--pdm-border, #e2e8f0);
    background: var(--pdm-card-bg, #fff);
    color: var(--pdm-text-light, #64748b);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.pdm-help-btn:hover {
    background: var(--pdm-primary, #1a4480);
    border-color: var(--pdm-primary, #1a4480);
    color: #fff;
}

/* ── Empty state ───────────────────────────────────────────────── */

.pdm-chart-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--pdm-text-light, #64748b);
    font-size: 14px;
    font-style: italic;
}

/* ===================================================================
   Cluster Map
   =================================================================== */

.pdm-cluster-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.pdm-cluster-header {
    text-align: center;
    margin-bottom: 20px;
}

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

.pdm-cluster-stats {
    text-align: center;
    padding: 12px 20px;
    background: var(--pdm-primary-bg, #e8f4fd);
    border-radius: var(--pdm-radius, 8px);
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--pdm-primary, #1a4480);
}

.pdm-cluster-stats span {
    font-weight: 700;
}

/* ── Legend ─────────────────────────────────────────────────────── */

.pdm-cluster-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--pdm-text-light, #64748b);
}

.pdm-cluster-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pdm-cluster-legend-dot {
    border-radius: 50%;
    display: inline-block;
}

.pdm-cluster-legend-dot--sm {
    width: 14px;
    height: 14px;
    background: rgba(26, 68, 128, 0.6);
}

.pdm-cluster-legend-dot--md {
    width: 18px;
    height: 18px;
    background: rgba(217, 119, 6, 0.7);
}

.pdm-cluster-legend-dot--lg {
    width: 22px;
    height: 22px;
    background: rgba(220, 38, 38, 0.7);
}

/* ── MarkerCluster overrides ───────────────────────────────────── */

.marker-cluster-small {
    background-color: rgba(26, 68, 128, 0.25) !important;
}

.marker-cluster-small div {
    background-color: rgba(26, 68, 128, 0.6) !important;
    color: #fff !important;
    font-weight: 600;
}

.marker-cluster-medium {
    background-color: rgba(217, 119, 6, 0.3) !important;
}

.marker-cluster-medium div {
    background-color: rgba(217, 119, 6, 0.7) !important;
    color: #fff !important;
    font-weight: 600;
}

.marker-cluster-large {
    background-color: rgba(220, 38, 38, 0.3) !important;
}

.marker-cluster-large div {
    background-color: rgba(220, 38, 38, 0.7) !important;
    color: #fff !important;
    font-weight: 600;
}

/* ── Cluster modal ─────────────────────────────────────────────── */

.pdm-cluster-search {
    margin-bottom: 12px;
}

.pdm-cluster-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.pdm-cluster-search input:focus {
    outline: none;
    border-color: var(--pdm-primary, #1a4480);
    box-shadow: 0 0 0 3px rgba(26, 68, 128, 0.1);
}

.pdm-cluster-list {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: 6px;
}

.pdm-cluster-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--pdm-border, #e2e8f0);
    transition: background 0.15s;
    min-height: 44px;
}

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

.pdm-cluster-item:hover {
    background: #f8fafc;
}

.pdm-cluster-item-info {
    flex: 1;
    min-width: 0;
}

.pdm-cluster-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--pdm-primary, #1a4480);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pdm-cluster-item-name:hover {
    text-decoration: underline;
}

.pdm-cluster-item-location {
    font-size: 12px;
    color: var(--pdm-text-light, #64748b);
    margin-top: 2px;
}

.pdm-cluster-item-arrow {
    color: var(--pdm-text-light, #64748b);
    font-size: 18px;
    margin-left: 12px;
    flex-shrink: 0;
}

/* ── Pagination ────────────────────────────────────────────────── */

.pdm-cluster-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
}

.pdm-cluster-pagination button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: 6px;
    background: #fff;
    color: var(--pdm-text, #1e293b);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.pdm-cluster-pagination button:hover {
    background: var(--pdm-primary-bg, #e8f4fd);
    border-color: var(--pdm-primary, #1a4480);
}

.pdm-cluster-pagination button.active {
    background: var(--pdm-primary, #1a4480);
    border-color: var(--pdm-primary, #1a4480);
    color: #fff;
}

.pdm-cluster-modal-count {
    text-align: center;
    font-size: 12px;
    color: var(--pdm-text-light, #64748b);
    margin-top: 8px;
}

/* ── Screen reader only ────────────────────────────────────────── */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Pontos List ───────────────────────────────────────────────── */

.pdm-pontos-list-section {
    margin-top: 32px;
    background: var(--pdm-card-bg, #fff);
    border: 1px solid var(--pdm-border, #e2e8f0);
    border-radius: var(--pdm-radius, 8px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.pdm-pontos-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pdm-border, #e2e8f0);
}

.pdm-pontos-list-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--pdm-text, #1e293b);
}

.pdm-export-buttons {
    display: flex;
    gap: 8px;
}

.pdm-pontos-list-table-wrap {
    overflow-x: auto;
}

.pdm-pontos-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pdm-pontos-list-table thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--pdm-text-light, #64748b);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--pdm-border, #e2e8f0);
    white-space: nowrap;
}

.pdm-pontos-list-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--pdm-border, #e2e8f0);
    color: var(--pdm-text, #1e293b);
}

.pdm-pontos-list-table tbody tr:last-child td {
    border-bottom: none;
}

.pdm-pontos-list-table tbody tr:hover {
    background: #f8fafc;
}

.pdm-pontos-list-table .pdm-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.pdm-status-badge--certificado { background: #ecfdf5; color: #065f46; }
.pdm-status-badge--reprovado   { background: #fef2f2; color: #991b1b; }
.pdm-status-badge--avaliacao   { background: #e8f4fd; color: #1a4480; }
.pdm-status-badge--pendente    { background: #fffbeb; color: #92400e; }

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

@media (max-width: 768px) {
    .pdm-indicators-title {
        font-size: 20px;
    }

    .pdm-indicators-filters {
        flex-direction: column;
    }

    .pdm-filter-group {
        min-width: 100%;
    }

    .pdm-filter-actions {
        width: 100%;
        justify-content: stretch;
    }

    .pdm-filter-actions .pdm-btn {
        flex: 1;
    }

    .pdm-indicators-charts {
        grid-template-columns: 1fr;
    }

    .pdm-chart-body {
        height: 240px;
    }

    .pdm-chart-body--tall {
        height: 300px;
    }

    #pdm-cluster-map {
        height: 400px !important;
    }

    .pdm-cluster-legend {
        gap: 14px;
        font-size: 12px;
    }

    .pdm-pontos-list-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .pdm-ind-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .pdm-cluster-list {
        max-height: 320px;
    }
}
