/* ============================================
   Nexo Design System — Portal PragmaData
   V1.1 | Mayo 2026
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ============================================
   TOKENS DE DISEÑO
   ============================================ */
:root {
    /* Primarios */
    --nexo-purple-main: #6429CD;
    --nexo-purple-2: #531DBC;
    --nexo-purple-3: #440099;
    --nexo-purple-4: #330072;
    --nexo-black: #1D1D1B;

    /* Fondos */
    --nexo-bg-page: #F7F8FA;
    --nexo-bg-card: #FFFFFF;
    --nexo-bg-gray-1: #E1E6F0;
    --nexo-bg-gray-2: #EEF1F7;
    --nexo-bg-blue-1: #E0E6FF;
    --nexo-bg-blue-2: #F6F7FC;

    /* Bordes */
    --nexo-border: #E0E4EC;

    /* Texto */
    --nexo-text-primary: #1D1D1B;
    --nexo-text-secondary: #6B7280;
    --nexo-text-white: #FFFFFF;

    /* Estado — Semáforo */
    --nexo-state-ok: #27AE60;
    --nexo-state-ok-bg: #D4EDDA;
    --nexo-state-ok-text: #1B5E20;
    --nexo-state-warning: #F8AF3C;
    --nexo-state-warning-bg: #FFF3CD;
    --nexo-state-warning-text: #856404;
    --nexo-state-critical: #EB5757;
    --nexo-state-critical-bg: #FFEBEE;
    --nexo-state-critical-text: #B71C1C;

    /* Secundarios */
    --nexo-purple-deep: #7500A0;
    --nexo-violet-bright: #9610FF;
    --nexo-pink: #DD52DD;
    --nexo-lilac: #E4A4FF;

    /* Acento */
    --nexo-accent-gold: #F8AF3C;
    --nexo-gray-lavender: #C3CBE7;

    /* Tipografía */
    --font-family: 'Poppins', sans-serif;
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;

    /* Tamaños tipográficos */
    --text-title: 2rem;
    --text-subtitle: 1.125rem;
    --text-kpi: 1rem;
    --text-label: 0.75rem;
    --text-body: 0.875rem;

    /* Espaciado y forma */
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* ============================================
   RESET Y BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-weight: var(--font-light);
    color: var(--nexo-text-primary);
    background-color: var(--nexo-bg-page);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--nexo-purple-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--nexo-purple-2);
}

/* ============================================
   HEADER
   ============================================ */
.nexo-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--nexo-purple-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nexo-header__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nexo-header__logo {
    height: 28px;
    width: auto;
}

.nexo-header__logo--pragma {
    height: 46px;
}

.nexo-header__divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.3);
}

.nexo-header__title {
    color: var(--nexo-text-white);
    font-size: var(--text-subtitle);
    font-weight: var(--font-light);
    letter-spacing: 0.5px;
}

.nexo-header__user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--nexo-text-white);
    font-size: var(--text-body);
    font-weight: var(--font-regular);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.2s ease;
}

.nexo-header__user:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nexo-header__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--nexo-purple-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: var(--font-medium);
    color: white;
}

/* ============================================
   SIDEBAR
   ============================================ */
.nexo-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--nexo-bg-card);
    border-right: 1px solid var(--nexo-border);
    padding: 24px 0;
    overflow-y: auto;
    z-index: 900;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.nexo-sidebar__footer {
    margin-top: auto;
    padding: 16px 24px;
    font-size: 0.65rem;
    color: #C3CBE7;
    text-align: center;
    letter-spacing: 0.5px;
}

.nexo-sidebar__section {
    padding: 0 16px;
    margin-bottom: 8px;
}

.nexo-sidebar__label {
    font-size: var(--text-label);
    font-weight: var(--font-medium);
    color: var(--nexo-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
    margin-bottom: 4px;
}

.nexo-sidebar__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin: 2px 8px;
    border-radius: var(--radius);
    color: var(--nexo-text-primary);
    font-size: var(--text-body);
    font-weight: var(--font-regular);
    transition: all 0.2s ease;
    cursor: pointer;
}

.nexo-sidebar__item:hover {
    background: var(--nexo-bg-blue-1);
    color: var(--nexo-purple-main);
}

.nexo-sidebar__item.active {
    background: var(--nexo-purple-main);
    color: var(--nexo-text-white);
}

.nexo-sidebar__item.active i {
    color: var(--nexo-text-white);
}

.nexo-sidebar__item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--nexo-text-secondary);
}

