/* =============================================================
   SIS Monitor — Estilos personalizados
   ============================================================= */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --sb-width: 260px;
    --sb-bg: #850309;
    --sb-border: rgba(255,255,255,.07);
    --sb-text: #ddd;
    --sb-text-hover: #f1f5f9;
    --sb-accent: #640207;
    --sb-accent-glow: rgba(255,255,255,0.2);
    --topbar-h: 58px;
    --body-bg: #f1f5f9;
}

/* ── Reset & base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--body-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1e293b;
}

a.text-muted {
    text-decoration: none;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sb-width);
    height: 100vh;
    background: var(--sb-bg);
    display: flex; flex-direction: column;
    z-index: 1040;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--sb-border);
    text-decoration: none;
}
.sidebar-logo-icon {
    width: 36px; height: 36px;
    background: var(--sb-accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.1rem;
    flex-shrink: 0;
}
.sidebar-logo-text { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sidebar-logo-sub  { color: var(--sb-text); font-size: .7rem; font-weight: 400; }

.sidebar-section {
    padding: 18px 12px 6px;
    font-size: .65rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: #ddd;
}

.sidebar-nav { flex: 1; padding: 4px 10px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sb-text);
    text-decoration: none;
    font-size: .875rem; font-weight: 500;
    transition: background .18s, color .18s;
    margin-bottom: 2px;
}
.sidebar-nav a i { font-size: 1rem; flex-shrink: 0; }
.sidebar-nav a:hover {
    background: rgba(255,255,255,.06);
    color: var(--sb-text-hover);
}
.sidebar-nav a.active {
    background: var(--sb-accent-glow);
    color: #fff;
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--sb-border);
    padding: 14px 12px;
}
.sidebar-avatar {
    width: 34px; height: 34px;
    background: #640207;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .8rem; font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-name  { color: #e2e8f0; font-size: .85rem; font-weight: 600; }
.sidebar-user-role  { color: var(--sb-text); font-size: .7rem; }
.sidebar-logout {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    color: #f87171;
    text-decoration: none;
    font-size: .83rem; font-weight: 500;
    transition: background .18s;
    margin-top: 4px;
}
.sidebar-logout:hover { background: rgba(248,113,113,.1); color: #fca5a5; }

/* ── User menu dropdown ─────────────────────────────────────── */
.sidebar-user-menu  { position: relative; }
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: none; border: none;
    cursor: pointer;
    transition: background .18s;
    text-align: left;
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.sidebar-user-chevron {
    color: var(--sb-text);
    font-size: .75rem;
    flex-shrink: 0;
    transition: transform .2s;
}
.sidebar-user-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0; right: 0;
    background: #1e293b;
    border: 1px solid var(--sb-border);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    z-index: 200;
}
.sidebar-user-dropdown.show { display: block; }
.sidebar-user-dropdown-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .83rem;
    transition: background .15s;
}
.sidebar-user-dropdown-item:hover { background: rgba(255,255,255,.07); color: #f1f5f9; }
.sidebar-user-dropdown-item.text-danger { color: #f87171 !important; }
.sidebar-user-dropdown-item.text-danger:hover { background: rgba(248,113,113,.1); }

/* ── Topbar (mobile) ────────────────────────────────────────── */
.topbar {
    display: none;
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--sb-bg);
    align-items: center;
    padding: 0 16px;
    z-index: 1030;
    gap: 12px;
}
.topbar-toggle {
    background: none; border: none;
    color: #94a3b8; font-size: 1.3rem;
    cursor: pointer; padding: 6px;
    border-radius: 6px;
    transition: background .15s;
}
.topbar-toggle:hover { background: rgba(255,255,255,.08); }
.topbar-brand {
    color: #fff; font-weight: 700; font-size: .95rem;
    display: flex; align-items: center; gap: 8px;
    text-decoration: none;
}
.topbar-logo-icon {
    width: 28px; height: 28px;
    background: var(--sb-accent); border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: .85rem;
}

/* ── Overlay (mobile) ───────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1039;
}
.sidebar-overlay.show { display: block; }

/* ── Main content ───────────────────────────────────────────── */
.main-wrapper {
    margin-left: var(--sb-width);
    min-height: 100vh;
    display: flex; flex-direction: column;
}
.page-content {
    flex: 1;
    padding: 28px 32px;
}

/* ── Page header ────────────────────────────────────────────── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap; gap: 12px;
}
.page-header h1 {
    font-size: 1.35rem; font-weight: 700;
    color: #0f172a; margin: 0;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    border-radius: 12px 12px 0 0 !important;
    padding: 14px 18px;
}
.card-body { padding: 18px; }

/* ── Site cards (dashboard) ─────────────────────────────────── */
.site-card { border-top: 3px solid #e2e8f0; transition: box-shadow .2s; }
.site-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.site-card.ok   { border-top-color: #10b981; }
.site-card.fail { border-top-color: #ef4444; }

/* ── Status dot ─────────────────────────────────────────────── */
.status-dot {
    width: 10px; height: 10px;
    border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.status-dot.ok   { background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.status-dot.fail { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.status-dot.loading {
    background: #94a3b8;
    animation: skel-pulse 1.3s ease-in-out infinite;
}

/* ── Skeleton shimmer ───────────────────────────────────────── */
.skel {
    display: inline-block;
    width: 62%;
    height: 20px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skel-shimmer 1.5s infinite;
}
.skel.skel-sm { width: 36px; }
@keyframes skel-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@keyframes skel-pulse {
    0%, 100% { opacity: 0.3; }
    50%       { opacity: 1; }
}

@keyframes pulse {
    0%,100% { box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
    50%      { box-shadow: 0 0 0 6px rgba(16,185,129,.05); }
}
.status-dot.ok { animation: pulse 2.5s infinite; }

/* ── Stat pills ─────────────────────────────────────────────── */
.stat-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.stat-pill.version { background: #ede9fe; color: #6d28d9; }
.stat-pill.update  { background: #fef9c3; color: #92400e; }
.stat-pill.ok-bg   { background: #d1fae5; color: #065f46; }

/* ── Tables ─────────────────────────────────────────────────── */
.table { border-radius: 12px; overflow: hidden; }
.table thead th {
    background: #f8fafc;
    font-size: .78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: #64748b;
}
.table td { vertical-align: middle; }

/* ── Dashboard table ────────────────────────────────────────── */
.db-table thead th { white-space: nowrap; }
.db-site-row:hover td { background: #f8fafc !important; }
.db-site-row.status-fail { border-left: 3px solid #ef4444; }

.db-detail-row td { background: #fffbeb; }
.db-detail-inner {
    padding: 14px 20px;
    border-top: 1px solid #fef9c3;
    border-bottom: 1px dashed #fde68a;
}
.db-detail-title {
    font-size: .82rem; font-weight: 700;
    color: #92400e; margin-bottom: 10px;
}

/* ── Filters bar ────────────────────────────────────────────── */
.db-filters {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
}
.db-filters-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.db-filter-search {
    position: relative;
    flex: 1;
    min-width: 180px;
}
.db-filter-search .bi {
    position: absolute; left: 10px; top: 50%;
    transform: translateY(-50%);
    color: #94a3b8; font-size: .85rem; pointer-events: none;
}
.db-filter-search .form-control { padding-left: 30px; }
.db-filter-select { max-width: 200px; }

.db-status-tabs {
    display: flex; gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    flex-shrink: 0;
}
.db-status-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px;
    border: none; border-radius: 6px;
    background: transparent;
    font-size: .8rem; font-weight: 600; color: #64748b;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.db-status-tab:hover { background: rgba(255,255,255,.7); color: #0f172a; }
.db-status-tab.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.db-tab-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 18px;
    background: #e2e8f0;
    border-radius: 10px;
    font-size: .7rem; color: #475569;
    padding: 0 5px;
}
.db-status-tab.active .db-tab-count { background: #6366f1; color: #fff; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination .page-link {
    border-radius: 6px !important;
    margin: 0 2px;
    font-size: .82rem;
    color: #6366f1;
}
.pagination .page-item.active .page-link {
    background: #6366f1; border-color: #6366f1;
}


/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary   { background: var(--sb-accent); border-color: var(--sb-accent); }
.btn-primary:hover { background: #4f46e5; border-color: #4f46e5; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar      { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar       { display: flex; }
    .main-wrapper { margin-left: 0; padding-top: var(--topbar-h); }
    .page-content { padding: 20px 16px; }
}
@media (max-width: 575.98px) {
    .page-content { padding: 16px 12px; }
}


/* =============================================================
   Login
   ============================================================= */
.login-wrap { display: flex; height: 100vh; }

/* Panel izquierdo */
.login-brand {
    width: 46%;
    background: #640207;
    display: flex; flex-direction: column;
    justify-content: center; align-items: flex-start;
    padding: 60px 56px;
    position: relative; overflow: hidden;
}
.brand-logo {
    width: 52px; height: 52px;
    background: #850309;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: #fff;
    margin-bottom: 32px;
    box-shadow: 0 8px 24px rgba(100, 2, 7,.35);
    position: relative; z-index: 1;
}
.brand-title {
    font-size: 2rem; font-weight: 800;
    color: #fff; line-height: 1.2;
    margin-bottom: 14px;
    position: relative; z-index: 1;
}
.brand-title span { color: #ddd; }
.brand-desc {
    font-size: .95rem; color: #ddd; line-height: 1.6;
    max-width: 320px;
    position: relative; z-index: 1;
}
.brand-features {
    margin-top: 40px; display: flex; flex-direction: column; gap: 14px;
    position: relative; z-index: 1;
}
.brand-feature {
    display: flex; align-items: center; gap: 12px;
    color: #ddd; font-size: .875rem;
}
.brand-feature-icon {
    width: 32px; height: 32px;
    background: rgba(255,255,255,.08);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #ddd; font-size: .9rem; flex-shrink: 0;
}

/* Panel derecho */
.login-form-panel {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    background: #f8fafc;
    padding: 40px 32px;
    overflow-y: auto;
}
.login-box { width: 100%; max-width: 400px; }
.login-box h2 {
    font-size: 1.5rem; font-weight: 800;
    color: #0f172a; margin-bottom: 6px;
}
.login-box .subtitle {
    font-size: .9rem; color: #64748b; margin-bottom: 32px;
}
.input-icon-wrap { position: relative; }
.input-icon-wrap .bi {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: #94a3b8; font-size: .95rem;
}
.input-icon-wrap .form-control { padding-left: 38px; }
.btn-login {
    width: 100%; padding: 11px;
    background: linear-gradient(135deg, #850309, #640207);
    border: none; border-radius: 8px;
    color: #fff; font-weight: 700; font-size: .95rem;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    margin-top: 8px;
}
.btn-login:hover { opacity: .92; transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.error-box {
    background: #fef2f2; border: 1px solid #fecaca;
    border-radius: 8px; padding: 10px 14px;
    color: #dc2626; font-size: .85rem;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 20px;
}
.pass-toggle {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #94a3b8;
    cursor: pointer; padding: 4px; font-size: .95rem;
}
.pass-toggle:hover { color: #6366f1; }

/* ── Dashboard stats ──────────────────────────────────────────── */
.dash-kpi .card-body {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px;
}
.dash-kpi-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.dash-kpi-value {
    font-size: 1.8rem; font-weight: 800; line-height: 1;
    color: #0f172a;
}
.dash-kpi-label {
    font-size: .78rem; color: #64748b; margin-top: 2px;
}
.dash-category-bar {
    height: 6px; border-radius: 3px;
    background: #e2e8f0;
}
.dash-category-bar-fill {
    height: 100%; border-radius: 3px;
    background: #6366f1;
}
.dash-category-link {
    border-radius: 6px;
    margin: -4px -6px;
    padding: 4px 6px;
    transition: background .15s ease;
}
.dash-category-link:hover {
    background: #f1f5f9;
}
.dash-category-link:hover .small {
    color: #6366f1;
}

/* Responsive login */
@media (max-width: 767.98px) {
    .login-brand { display: none; }
    .login-wrap  { height: auto; min-height: 100vh; }
    .login-form-panel { padding: 40px 20px; }
}
