/* ===================================================
   1. BASE Y CONFIGURACIÓN GENERAL
=================================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding: 10px 30px 30px 30px; /* Solo 10px arriba para un margen mínimo */
    margin: 0;
    background-color: transparent;
    animation: fadeInPage 0.5s ease-in-out;
}

@keyframes fadeInPage {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Transición suave para el cambio de colores en modo oscuro */
* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    text-decoration: none;
    transition: 0.3s;
}

/* ===================================================
   2. SECCIÓN LOGIN (dash_01/index.php) — moderno
=================================================== */
:root {
    --login-brand: #0e7c86;
    --login-brand-dark: #0a4f55;
    --login-ink: #052c30;
    --login-muted: #5c6f71;
}

body.login-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
    color: var(--login-ink);
    background: linear-gradient(145deg, #042428 0%, #0a5f66 42%, #0e7c86 100%);
    background-attachment: fixed;
}

body.login-page * {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 18px 48px;
    position: relative;
}

.login-container::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 90% 80%, rgba(212, 175, 55, 0.08), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.content h1 {
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 22px;
    overflow: hidden;
    box-shadow:
        0 4px 6px rgba(5, 44, 48, 0.06),
        0 24px 48px rgba(5, 44, 48, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(14px);
}

.login-card__accent {
    height: 4px;
    background: linear-gradient(90deg, #d4af37, #0e7c86, #0a4f55);
}

.login-header {
    background: linear-gradient(165deg, #052c30 0%, #0a4f55 55%, #0e7c86 100%);
    color: #fff;
    padding: 36px 32px 32px;
    text-align: center;
}

.brand-logo {
    display: inline-block;
    margin-bottom: 20px;
    text-decoration: none;
    color: inherit;
}

.brand-logo:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 4px;
    border-radius: 8px;
}

.brand-logo__text {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #fff;
}

.brand-logo__accent {
    color: #7fd4dc;
    font-weight: 500;
}

.login-title {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.login-subtitle {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.88;
    font-weight: 400;
    line-height: 1.5;
}

.login-form {
    padding: 28px 28px 32px;
}

.login-form label {
    display: block;
    margin: 18px 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--login-muted);
}

.login-form label:first-of-type {
    margin-top: 0;
}

.login-field-wrap {
    position: relative;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 12px 12px 36px;
    border: 1px solid #d5e4e6;
    border-radius: 12px;
    outline: none;
    font-size: 1rem;
    background: #f8fcfc;
    color: var(--login-ink);
}

.login-form input[type="text"]:hover,
.login-form input[type="password"]:hover {
    border-color: #b8d4d8;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--login-brand);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(14, 124, 134, 0.15);
}

.login-field-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--login-brand);
    opacity: 0.75;
    pointer-events: none;
}

.login-form .options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.login-form .remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--login-muted);
    cursor: pointer;
    user-select: none;
}

.login-form .remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--login-brand);
    cursor: pointer;
}

.login-form .forgot {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--login-brand);
}

.login-form .forgot:hover {
    color: var(--login-brand-dark);
    text-decoration: underline;
}

.btn-acceso {
    width: 100%;
    background: linear-gradient(135deg, var(--login-brand) 0%, var(--login-brand-dark) 100%);
    color: #fff;
    border: none;
    padding: 15px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    margin-top: 24px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(14, 124, 134, 0.35);
}

.btn-acceso:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(14, 124, 134, 0.4);
}

.btn-acceso:active {
    transform: translateY(0);
}

.btn-acceso:focus-visible {
    outline: 2px solid #d4af37;
    outline-offset: 3px;
}

.btn-acceso svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.no-cuenta {
    text-align: center;
    margin: 22px 0 0;
    font-size: 0.9rem;
    color: var(--login-muted);
}

.no-cuenta .verde {
    color: var(--login-brand);
    font-weight: 700;
}

.no-cuenta .verde:hover {
    text-decoration: underline;
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 26px 0 20px;
    color: #94a3a8;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d5e4e6, transparent);
}