.nexo-sidebar__separator {
    height: 1px;
    background: var(--nexo-border);
    margin: 16px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.nexo-main {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 32px;
    min-height: calc(100vh - var(--header-height));
}

.nexo-main__title {
    font-size: 1.5rem;
    font-weight: var(--font-medium);
    color: var(--nexo-text-primary);
    margin-bottom: 8px;
}

.nexo-main__subtitle {
    font-size: var(--text-body);
    font-weight: var(--font-light);
    color: var(--nexo-text-secondary);
    margin-bottom: 32px;
}

/* ============================================
   CARDS — Tarjetas de Dashboard
   ============================================ */
.nexo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.nexo-card {
    background: var(--nexo-bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--nexo-border);
    border-left: 4px solid var(--nexo-purple-main);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nexo-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--nexo-violet-bright);
}

.nexo-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nexo-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--nexo-bg-blue-1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nexo-purple-main);
    font-size: 1.1rem;
}

.nexo-card__badge {
    font-size: 0.7rem;
    font-weight: var(--font-medium);
    padding: 3px 8px;
    border-radius: 12px;
}

.nexo-card__badge--ok {
    background: var(--nexo-state-ok-bg);
    color: var(--nexo-state-ok-text);
}

.nexo-card__badge--warning {
    background: var(--nexo-state-warning-bg);
    color: var(--nexo-state-warning-text);
}

.nexo-card__badge--new {
    background: var(--nexo-bg-blue-1);
    color: var(--nexo-purple-main);
}

.nexo-card__title {
    font-size: var(--text-subtitle);
    font-weight: var(--font-medium);
    color: var(--nexo-text-primary);
}

.nexo-card__description {
    font-size: var(--text-body);
    font-weight: var(--font-light);
    color: var(--nexo-text-secondary);
    line-height: 1.5;
}

.nexo-card__footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--nexo-border);
    font-size: var(--text-label);
    color: var(--nexo-text-secondary);
}

/* ============================================
   KPI CARDS
   ============================================ */
.nexo-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.nexo-kpi {
    background: var(--nexo-bg-card);
    border-radius: var(--radius);
    border-left: 4px solid var(--nexo-purple-main);
    padding: 20px;
    box-shadow: var(--shadow);
}

.nexo-kpi__label {
    font-size: var(--text-label);
    font-weight: var(--font-regular);
    color: var(--nexo-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.nexo-kpi__value {
    font-size: 1.75rem;
    font-weight: var(--font-bold);
    color: var(--nexo-text-primary);
    line-height: 1.2;
}

.nexo-kpi__trend {
    font-size: var(--text-body);
    font-weight: var(--font-regular);
    margin-top: 4px;
}

.nexo-kpi__trend--up {
    color: var(--nexo-state-ok);
}

.nexo-kpi__trend--down {
    color: var(--nexo-state-critical);
}

/* ============================================
   BADGES DE ESTADO
   ============================================ */
.nexo-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--text-label);
    font-weight: var(--font-medium);
}

.nexo-badge--ok {
    background: var(--nexo-state-ok-bg);
    color: var(--nexo-state-ok-text);
}

.nexo-badge--warning {
    background: var(--nexo-state-warning-bg);
    color: var(--nexo-state-warning-text);
}

.nexo-badge--critical {
    background: var(--nexo-state-critical-bg);
    color: var(--nexo-state-critical-text);
}

/* ============================================
   BUTTONS
   ============================================ */
.nexo-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: var(--text-body);
    font-weight: var(--font-medium);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.nexo-btn--primary {
    background: var(--nexo-purple-main);
    color: var(--nexo-text-white);
}

.nexo-btn--primary:hover {
    background: var(--nexo-purple-2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 41, 205, 0.3);
}

.nexo-btn--secondary {
    background: transparent;
    color: var(--nexo-purple-main);
    border: 1px solid var(--nexo-purple-main);
}

.nexo-btn--secondary:hover {
    background: var(--nexo-bg-blue-1);
}

.nexo-btn--ghost {
    background: transparent;
    color: var(--nexo-text-secondary);
}

.nexo-btn--ghost:hover {
    background: var(--nexo-bg-gray-2);
    color: var(--nexo-text-primary);
}

/* ============================================
   DASHBOARD EMBED WRAPPER
   ============================================ */
.nexo-dashboard-wrapper {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 0;
    height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

.nexo-dashboard-wrapper__toolbar {
    padding: 12px 24px;
    background: var(--nexo-bg-card);
    border-bottom: 1px solid var(--nexo-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nexo-dashboard-wrapper__title {
    font-size: var(--text-subtitle);
    font-weight: var(--font-medium);
    color: var(--nexo-text-primary);
}

.nexo-dashboard-wrapper__iframe {
    flex: 1;
    width: 100%;
    border: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .nexo-sidebar {
        transform: translateX(-100%);
    }

    .nexo-sidebar.open {
        transform: translateX(0);
    }

    .nexo-main,
    .nexo-dashboard-wrapper {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .nexo-grid {
        grid-template-columns: 1fr;
    }

    .nexo-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nexo-main {
        padding: 20px 16px;
    }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none; }
