:root {
    --primary: #720F36;
    --secondary: #511D4E;
    --accent: #BF6161;
    --neutral-dark: #0E0D0E;
    --neutral-light: #FDE9EB;
    --warm: #BE9461;
    --white: #FFFFFF;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --border-radius: 12px;
    --shadow: 0 4px 24px rgba(114, 15, 54, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--neutral-dark);
    background: linear-gradient(135deg, var(--neutral-light) 0%, var(--white) 100%);
    line-height: 1.6;
    padding: 2rem;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    animation: fadeInUp 0.8s ease;
}

.dashboard-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    animation: fadeInUp 0.8s ease 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    align-items: stretch;
}

.pmd-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%
}

.pmd-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--warm));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.pmd-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 32px rgba(114, 15, 54, 0.15);
    border-color: var(--warm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    /* Mantener este contenido en la parte superior */
    flex-shrink: 0;
}

.card-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Este elemento ocupará todo el espacio disponible */
    justify-content: space-between;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.card-icon {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    width: 60px; /* Aumentado de 50px */
    height: 60px; /* Aumentado de 50px */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem; /* Aumentado de 1.2rem */
    flex-shrink: 0; /* Previene que se reduzca */
    margin-left: 1rem; /* Espacio entre el texto y el icono */
}

.progress-section {
    margin-bottom: 1.5rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(190, 148, 97, 0.2);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--warm));
    border-radius: 4px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.indicators-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--neutral-dark);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    /* Mantener este contenido fijo */
    flex-shrink: 0;
}

.indicators-count i {
    color: var(--warm);
}

.btn-details {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: center;
    margin-top: auto; /* Empuja el botón hacia abajo */
    flex-shrink: 0;
}

.btn-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(114, 15, 54, 0.3);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(14, 13, 14, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 800px;
    width: 190%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    position: relative;
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    opacity: 0.9;
    font-size: 0.9rem;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--white);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--warm);
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
}

.indicator-item {
    background: var(--neutral-light);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--warm);
    transition: var(--transition);
}


.indicator-name {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.indicator-meta {
    font-size: 0.9rem;
    color: var(--neutral-dark);
    margin-bottom: 1rem;
}

.indicator-progress {
    margin-bottom: 0.5rem;
}

.indicator-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.indicator-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(190, 148, 97, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.indicator-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warm), var(--success));
    border-radius: 3px;
    transition: width 1s ease;
}

.responsible {
    font-size: 0.8rem;
    color: var(--warm);
    font-weight: 500;
    margin-top: 0.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px solid var(--neutral-light);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--neutral-dark);
}

.stat-detail {
    font-size: 0.75rem;
    color: var(--warm);
    margin-top: 0.5rem;
    font-weight: 500;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.stat-card {
    cursor: pointer;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(114, 15, 54, 0.15);
}

.stat-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--neutral-light);
    border-radius: 6px;
    font-size: 0.9rem;
}

.breakdown-label {
    font-weight: 500;
    color: var(--primary);
}

.breakdown-value {
    font-weight: 600;
    color: var(--warm);
}

.progress-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.range-bar {
    flex: 1;
    height: 4px;
    background: var(--neutral-light);
    border-radius: 2px;
    overflow: hidden;
}

.range-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s ease;
}

.range-low {
    background: var(--danger);
}

.range-medium {
    background: var(--warning);
}

.range-high {
    background: var(--success);
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 1rem;
    }
}

/* Estilos para subindicadores */
.indicator-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.btn-subindicators {
    background: var(--neutral-light);
    color: var(--primary);
    border: 1px solid var(--warm);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-subindicators:hover {
    background: var(--warm);
    color: var(--white);
}

.subindicators-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 1rem;
    padding: 1rem;
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.subindicator-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 1rem;
    padding: 1rem;
    align-items: center;
    border-bottom: 1px solid var(--neutral-light);
}

.subindicator-name {
    font-weight: 500;
    color: var(--primary);
}

.subindicator-meta {
    font-size: 0.9rem;
}

