:root {
    --primary: #2ecc71;
    --primary-light: #a8e6cf;
    --secondary: #3498db;
    --accent: #e74c3c;
    --background: #f5f7fa;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --card-bg: #ffffff;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --gradient-start: #2ecc71;
    --gradient-end: #3498db;
    --success: #27ae60;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --sidebar-width: 280px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
}

/* Layout Principal */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: var(--gradient-end);
    transform: scale(1.05);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item {
    padding: 0.75rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.menu-item:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: translateX(5px);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    transition: margin-left 0.3s ease;
}

/* Header Styles */
.header {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    padding: 40px;
    border-radius: 20px;
    color: white;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
}

.header-content {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.header-icon {
    font-size: 3em;
    margin-right: 20px;
}

.header-text h1 {
    margin: 0;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.header-text p {
    margin: 10px 0 0;
    font-size: 1.2em;
    opacity: 0.9;
}

.header-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.header-stat {
    text-align: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: transform 0.3s ease;
}

.header-stat:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.header-stat i {
    font-size: 2em;
    margin-bottom: 10px;
}

.header-stat span {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
}

.header-stat label {
    display: block;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Section Styles */
.section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--card-shadow);
}

/* Indicators Grid */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.indicator-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.indicator-card:hover {
    transform: translateY(-5px);
}

.indicator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
}

.indicator-icon {
    font-size: 2em;
    color: var(--primary);
    margin-bottom: 15px;
}

.indicator-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary);
    margin: 15px 0;
}

.indicator-trend {
    font-size: 0.9em;
    color: var(--success);
}

.indicator-trend.down {
    color: var(--danger);
}

/* Progress Cards */
.progress-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.progress-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

.progress-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.progress-header i {
    font-size: 1.5em;
    color: var(--primary);
    margin-right: 10px;
}

.progress-bar {
    height: 10px;
    background: var(--background);
    border-radius: 5px;
    overflow: hidden;
    margin: 10px 0;
}

.progress {
    height: 100%;
    background: linear-gradient(to right, var(--gradient-start), var(--gradient-end));
    border-radius: 5px;
    transition: width 1s ease;
}

.progress-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.9em;
    color: var(--text-light);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

.chart-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.chart-header i {
    font-size: 1.5em;
    color: var(--primary);
    margin-right: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.stats-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

.stats-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.stats-header i {
    font-size: 1.5em;
    color: var(--primary);
    margin-right: 10px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    font-weight: 600;
}

tr:hover {
    background-color: var(--background);
}

/* Map Section */
.map-section {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: var(--card-shadow);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.section-header i {
    font-size: 1.5em;
    color: var(--primary);
    margin-right: 10px;
}

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

.country-card {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
}

.country-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.country-header i {
    font-size: 1.5em;
    color: var(--primary);
    margin-right: 10px;
}

.municipality-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.municipality-list::-webkit-scrollbar {
    width: 8px;
}

.municipality-list::-webkit-scrollbar-track {
    background: var(--background);
    border-radius: 4px;
}

.municipality-list::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
}

.municipality-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.3s ease;
}

.municipality-item:hover {
    background-color: var(--background);
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1000;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding-top: 4rem;
    }

    .indicators-grid,
    .progress-cards,
    .charts-grid,
    .stats-grid,
    .countries-grid {
        grid-template-columns: 1fr;
    }

    .header-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 4rem 1rem 1rem;
    }

    .header {
        padding: 20px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-icon {
        margin-right: 0;
        margin-bottom: 15px;
    }

    .section {
        padding: 15px;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.modal.active {
    opacity: 1;
}

.modal-content {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    padding: 4px;
    box-sizing: border-box;
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal iframe.loaded {
    opacity: 1;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.close-modal:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.modal-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary);
    font-size: 24px;
    z-index: 10003;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-loading.active {
    opacity: 1;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}