.social {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid #e0ecee;
    background: #fff;
    color: var(--login-muted);
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.social-link:hover {
    border-color: var(--login-brand);
    color: var(--login-brand);
    transform: translateY(-2px);
}

.social-link:focus-visible {
    outline: 2px solid var(--login-brand);
    outline-offset: 2px;
}

.social-link svg {
    width: 16px;
    height: 16px;
}

.login-back {
    position: relative;
    z-index: 1;
    margin: 24px 0 0;
    font-size: 0.9rem;
}

.login-back a {
    color: rgba(255, 255, 255, 0.92);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    padding-bottom: 2px;
}

.login-back a:hover {
    color: #fff;
    border-bottom-color: #d4af37;
}

@media (max-width: 480px) {
    .login-header {
        padding: 28px 22px 26px;
    }
    .login-form {
        padding: 22px 20px 28px;
    }
    .login-form .options {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===================================================
   3. ESTRUCTURA DEL PANEL (Sidebar, Topbar, Content)
=================================================== */

/* SIDEBAR */
.sidebar {
    width: 250px;
    height: 100vh;
    background: #f5f6fa; /* Fondo blanco */
    position: fixed;
    top: 0;
    left: 0;
    transition: 0.3s ease;
    z-index: 1000;
    border-right: 1px solid #e0e0e0; /* Línea sutil para separar del contenido */
}

.sidebar.collapsed { width: 50px; }

/* Título del Panel en color oscuro */
.sidebar-title {
    color: #1e1e2d; 
    text-align: center;
    padding: 30px 0;
    font-size: 22px;
    font-weight: 700;
}

/* Ítems del menú con texto oscuro */
.menu-item, .submenu-toggle {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: #555555; /* Gris oscuro para el texto */
    gap: 15px;
    cursor: pointer;
}
.menu-item i, .submenu-toggle i { font-size: 20px; color: #8e9aac; min-width: 25px; text-align: center; }

.menu-item:hover, .submenu-toggle:hover, .menu-item.active {
    background: rgba(255,255,255,0.05);
    color: #27cb63;
}

/* SUBMENÚS CORREGIDOS */
.submenu {
    display: none; /* Controlado por JS */
    background: #f5f6fa;
    flex-direction: column;
}

.submenu a {
    display: block;
    padding: 10px 10px 10px 65px;
    color: #bfc2cd;
    font-size: 14px;
}

.submenu a:hover { color: #27cb63; background: rgba(255,255,255,0.03); }

/* TOPBAR CORREGIDO */
.topbar {
    height: 50px;
    background: #fff;
    position: fixed;
    top: 0;
    left: 250px;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: 0.3s;
    z-index: 900;
}

.topbar.collapsed { left: 80px; }

.left-section { display: flex; align-items: center; gap: 20px; }
.toggle-btn { font-size: 24px; cursor: pointer; color: #333; }

.right-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* BUSCADOR */
.search-box {
    background: #f0f2f7;
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
}

.search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 150px;
}

/* BOTONES ICONO */
.icon-btn {
    background: #fff;
    border: 1px solid #ddd;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* ÁREA USUARIO */
.user-area { position: relative; cursor: pointer; }
.user-area img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; border: 2px solid #eee; }

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 55px;
    background: white;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    border-radius: 10px;
    padding: 10px 0;
    min-width: 180px;
    display: none;
    flex-direction: column;
}

.dropdown-menu a { padding: 10px 20px; color: #444; font-size: 14px; }
.dropdown-menu a:hover { background: #f8f9fa; color: #27cb63; }

/* ===================================================
   4. CONTENIDO Y TARJETAS (ESTABLE)
=================================================== */
.cards-row {
    display: flex;
    flex-wrap: wrap;       /* Permite que las tarjetas bajen si no hay espacio */
    gap: 20px;
    justify-content: center; /* Centra las tarjetas en el área disponible */
    width: 100%;
    margin-bottom: 25px;
}

/* La Tarjeta (Caja Blanca) */
.card {
    background: #ffffff;
    border-radius: 15px;
    padding: 30px 20px;
    flex: 1;               /* Hace que crezcan por igual */
    min-width: 250px;      /* Evita que se vuelvan demasiado flacas en PC */
    max-width: 350px;      /* Evita que una sola tarjeta sea gigante en PC */
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center; /* Centra el contenido horizontalmente */
    align-items: center;     /* Centra el contenido verticalmente */
    text-align: center;      /* Centra el texto */
}

/* Contenedor interno del texto */
.card-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-title {
    color: #888;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.card-value {
    color: #333;
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

/* AJUSTE PARA MÓVILES */
@media (max-width: 768px) {
    .cards-row {
        flex-direction: column; /* Apila las tarjetas una sobre otra */
        align-items: center;
    }
    
    .card {
        width: 100%;        /* Ocupan todo el ancho del celular */
        max-width: 100%;
    }
}
/* OCULTAR TEXTOS AL COLAPSAR */
.sidebar.collapsed .menu-text, 
.sidebar.collapsed .sidebar-title, 
.sidebar.collapsed .arrow, 
.sidebar.collapsed .submenu {
    display: none !important;
}

.sidebar.collapsed .menu-item, 
.sidebar.collapsed .submenu-toggle {
    justify-content: center;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar { left: -250px; }
    .sidebar.active { left: 0; }
    .topbar, .content { left: 0 !important; margin-left: 0 !important; }
}

/* Colores por defecto (Modo Claro) */
:root {
    --bg-body: #f5f6fa;
    --bg-card: #ffffff;
    --bg-topbar: #ffffff;
    --text-main: #333333;
    --text-muted: #888888;
    --border-color: #eeeeee;
}

/* Colores para el Modo Oscuro */
[data-theme="dark"] {
    --bg-body: #121212;
    --bg-card: #1e1e2d;
    --bg-topbar: #1e1e2d;
    --text-main: #e2e2e2;
    --text-muted: #a0a0a0;
    --border-color: #2b2b40;
}

/* APLICAR VARIABLES A LOS ELEMENTOS EXISTENTES */
body { background-color: var(--bg-body); color: var(--text-main); transition: 0.3s; }
.topbar { background-color: var(--bg-topbar); border-bottom: 1px solid var(--border-color); }
.content .card { background-color: var(--bg-card); color: var(--text-main); }
.card-title { color: var(--text-muted); }
.card-value { color: var(--text-main); }

/* Ajuste de tipografía para móviles */
@media (max-width: 768px) {
    .content h1, 
    .content h2 {
        font-size: 1.5rem !important; /* Reduce el tamaño del título */
        margin-bottom: 15px;
        line-height: 1.2;
    }

    .content {
        padding: 80px 15px 20px; /* Reduce los márgenes laterales en el móvil */
    }
}

/* ===================================================
   CORRECCIÓN RESPONSIVE DEL TÍTULO
=================================================== */
/* Tamaño para PC / Escritorio */
.welcome-title {
    font-size: 24px;      /* Tamaño más equilibrado para escritorio */
    font-weight: 700;
    color: #1e1e2d;
    margin-bottom: 20px;
    margin-top: 10px;     /* Evita que choque con la parte superior */
    letter-spacing: -0.5px;
}

/* Tamaño ajustable para Móviles (Media Query) */
@media (max-width: 768px) {
    .content {
        padding: 10px 15px 20px !important; /* Cambia 60px/80px por 10px */
    }
}

/* Ajuste crítico para el contenedor del iframe */
.content.collapsed {
    margin-left: 80px; /* Ancho del menú cerrado */
    width: calc(100% - 80px);
    transition: all 0.3s ease; /* Animación suave */
}

/* Empuje dinámico cuando el menú se expande */
.sidebar:not(.collapsed) ~ .content {
    margin-left: 250px; /* Ancho del menú abierto */
    width: calc(100% - 250px);
}

/* En móviles, el margen debe ser 0 para no apretar el contenido */
@media (max-width: 768px) {
    .content.collapsed, .sidebar:not(.collapsed) ~ .content {
        margin-left: 0;
        width: 100%;
    }
}

/* Color para la opción seleccionada */
.menu-item.active, 
.submenu a.active {
    color: #27cb63 !important; /* Verde como en tu diseño */
    background-color: rgba(39, 203, 99, 0.1); /* Fondo sutil */
    border-right: 4px solid #27cb63;
    font-weight: 600;
}

/* Centrado del contenedor principal */
.content {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centra horizontalmente las tarjetas */
    padding: 20px;
    gap: 20px;
}

/* Busca y actualiza esta regla en estilos.css */
.large-card {
    width: 100%;
    max-width: 100% !important; 
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column; /* Asegura que el título vaya arriba del gráfico */
    align-items: center;    /* Centra el gráfico horizontalmente */
}
/* Animación de entrada suave para toda la página */

/* Ajustes para dispositivos móviles */
@media (max-width: 768px) {
    /* El sidebar ahora flota desde la izquierda */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 260px !important; /* Ancho fijo para mostrar texto */
        z-index: 9998;
        transform: translateX(-100%); /* Escondido a la izquierda */
        transition: transform 0.3s ease;
        display: flex !important;
    }

    /* Clase activa que desliza el menú a la vista */
    .sidebar.active {
        transform: translateX(0);
    }

    /* Forzamos que los nombres de las opciones sean visibles */
    .sidebar.active .menu-text {
        display: block !important;
        opacity: 1 !important;
        width: auto !important;
    }

    /* El submenú se despliega verticalmente en lugar de lateral */
    .sidebar.active .submenu {
        position: relative !important;
        width: 100% !important;
        background: rgba(0,0,0,0.05); 
    }

    /* Aseguramos que el botón de menú esté por encima del sidebar para poder cerrar */
    .toggle-btn {
        position: relative;
        z-index: 9999;
    }

    /* El contenido principal no se desplaza en móvil */
    .content.collapsed, .content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}