/**
 * AroropIA - CSS Dashboard
 * Archivo: /public_html/css/dashboard.css
 * Estilos específicos del dashboard público
 * Glassmorphism + Visualización de datos
 */

/* ===============================================
   VARIABLES DASHBOARD
   =============================================== */
:root {
    /* Colores Dashboard */
    --dashboard-primary: #4f46e5;
    --dashboard-secondary: #7c3aed;
    --dashboard-accent: #06b6d4;
    --dashboard-success: #059669;
    --dashboard-warning: #d97706;
    --dashboard-error: #dc2626;
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    /* Efectos Dashboard */
    --dashboard-blur: 20px;
    --dashboard-border: rgba(255, 255, 255, 0.2);
    --dashboard-bg: rgba(255, 255, 255, 0.1);
    --dashboard-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --dashboard-glow: 0 0 30px rgba(79, 70, 229, 0.3);
}

/* ===============================================
   FIX PARA HEADER OVERLAP
   =============================================== */

/* Asegurar que el body tenga padding-top para el navbar fijo */
body {
    padding-top: 100px; /* Espacio para navbar fijo */
}

/* Asegurar que el navbar tenga la altura correcta */
.navbar, .glass-navbar {
    height: 80px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Container del navbar */
.navbar-container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===============================================
   LAYOUT DASHBOARD
   =============================================== */
.dashboard-container {
    min-height: calc(100vh - 100px); /* Restar altura del navbar */
    background: var(--gradient-primary);
    position: relative;
    overflow-x: hidden;
    padding-top: 2rem; /* Padding adicional arriba */
}

.dashboard-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(79, 70, 229, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(124, 58, 237, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(6, 182, 212, 0.2) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.dashboard-content {
    position: relative;
    z-index: 1;
    padding: 2rem 0;
}

/* ===============================================
   HEADER DASHBOARD
   =============================================== */
.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 1rem 0; /* Más padding arriba */
    margin-top: 1rem; /* Margen adicional */
}

.dashboard-title {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1rem;
    margin-top: 0; /* Asegurar que no tenga margen negativo */
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dashboard-subtitle {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.dashboard-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.meta-item i {
    color: var(--dashboard-accent);
}

/* Ajuste para la sección del header del dashboard */
.dashboard-header.section {
    padding-top: 3rem !important; /* Forzar padding superior */
}

/* ===============================================
   STATUS BANNER
   =============================================== */
.status-banner {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
    margin-top: 0;
    margin-bottom: 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.status-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gradient-success);
}

.status-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

.status-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(5, 150, 105, 0.2);
    border: 1px solid rgba(5, 150, 105, 0.3);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    margin-top: 1rem;
    color: #34d399;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===============================================
   METRICS CARDS
   =============================================== */
.metrics-section {
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-align: center;
    margin-bottom: 3rem;
    margin-top: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

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

.metric-card {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--gradient-primary);
}

.metric-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

.metric-card.primary::before {
    background: var(--gradient-primary);
}

.metric-card.secondary::before {
    background: var(--gradient-secondary);
}

.metric-card.success::before {
    background: var(--gradient-success);
}

.metric-card.warm::before {
    background: var(--gradient-warm);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.metric-icon.primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--dashboard-glow);
}

.metric-icon.secondary {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.3);
}

.metric-icon.success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 0 30px rgba(5, 150, 105, 0.3);
}

.metric-icon.warm {
    background: var(--gradient-warm);
    color: white;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.metric-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    margin-bottom: 1rem;
}

.metric-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.metric-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease;
    position: relative;
}

.metric-progress-fill.primary {
    background: var(--gradient-primary);
}

.metric-progress-fill.secondary {
    background: var(--gradient-secondary);
}

.metric-progress-fill.success {
    background: var(--gradient-success);
}

.metric-progress-fill.warm {
    background: var(--gradient-warm);
}

.metric-change {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.metric-change.positive {
    color: var(--dashboard-success);
}

.metric-change.negative {
    color: var(--dashboard-error);
}

.metric-change.neutral {
    color: rgba(255, 255, 255, 0.7);
}

/* ===============================================
   PROGRESS SECTION
   =============================================== */
.progress-section {
    margin-bottom: 4rem;
}

.progress-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.progress-chart {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
    text-align: center;
}

.circular-progress {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 2rem;
}

.progress-ring {
    width: 200px;
    height: 200px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 12;
}

.progress-ring-fill {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dasharray 2s ease;
}

.progress-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
}

.progress-label {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
}

.milestones-list {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
}

.milestone-item {
    display: flex;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

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

.milestone-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin: 0 -0.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.milestone-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 1rem;
    flex-shrink: 0;
}

