/* v5/assets/css/dashboard.css - Layout general V5 */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
}

.app-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 100vh;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0,1fr);
    }
}

/* Sidebar */

.sidebar {
    background: #111827;
    color: #e5e7eb;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--rav4-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 9px 22px rgba(200,16,46,0.35);
}

.sidebar-title {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.sidebar-title span:first-child {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #9ca3af;
}

.sidebar-title span:last-child {
    font-size: 14px;
    font-weight: 600;
}

.sidebar-nav {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #6b7280;
    margin: 6px 4px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: #e5e7eb;
    font-size: 13px;
}

.nav-link small {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #9ca3af;
}

.nav-link:hover {
    background: #1f2937;
}

.nav-link.active {
    background: linear-gradient(135deg, var(--rav4-red), #1f2937);
}

/* Topbar */

.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-soft);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left h1 {
    font-size: 18px;
    margin: 0;
}

.topbar-left .subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-pill {
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    padding: 4px 10px;
    background: transparent;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.theme-indicator {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--rav4-red);
}

/* Content */

.content {
    padding: 14px 16px 20px;
}

/* Cards & grids */

.grid {
    display: grid;
    gap: 12px;
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

@media (max-width: 900px) {
    .grid-3, .grid-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

.card {
    background: var(--bg-panel);
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    padding: 12px 12px 10px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.06);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
}

.card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
}

.metric-value {
    font-size: 20px;
    font-weight: 600;
    margin-top: 6px;
}

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Tables */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

thead {
    background: #f3f4f6;
}

th, td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}

th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--text-muted);
}

tr:nth-child(even) td {
    background: rgba(249,250,251,0.6);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
}

.status-pill.valid {
    background: #dcfce7;
    color: #16a34a;
}

.status-pill.expired {
    background: #fee2e2;
    color: #dc2626;
}

.small {
    font-size: 11px;
    color: var(--text-muted);
}
.badge-token {
    display:inline-block;
    padding:2px 8px;
    border-radius:999px;
    font-size:11px;
    font-weight:500;
}
.badge-token-ok {
    background:rgba(34,197,94,0.15);
    color:#bbf7d0;
    border:1px solid rgba(34,197,94,0.7);
}
.badge-token-missing {
    background:rgba(248,113,113,0.15);
    color:#fecaca;
    border:1px solid rgba(248,113,113,0.7);
}
/* --- ESTILOS DEL MENÚ LATERAL (SIDEBAR) --- */

/* Notificación de número de pendientes */
.badge-notify {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(248, 113, 113, 0.18);
    color: #fecaca;
    border: 1px solid rgba(248, 113, 113, 0.7);
}

/* Contenedor de submenús debajo de un nav-link principal */
.submenu-container {
    margin-left: 8px;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Enlaces del submenú dentro del sidebar */
.sidebar-nav .nav-link-sub {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px 6px 32px; /* un poco más sangrado que nav-link */
    border-radius: 999px;
    font-size: 13px;
    color: #e5e7eb;
    text-decoration: none;
    opacity: 0.85;
}

.sidebar-nav .nav-link-sub:visited {
    color: #e5e7eb;
    text-decoration: none;
}

/* Hover y activo */
.sidebar-nav .nav-link-sub:hover,
.sidebar-nav .nav-link-sub.active {
    background: rgba(248, 113, 113, 0.15);
    color: #fee2e2;
    opacity: 1;
}

/* Icono pequeño dentro del submenú */
.sidebar-nav .nav-link-sub .icon {
    font-size: 14px;
}

/* Aseguramos color base en enlaces del sidebar */
.sidebar-nav a,
.sidebar-nav a:visited {
    color: #e5e7eb;
    text-decoration: none;
}
