/* =============================================
   PORTAL - Foro Internacional de Desarrollo Sostenible
   ============================================= */

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

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #f0fdf4;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- NAV --- */
.navbar {
    background: #fff;
    border-bottom: 2px solid #16a34a;
    padding: 0 2rem;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}
.nav-logo { height: 48px; }
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.nav-links a {
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-links a:hover, .nav-links a.nav-active {
    color: #16a34a;
}
.nav-user {
    font-weight: 600;
    color: #16a34a;
}
.btn-nav-salir {
    background: none;
    border: 1px solid #dc2626;
    color: #dc2626;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.btn-nav-salir:hover {
    background: #dc2626;
    color: #fff;
}

/* --- NAV TOGGLE (HAMBURGER) --- */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 110;
}
.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #1a1a2e;
    border-radius: 2px;
    transition: all 0.3s ease;
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
.nav-link-admin {
    background: #1a1a2e;
    color: #fff !important;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.nav-link-admin:hover {
    background: #0f172a;
}
.nav-link-asistente {
    background: #16a34a;
    color: #fff !important;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.nav-link-asistente:hover {
    background: #15803d;
}

/* --- MAIN --- */
.portal-main {
    flex: 1;
    padding: 2rem 1rem;
}
.portal-container {
    max-width: 1000px;
    margin: 0 auto;
}

/* --- HEADER --- */
.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}
.portal-header h1 {
    font-size: 1.8rem;
    color: #16a34a;
    margin-bottom: 0.25rem;
}
.portal-header p {
    color: #6b7280;
    font-size: 1rem;
}
.badge-estado {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    background: #fef3c7;
    color: #92400e;
}
.badge-estado.postulado { background: #d1fae5; color: #065f46; }
.badge-estado.en_evaluacion { background: #dbeafe; color: #1e40af; }
.badge-estado.preseleccionado { background: #ede9fe; color: #5b21b6; }
.badge-estado.verificado { background: #fef3c7; color: #92400e; }
.badge-estado.reconocido { background: #d1fae5; color: #065f46; }

/* --- PROGRESS --- */
.portal-progress {
    margin-bottom: 2rem;
}
.progress-bar {
    height: 12px;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #16a34a, #22c55e);
    border-radius: 8px;
    transition: width 0.5s ease;
}
.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #6b7280;
}

/* --- SCORE CARDS --- */
.portal-scores {
    margin-bottom: 2rem;
}
.portal-scores h2 {
    font-size: 1.3rem;
    color: #1a1a2e;
    margin-bottom: 1rem;
}
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.score-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.score-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15);
}
.score-icon {
    margin-bottom: 0.5rem;
}
.score-name {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}
.score-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #16a34a;
}
.score-max {
    font-size: 0.8rem;
    color: #9ca3af;
}
.score-total {
    text-align: center;
    font-size: 1.1rem;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    border: 2px solid #16a34a;
}
.score-total strong {
    color: #16a34a;
    font-size: 1.5rem;
    margin-left: 0.5rem;
}

/* --- EVIDENCIAS --- */
.portal-evidencias {
    margin-bottom: 2rem;
}
.portal-evidencias h2 {
    font-size: 1.3rem;
    color: #1a1a2e;
    margin-bottom: 1rem;
}
.evidencias-list {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
}
.evidencia-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.evidencia-item:last-child { border-bottom: none; }
.evidencia-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.evidencia-pregunta {
    background: #16a34a;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}
.evidencia-nombre {
    font-size: 0.9rem;
    color: #1a1a2e;
}
.evidencia-eliminar {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    font-size: 1.2rem;
}
.empty-text {
    color: #9ca3af;
    text-align: center;
    font-style: italic;
}

/* --- ACTIONS --- */
.portal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}
.btn-portal {
    padding: 0.8rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
}
.btn-portal.btn-primary {
    background: #16a34a;
    color: #fff;
}
.btn-portal.btn-primary:hover {
    background: #15803d;
}
.btn-portal.btn-secondary {
    background: #fff;
    color: #dc2626;
    border: 1px solid #dc2626;
}
.btn-portal.btn-secondary:hover {
    background: #fef2f2;
}

/* --- TABLE RESPONSIVE --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* --- FOOTER --- */
.portal-footer {
    background: #1a1a2e;
    color: #fff;
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    margin-top: auto;
}

/* --- RESPONSIVE --- */
@media (max-width: 992px) {
    .portal-header h1 { font-size: 1.5rem; }
    .detalle-block .detalle-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .nav-links {
        position: fixed;
        top: 64px; left: 0; right: 0;
        background: #fff;
        flex-direction: column;
        padding: 0;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        border-bottom: 2px solid #16a34a;
    }
    .nav-links.active {
        max-height: 400px;
        padding: 0.5rem 0;
    }
    .nav-links a,
    .nav-links .nav-user,
    .nav-links .btn-nav-salir {
        padding: 0.75rem 1rem;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #f3f4f6;
    }
    .nav-links .btn-nav-salir {
        margin: 0.5rem 1rem;
        border: 1px solid #dc2626;
    }
    .portal-main { padding: 1rem 0.75rem; }
    .portal-header { flex-direction: column; gap: 1rem; text-align: center; }
    .portal-header h1 { font-size: 1.4rem; }
    .scores-grid { grid-template-columns: repeat(3, 1fr); }
    .detalle-grid { grid-template-columns: 1fr; }
    .evidencia-item { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .evidencia-eliminar { align-self: flex-end; }
    .sost-table { font-size: 0.8rem; }
}
@media (max-width: 480px) {
    .scores-grid { grid-template-columns: repeat(2, 1fr); }
    .score-value { font-size: 1.4rem; }
    .portal-actions { flex-direction: column; }
    .btn-portal { width: 100%; text-align: center; }
    .portal-header h1 { font-size: 1.2rem; }
    .badge-estado { font-size: 0.8rem; padding: 0.3rem 0.8rem; }
    .sost-table th, .sost-table td { padding: 0.4rem; font-size: 0.75rem; }
}

/* --- DETALLE COMPLETO --- */
.portal-detalle-completo {
    margin-bottom: 2rem;
}
.portal-detalle-completo > h2 {
    font-size: 1.3rem;
    color: #1a1a2e;
    margin-bottom: 1.5rem;
}
.detalle-block {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.detalle-block-title {
    font-size: 1.1rem;
    color: #16a34a;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}
.detalle-block .detalle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.detalle-block .detalle-field .label {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 0.15rem;
}
.detalle-block .detalle-field .value {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 0.9rem;
}
.detalle-separator {
    grid-column: 1 / -1;
    border-top: 1px solid #f3f4f6;
    margin: 0.5rem 0;
}

/* --- SOSTENIBILIDAD DETALLE --- */
.sost-dim-section {
    margin-bottom: 1.5rem;
}
.sost-dim-title {
    font-size: 1rem;
    color: #16a34a;
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
    border-left: 3px solid #16a34a;
}
.sost-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.sost-table th {
    background: #f0fdf4;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}
.sost-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.sost-num {
    text-align: center;
    font-weight: 700;
    color: #16a34a;
}
.sost-val {
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
}
.sost-val.val-0 { color: #dc2626; background: #fef2f2; }
.sost-val.val-1 { color: #d97706; background: #fffbeb; }
.sost-val.val-2 { color: #2563eb; background: #eff6ff; }
.sost-val.val-3 { color: #16a34a; background: #f0fdf4; }
.sost-label {
    font-size: 0.8rem;
    color: #6b7280;
}