.milestone-status.completed {
    background: var(--dashboard-success);
    box-shadow: 0 0 10px rgba(5, 150, 105, 0.5);
}

.milestone-status.pending {
    background: var(--dashboard-warning);
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.5);
}

.milestone-status.upcoming {
    background: var(--dashboard-accent);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.milestone-content {
    flex: 1;
}

.milestone-title {
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.milestone-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ===============================================
   CHARTS SECTION
   =============================================== */
.charts-section {
    margin-bottom: 4rem;
}

.charts-container {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
}

.charts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.charts-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.charts-tabs {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.25rem;
}

.tab-button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.tab-button.active {
    background: rgba(79, 70, 229, 0.6);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.tab-button:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.chart-content {
    height: 350px;
    position: relative;
}

.chart-canvas {
    width: 100% !important;
    height: 100% !important;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===============================================
   RECENT ACTIVITY
   =============================================== */
.activity-section {
    margin-bottom: 4rem;
}

.activity-timeline {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
}

.timeline-item {
    display: flex;
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 18px;
    top: 40px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--dashboard-primary) 0%, rgba(79, 70, 229, 0.2) 100%);
}

.timeline-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    margin-right: 1.5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.timeline-icon.success {
    background: var(--gradient-success);
    color: white;
}

.timeline-icon.info {
    background: var(--gradient-secondary);
    color: white;
}

.timeline-icon.warning {
    background: var(--gradient-warm);
    color: white;
}

.timeline-content {
    flex: 1;
}

.timeline-title {
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.timeline-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.timeline-time {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===============================================
   API STATUS
   =============================================== */
.api-status-section {
    margin-bottom: 4rem;
}

.api-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.api-endpoint {
    background: var(--dashboard-bg);
    border: 1px solid var(--dashboard-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(var(--dashboard-blur));
    box-shadow: var(--dashboard-shadow);
    transition: all 0.3s ease;
    text-align: center;
}

.api-endpoint:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.3);
}

.endpoint-name {
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.endpoint-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.endpoint-status.online {
    background: rgba(5, 150, 105, 0.2);
    color: #34d399;
    border: 1px solid rgba(5, 150, 105, 0.3);
}

.endpoint-status.offline {
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.endpoint-response {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ===============================================
   LOADING STATES
   =============================================== */
.loading-card {
    position: relative;
    overflow: hidden;
}

.loading-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.skeleton {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Asegurar que el loading overlay no interfiera */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999; /* Por encima del navbar */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===============================================
   FOOTER DASHBOARD
   =============================================== */
.dashboard-footer {
    text-align: center;
    padding: 3rem 1rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 4rem;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--dashboard-accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.footer-link:hover {
    color: white;
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
    text-decoration: none;
}

.footer-copyright {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ===============================================
   CONTAINER Y SECCIONES GENERALES
   =============================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Si existe una clase section general */
.section {
    padding: 2rem 0;
}

.section:first-of-type {
    padding-top: 3rem; /* Más espacio para la primera sección */
}

/* Espaciado mejorado entre secciones */
.dashboard-metrics.section,
.progress-sections.section,
.charts-section.section,
.api-status.section {
    padding: 3rem 0;
}

/* ===============================================
   NAVBAR TOGGLE BUTTON
   =============================================== */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.navbar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===============================================
   RESPONSIVE DESIGN
   =============================================== */

/* Tablet */
@media (max-width: 768px) {
    body {
        padding-top: 80px; /* Menos padding en tablet */
    }
    
    .dashboard-container {
        min-height: calc(100vh - 80px);
    }
    
    .navbar, .glass-navbar {
        height: 70px; /* Navbar más pequeño en tablet */
    }
    
    .dashboard-header {
        padding: 1rem 1rem 0;
        margin-top: 0.5rem;
    }
    
    .dashboard-title {
        font-size: 2.5rem; /* Título más pequeño en tablet */
    }
    
    .navbar-toggle {
        display: block;
    }
    
    .navbar-nav {
        display: none; /* Ocultar en tablet por defecto */
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(20px);
        padding: 1rem 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-nav.active {
        display: block;
    }
    
    .progress-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .dashboard-metrics {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .api-status-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* Mobile */
@media (max-width: 480px) {
    body {
        padding-top: 70px;
    }
    
    .navbar, .glass-navbar {
        height: 60px;
    }
    
    .dashboard-title {
        font-size: 1.8rem;
    }
    
    .dashboard-subtitle {
        font-size: 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .dashboard-metrics {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .metric-card {
        padding: 1.5rem;
    }
    
    .metric-value {
        font-size: 2rem;
    }
    
    .charts-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-button {
        padding: 0.75rem 1rem;
    }
    
    .chart-content {
        height: 250px;
    }
    
    .api-status-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}