/* ── Variables ──────────────────────────────────────────────────────────── */
:root {
    --sidebar-width: 260px;
    --header-height: 56px;
    --color-primary: #1a56a4;
    --color-primary-dark: #143e80;
    --color-sidebar-bg: #1e2a3a;
    --color-sidebar-text: #c9d6e3;
    --color-sidebar-active: #2d7dd2;
    --color-header-bg: #ffffff;
    --color-content-bg: #f4f6f9;
    --color-border: #dee2e6;
}

/* ── Reset / Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', sans-serif; background: var(--color-content-bg); }

/* Blazor enfoca el <h1> de cada página al navegar (accesibilidad / lectores
   de pantalla vía FocusOnNavigate en App.razor). No es un elemento interactivo,
   así que se oculta el anillo de enfoque para evitar el recuadro visual. */
h1:focus { outline: none; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.ci-sep-layout { display: flex; min-height: 100vh; }

.ci-sep-sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar-bg);
    color: var(--color-sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-logo { font-size: 1.75rem; }
.brand-name { font-size: 1.1rem; font-weight: 700; color: #fff; letter-spacing: .5px; }

.ci-sep-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ci-sep-header {
    height: var(--header-height);
    background: var(--color-header-bg);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.ci-sep-content { padding: 1.5rem; flex: 1; }

/* ── Nav Menu ───────────────────────────────────────────────────────────── */
.nav-menu ul { list-style: none; margin: 0; padding: .5rem 0; }
.nav-menu li { margin: 0; }
.nav-menu a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem 1.25rem;
    color: var(--color-sidebar-text);
    text-decoration: none;
    transition: background .15s, color .15s;
    font-size: .9rem;
}
.nav-menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-menu a.active { background: var(--color-sidebar-active); color: #fff; font-weight: 600; }
.nav-section {
    padding: 1rem 1.25rem .3rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}
.nav-icon { font-size: 1rem; min-width: 20px; text-align: center; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { color: var(--color-primary); font-size: 2rem; margin: 0 0 .5rem; }
.login-header p { color: #6c757d; margin: 0; font-size: .9rem; }

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: #6c757d;
    text-decoration: none;
    padding: .4rem .85rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: color .15s, border-color .15s, background .15s;
}
.btn-logout:hover { color: #dc3545; border-color: #dc3545; background: #fef2f2; }
.header-user { font-size: .9rem; color: #495057; margin-right: .75rem; }

/* ── Blazor error ───────────────────────────────────────────────────────── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.login-subtitle { color: #495057; font-size: .9rem; margin: .25rem 0; }
.login-org { font-size: .75rem; color: #6c757d; background: #f8f9fa; padding: .2rem .6rem; border-radius: 20px; display: inline-block; margin-top: .25rem; }
.login-form { margin-top: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; color: #374151; margin-bottom: .3rem; }
.form-control { width: 100%; padding: .6rem .85rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: .95rem; transition: border-color .15s, box-shadow .15s; }
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(26, 86, 164, 0.15); }
.form-check { display: flex; align-items: center; gap: .5rem; margin: 1rem 0; }
.form-check-input { width: 1rem; height: 1rem; cursor: pointer; }
.form-check-label { font-size: .875rem; color: #6b7280; cursor: pointer; }
.btn-login { width: 100%; padding: .7rem; background: var(--color-primary); color: #fff; border: none; border-radius: 6px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .15s; margin-top: .5rem; }
.btn-login:hover { background: var(--color-primary-dark); }
.login-footer { text-align: center; margin-top: 1.5rem; color: #9ca3af; }
.alert { padding: .75rem 1rem; border-radius: 6px; font-size: .875rem; margin-bottom: 1rem; }
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }

/* ── Sidebar collapsed ───────────────────────────────────────────────────── */
.sidebar-collapsed .ci-sep-sidebar { width: 60px; }
.sidebar-collapsed .ci-sep-main { margin-left: 60px; }
.sidebar-collapsed .sidebar-brand { padding: 1.25rem 0; justify-content: center; }
.sidebar-collapsed .nav-menu a { justify-content: center; padding: .65rem 0; }
.sidebar-footer { padding: .75rem 1rem; border-top: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); font-size: .7rem; margin-top: auto; }

/* ── Header user info ────────────────────────────────────────────────────── */
.header-right { display: flex; align-items: center; gap: 1rem; }
.header-user-info { display: flex; align-items: center; gap: .6rem; }
.header-divider { width: 1px; height: 24px; background: var(--color-border); }
.header-fullname { font-size: .875rem; color: #374151; font-weight: 500; }
.role-badge { font-size: .7rem; font-weight: 700; padding: .15rem .55rem; border-radius: 12px; text-transform: uppercase; letter-spacing: .5px; }
.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-operator { background: #d1fae5; color: #065f46; }

/* ── Page layout ─────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header > div:first-child { margin-bottom: 1rem; }
.page-header h1, .page-title { font-size: 1.5rem; font-weight: 700; color: #111827; margin: 0 0 .25rem; }
.page-header p, .page-header .text-muted { color: #6b7280; margin: 0; font-size: .9rem; }
.card { background: #fff; border: 1px solid var(--color-border); border-radius: 8px; }
.card-body { padding: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: #6b7280; }
.btn { display: inline-block; padding: .5rem 1.25rem; border-radius: 6px; font-size: .875rem; font-weight: 600; text-decoration: none; cursor: pointer; border: none; transition: background .15s; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); color: #fff; }

/* ── Tablero Kanban (columnas CSS Grid, sin drag & drop) ─────────────────── */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.kanban-column {
    background: #f4f5f7;
    border-radius: .5rem;
    padding: .75rem;
    min-height: 200px;
}

.kanban-column-header {
    font-weight: 600;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #495057;
    margin-bottom: .75rem;
    display: flex;
    justify-content: space-between;
}

.kanban-card {
    background: #fff;
    border-radius: .375rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
    padding: .6rem .75rem;
    margin-bottom: .6rem;
}

.kanban-card-title {
    font-size: .875rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.kanban-card-actions {
    display: flex;
    justify-content: flex-end;
}

/* ── Timeline custom (historial de estados) ───────────────────────────────── */
.ci-timeline {
    list-style: none;
    margin: 0;
    padding: 1rem;
}

.ci-timeline-item {
    position: relative;
    padding-left: 1.75rem;
    padding-bottom: 1.25rem;
    border-left: 2px solid #e9ecef;
}

    .ci-timeline-item:last-child {
        border-left-color: transparent;
        padding-bottom: 0;
    }

.ci-timeline-dot {
    position: absolute;
    left: -7px;
    top: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6c757d;
}

.ci-timeline-dot.primary { background: #1b6ec2; }
.ci-timeline-dot.warning { background: #ffc107; }
.ci-timeline-dot.success { background: #198754; }
.ci-timeline-dot.secondary { background: #6c757d; }

/* ── Editor de plantillas (Módulo 3) ──────────────────────────────────────── */
.template-edit-grid {
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .template-edit-grid { grid-template-columns: 1fr; }
}

.variable-badge { cursor: pointer; }

.sticky-save-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: .75rem;
    margin-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.CodeMirror {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: .85rem;
}
