/* Variables del Sistema de Diseño (Tokens) */
:root {
    --bg-main: hsl(222, 25%, 8%);
    --bg-card: hsla(222, 25%, 12%, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);

    --color-primary: hsl(195, 100%, 48%);
    --color-primary-hover: hsl(195, 100%, 40%);
    --color-primary-dim: hsla(195, 100%, 48%, 0.15);

    --color-secondary: hsl(265, 90%, 65%);
    --color-secondary-dim: hsla(265, 90%, 65%, 0.15);

    --color-success: hsl(145, 80%, 45%);
    --color-warning: hsl(40, 95%, 55%);
    --color-danger: hsl(355, 85%, 55%);

    --text-main: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 20%, 65%);
    --text-dark: hsl(222, 25%, 5%);

    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-full: 9999px;
}

/* Reset de Estilos */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Layout Principal de la Aplicación */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px;
    gap: 16px;
}

/* Header / Navbar */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    height: 64px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-orb {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    box-shadow: 0 0 12px var(--color-primary);
    position: relative;
}

.logo-area h1 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    color: var(--text-muted);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.status-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
}

.status-indicator-dot.green {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

.status-indicator-dot.yellow {
    background-color: var(--color-warning);
    box-shadow: 0 0 8px var(--color-warning);
}

.status-indicator-dot.red {
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
}

/* Contenido Principal Grid */
.app-content {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 16px;
    height: calc(100vh - 112px);
    overflow: hidden;
}

/* Sidebar Panel */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Tarjeta Glassmorphism */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(12px);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.section-title i {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

/* Formularios e Inputs */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 10px;
    resize: none;
    outline: none;
    transition: var(--transition-smooth);
}

textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 8px var(--color-primary-dim);
}

/* Botones Premium */
.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: var(--text-main);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(195, 100, 48, 0.3);
    filter: brightness(1.1);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Grid de Estado de APIs */
.api-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.api-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    transition: var(--transition-smooth);
}

.api-name {
    font-weight: 500;
    text-transform: capitalize;
    color: var(--text-muted);
}

.api-status {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
}

.api-status.online { background-color: var(--color-success); box-shadow: 0 0 6px var(--color-success); }
.api-status.cooldown { background-color: var(--color-warning); box-shadow: 0 0 6px var(--color-warning); }
.api-status.offline { background-color: var(--color-danger); box-shadow: 0 0 6px var(--color-danger); }

/* Lista de Reportes */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.report-item {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.report-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--color-primary);
}

.report-icon {
    color: var(--color-primary);
    margin-top: 2px;
}

.report-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.report-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-all;
}

.report-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Panel Principal */
.main-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    height: 100%;
}

/* Bienvenido Card */
.welcome-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px;
    height: 100%;
}

.welcome-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--color-primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    border: 1px solid rgba(195, 100, 48, 0.2);
}

.welcome-icon {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
}

.welcome-card h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.welcome-card p {
    color: var(--text-muted);
    max-width: 550px;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Progreso Card (Timeline) */
.progress-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stepper-timeline {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 20px 0;
}

.stepper-timeline::before {
    content: '';
    position: absolute;
    top: 36px;
    left: 20px;
    right: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    z-index: 1;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 2;
    flex: 1;
}

.step-indicator {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    transition: var(--transition-smooth);
    color: var(--text-muted);
}

.step-icon {
    width: 16px;
    height: 16px;
}

.step-details h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.step-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    max-width: 120px;
}

/* Modos de Estado de Pasos */
.step-item.active .step-indicator {
    border-color: var(--color-primary);
    background: var(--color-primary-dim);
    color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-dim);
}
.step-item.active .step-details h3 {
    color: var(--text-main);
}

.step-item.completed .step-indicator {
    border-color: var(--color-success);
    background: rgba(145, 80, 45, 0.15);
    color: var(--color-success);
}
.step-item.completed .step-details h3 {
    color: var(--color-success);
}

/* Consola de Logs */
.console-logs {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    height: 200px;
}

.console-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-weight: bold;
}

.pulse-indicator {
    color: var(--color-danger);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
}
.pulse-indicator::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-danger);
    display: inline-block;
    animation: pulse 1s infinite alternate;
}

.console-body {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-line {
    color: #0f0; /* Color terminal verde */
}
.log-line.system { color: var(--text-muted); }
.log-line.error { color: var(--color-danger); }

/* Visor de Reporte */
.report-viewer-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.viewer-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-actions {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary-sm {
    background: var(--color-primary);
    color: var(--text-dark);
    border: none;
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition-smooth);
}
.btn-primary-sm:hover {
    background: var(--color-primary-hover);
}

.report-metadata {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Renderizador de Markdown */
.markdown-body {
    line-height: 1.6;
    font-size: 0.95rem;
    color: var(--text-main);
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-main);
}

.markdown-body h1 { border-bottom: 1px solid var(--border-color); padding-bottom: 6px; font-size: 1.4rem; }
.markdown-body h2 { font-size: 1.2rem; }
.markdown-body h3 { font-size: 1rem; }

.markdown-body p {
    margin-bottom: 14px;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 14px;
    padding-left: 20px;
}

.markdown-body li {
    margin-bottom: 4px;
}

/* Callouts / Alerts estilo GitHub */
.markdown-body blockquote {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 4px solid var(--color-primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 14px;
}

/* Clases de animación */
.hidden { display: none !important; }
.spinner { animation: rotate 2s linear infinite; }
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { opacity: 0.3; } 100% { opacity: 1; } }
.animate-pulse { animation: pulse 1.5s infinite alternate; }

.pulse-icon {
    animation: scale-up 2s infinite ease-in-out;
}
@keyframes scale-up {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; color: var(--color-secondary); }
}

/* Skeletons */
.api-skeleton, .report-skeleton {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 12px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}
