@import url("ds-tokens.css");

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

body {
    font-family: var(--ds-font);
    background-color: var(--ds-surface-muted);
    color: var(--ds-text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.header {
    background: white;
    border-bottom: 1px solid #ddd;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--ds-accent);
}

.header-title {
    font-size: 1.1em;
    color: #666;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.btn-header {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
}

.btn-header:hover {
    background: #f5f5f5;
}

/* MAIN LAYOUT */
.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* SIDEBAR FILTROS */
.sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid #ddd;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}

.sidebar h3 {
    font-size: 1.1em;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #f44242;
    padding-bottom: 10px;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group label {
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.filter-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9em;
    background: white;
    color: #333;
}

.filter-group input[type="radio"] {
    margin-right: 8px;
}

.filter-group .radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group .radio-option {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.muestra-info {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 0.85em;
    color: #666;
    border-left: 3px solid #f44242;
}

/* CONTENT AREA */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f5f5f5;
}

/* KPIs SECTION */
.kpis-section {
    background: white;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.kpis-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.kpi-card {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    text-align: center;
}

.kpi-value {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 5px;
}

.kpi-value.orange { color: #ff6b35; }
.kpi-value.blue { color: #1e88e5; }
.kpi-value.green { color: #43a047; }
.kpi-value.red { color: #f44242; }

.kpi-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 500;
    margin-bottom: 5px;
}

.kpi-subtitle {
    font-size: 0.75em;
    color: #999;
}

/* MAP AND CHART SECTION */
.visualization-section {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

.map-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.map-container h4 {
    padding: 15px;
    border-bottom: 1px solid #ddd;
    font-size: 1em;
    color: #333;
    background: #f9f9f9;
}

#map {
    height: calc(100% - 50px);
    width: 100%;
}

.map-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: white;
    padding: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85em;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.chart-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    overflow-y: auto;
}

.chart-container h4 {
    font-size: 1em;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.chart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.chart-bar {
    height: 30px;
    background: #ff6b35;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: white;
    font-size: 0.85em;
    font-weight: 600;
    min-width: 50px;
}

.chart-label {
    flex: 1;
    font-size: 0.9em;
    color: #333;
}

.loading-muted {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 0.9em;
}

.loading-skeleton {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    width: 100%;
}

.skeleton {
    display: block;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        #ececec 0%,
        #f5f5f5 50%,
        #ececec 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.kpi-skeleton {
    height: 88px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.btn-header:focus-visible,
.filter-group select:focus-visible,
.filter-group input:focus-visible {
    outline: 2px solid #f44242;
    outline-offset: 2px;
}

.kpi-card {
    transition: border-color 0.2s ease, transform 0.15s ease;
}

.kpi-card:hover {
    border-color: #f44242;
    transform: translateY(-1px);
}