.subindicator-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subindicator-progress input {
    width: 60px;
    padding: 0.3rem;
    border: 1px solid var(--warm);
    border-radius: 4px;
    text-align: center;
}

.subindicator-responsible {
    font-size: 0.8rem;
    color: var(--warm);
}

/* Estilos para el modal de Excel */
/* Estilos mejorados para el modal de Excel */
.excel-modal {
    width: 95% !important;
    max-width: none !important;
    height: 90vh !important;
    max-height: 90vh !important;
    padding: 0;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: absolute;
    right: 1rem;
    top: 1.5rem;
}

.btn-zoom {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-zoom:hover {
    background: rgba(255, 255, 255, 0.4);
}

.excel-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--primary);
}

.loading-spinner {
    border: 4px solid rgba(114, 15, 54, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--primary);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Contenedor de la tabla Excel */
.excel-container-wrapper {
    width: 100%;
    height: calc(90vh - 100px);
    overflow: auto;
    position: relative;
}

.excel-table-container {
    min-width: 100%;
    min-height: 100%;
    transform-origin: 0 0;
    transition: transform 0.2s ease;
}

.excel-table {
    border-collapse: collapse;
    width: auto; /* Cambiado de 100% a auto */
    table-layout: auto; /* Cambiado de fixed a auto */
}

.excel-table th, 
.excel-table td {
    border: 1px solid #e0e0e0;
    padding: 8px 12px;
    min-width: 50px; /* Reducido el mínimo */
    max-width: none; /* Eliminado el máximo fijo */
    white-space: normal; /* Cambiado de nowrap a normal */
    word-wrap: break-word; /* Permite romper palabras largas */
    overflow: visible; /* Cambiado de hidden a visible */
    text-overflow: clip; /* Cambiado de ellipsis a clip */
    position: relative;
}

.excel-table th {
    background-color: #f5f5f5;
    font-weight: bold;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.excel-table td {
    background-color: white;
}

.excel-table tr:nth-child(even) td {
    background-color: #f9f9f9;
}

/* Estilos para diferentes tipos de celdas */
.cell-number {
    text-align: right;
    font-family: monospace;
}

.cell-text {
    text-align: left;
}

.cell-date {
    text-align: center;
}

.cell-percentage::after {
    content: '%';
}

.cell-currency::before {
    content: '$';
}

.cell-boolean {
    text-align: center;
    font-style: italic;
}

.cell-error {
    background-color: #ffebee !important;
    color: #c62828;
}

.cell-formula {
    font-style: italic;
    color: #2e7d32;
}

/* Resaltar fila/columna al pasar el mouse */
.excel-table tr:hover td {
    background-color: #e3f2fd !important;
}

.excel-table td:hover::after {
    display: block;
}


.excel-table td:hover::after {
    content: attr(data-content);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 100;
    background: #fff;
    border: 1px solid #ccc;
    padding: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    min-width: 200px;
    max-width: 400px;
    word-wrap: break-word;
    white-space: normal;
    display: none;
}

/* Estilo para celdas fusionadas */
.merged-cell {
    background-color: #e8f5e9 !important;
}

/* Barra de estado */
.excel-status-bar {
    position: sticky;
    bottom: 0;
    background-color: #f5f5f5;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

/* Barra de desplazamiento personalizada */
.excel-container-wrapper {
    overflow: auto;
    max-width: 100%;
}

.excel-container-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.excel-container-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

.excel-container-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}


/* Añade estos estilos a tu styles.css */


/* Reemplaza los estilos existentes del chart container con estos: */
.indicator-chart-container {
    width: 160px;  /* Aumentamos el ancho */
    height: 120px; /* Aumentamos la altura */
    margin: 0 auto 15px auto; /* Centrado con margen inferior */
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.indicator-chart-container canvas {
    width: 160px !important;
    height: 120px !important;
}

.progress-trimestre {
    font-size: 1rem;
    color: var(--neutral-dark);
    margin-top: 10px;
    text-align: center;
    font-weight: 600;
}

.indicator-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.indicator-name {
    font-size: 1.1rem;
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
}

.indicator-meta {
    font-size: 0.95rem;
    margin-bottom: 15px;
}
