html {
  scroll-behavior: smooth;
}

/* VARIABLES DE COLOR */
:root {
    --bg-body: #ffffff;
    --bg-navbar: #ffffff;
    --text-main: #161838;
    --text-muted: #555555;
    --text-subt: #666666;
    --bg-service: whitesmoke;
    --border-service: none;
    --bg-card: white;
    --bg-minicard: ghostwhite;
    --border-color: #e0e0e0;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.15);
    --bg-cta: linear-gradient(rgba(22, 24, 56, 1), rgba(22, 24, 56, 0.95));
    --bg-footer: #161838;
    --accent-color: #00a8ff;
}

/* CLASES MODO OSCURO */
[data-theme="dark"] {
    --bg-body: #0D0B29;
    --bg-navbar: #11122d;
    --text-main: #E0E0E0;
    --text-muted: #BFBFBF;
    --text-subt: #999999;
    --bg-service: #08071A;
    --border-service: #10133C;
    --bg-card: #161932;
    --bg-minicard: #0D0B29;
    --border-color: #2e3152;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    --card-shadow-hover: 0 8px 25px rgba(0, 168, 255, 0.2);
    --bg-cta: linear-gradient(rgba(22, 24, 56, 0.85), rgba(22, 24, 56, 0.1));
}

/* Efecto oscuro */
[data-theme="dark"] .logo-img{
    filter: invert(1) brightness(1.5);
}
[data-theme="dark"] .menu-toggle .bar { background-color: var(--text-main); }
[data-theme="dark"] .theme-btn {
    border-bottom: 1px solid var(--border-color) ;
}
[data-theme="dark"] .theme-btn svg{
    transform: rotate(360deg);
}
[data-theme="dark"] .nav-icon-login {
    filter: invert(1) brightness(0.9);
}
[data-theme="dark"] .nav-icon-user,
[data-theme="dark"] .nav-icon-exit,
[data-theme="dark"] .nav-icon-login,
[data-theme="dark"] .nav-icon-sm {
    filter: invert(1);
}
[data-theme="dark"] .admin-crown {
    filter: invert(1) drop-shadow(0 2px 2px rgba(255,255,255,0.1));
}

/* Estilo del botón de cambio de tema */
.theme-btn {
    background: none;
    border: 1px solid var(--border-color); /* Usando tus variables */
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
    color: var(--text-main); /* el icono tomara el color del texto */
}

.theme-btn svg{
    display: block;
    transition: transform 0.4s ease;
}

.theme-btn:hover {
    background-color: rgba(0, 168, 255, 0.1);
    color: var(--accent-color); /* el icono se vuelve azul al pasar el mouse */
}

/* Reset básico para evitar espacios extra */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Transición global para que el fondo no cambie de golpe */
body, section, .navbar, .service-card, .cliente-burbuja {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

body{
    background-color: var(--bg-body);
    color: var(--text-main);   
}

/* Esto asegura que ninguna página empiece "debajo" del navbar */
main {
    padding-top: 80px;
}

/* Contenedor Global */
.container{
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

/* NAVEGACIÓN (NAVBAR) */
.navbar {
    width: 100%;
    height: 80px; /* Un poco más de altura para que respire el logo */
    background-color: var(--bg-navbar);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    position: fixed; /* Lo fija en la pantalla */
    top: 0;          /* Lo pega al borde superior */
    left: 0;         /* Asegura que empiece desde la izquierda */
    z-index: 1000;   /* Lo mantiene por encima de todo el contenido */
}

/* El contenedor es la clave para centrar el contenido */
.navbar .container {
    display: flex;
    justify-content: space-between; /* Logo a la izquierda, enlaces a la derecha */
    align-items: center;
    width: 100%; /* Ocupa el ancho máximo definido en .container (1200px) */
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    margin-right: 20px; /* Espacio entre el logo y los enlaces */
}

.logo-img {
    height: 55px; /* Ajusta el tamaño de la imagen */
    width: auto;
    display: block;
    transition: filter 0.4s ease; /* para que el cambio de color sea suave */
    object-fit: contain;
}

/* Enlaces */
.nav-links {
    display: flex;
    gap: 20px; /* Espaciado uniforme entre links */
    align-items: center;
}

.nav-item {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item:hover {
    color: #00a8ff; /* Color de realce */
}

.nav-item::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: #00a8ff;
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

/* Tamaños para iconos del navbar */
.nav-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-icon-user, 
.nav-icon-exit, 
.nav-icon-login {
    width: 24px;
    height: 24px;
    display: block;
    transition: transform 0.2s ease, filter 0.3s ease;
}

.nav-icon-sm {
    width: 18px;
    height: 18px;
}

/* MENU HAMBURGUESA (oculto por defecto) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

.menu-toggle .bar {
    width: 100%;
    height: 3px;
    background-color: #161838;
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* MEJORAS DE LOGIN/LOGOUT (NAVBAR) */
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-minicard); /* Usa las variables existentes */
    padding: 5px 12px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    margin-left: 10px;
}

.user-name { 
    font-weight: 600; 
    font-size: 0.85rem; 
    color: var(--text-main); /* Mantiene el color del tema */
}

.logout-link { 
    color: #ff4d4d;
    text-decoration: none; 
    font-size: 0.85rem;
    transition: 0.3s ease;
}

.logout-link:hover { 
    opacity: 0.7;
    text-decoration: underline;
}

.login-link:hover {
    background-color: rgba(0, 168, 255, 0.1);
}

.login-link:hover .nav-icon-login {
    transform: translateX(2px); /* Pequeño salto hacia la derecha */
    filter: drop-shadow(0 0 5px var(--accent-color));
}

/* CONTENEDOR DE PERFIL DE USUARIO */
.user-profile-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

/* La Corona (Diferenciador Admin) */
.admin-crown {
    width: 18px; /* Un poco más pequeña que el icono de usuario */
    height: 18px;
    pointer-events: none;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

/* Display AdminPanel */
.admin-display {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(15px);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    min-width: 200px;
    box-shadow: var(--card-shadow-hover);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

/* Flechita superior */
.admin-display::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border-color);
}

/* Mostrar al hacer Hover */
.user-profile-wrapper:hover .admin-display {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(8px);
}

/* Estilos internos del display */
.display-header {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 8px 12px;
    letter-spacing: 0.5px;
}

.display-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.display-item:hover {
    background-color: rgba(0, 168, 255, 0.1);
    color: var(--accent-color);
}

/* ALERTAS DE INICIO DE SESIÓN */
.alert-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    animation: slideIn 0.5s ease forwards;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: opacity 0.5s ease, transform 0.5s ease; /* Para el desvanecimiento */
}

.alert-popup.error { 
    background: #ff4d4d; 
    color: white; 
    border-left: 5px solid #b30000; 
}

.alert-popup.success { 
    background: #2ecc71; 
    color: white; 
    border-left: 5px solid #1e8449; 
}

/* Los textos dentro de la alerta ahora heredan el color white */
.alert-content strong { color: white; display: block; font-size: 0.9rem; }
.alert-content p { color: rgba(255,255,255,0.9); margin: 0; font-size: 0.8rem; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* SCRIPT BACK-TO-TOP */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: #161838; /* Tu azul de marca */
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 999;
    /* Estado inicial: oculto */
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    transform: translateY(20px); /* Efecto de que sube al aparecer */
}

/* Cuando el JS le agregue esta clase, se mostrará */
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: #00a8ff;
    transform: scale(1.1);
}

/* CABECERAS INICIALES DE LAS PÁGINAS */
.upper-container {
    width: 100%;
    margin: 0;
    padding: 100px 0; /* Aumenta el padding para dar más aire */
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #161838 0%, #2E46FF 100%);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    background-blend-mode: soft-light;
}

.upper-container .container{
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.upper-container h1 {
    color: ghostwhite;
    font-size: 3rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.upper-container p {
    color: #bdc3c7;
    font-size: 1.2rem;
    max-width: 700px;
    line-height: 1.6;
    margin-bottom: 35px;
}

/* FOOTER */
footer {
    background-color: #161838;
    color: #ffffff;
    padding: 60px 5% 20px 5%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Contenedor principal */
.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Columnas */
.footer-info {
    flex: 1; /* La columna de GKEM es un poco más ancha */
    min-width: 230px;
}

.footer-column {
    flex: 0.5;
    min-width: 200px;
}

.footer-logo{
    height: 50px;
    width: auto;
    display: block;
    object-fit: contain;
}

footer h2 {
    color: whitesmoke;
    margin-top: 0;
    font-size: 1.8rem;
    letter-spacing: 1px;
}

footer h3 {
    color: #ffffff;
    font-size: 1.2rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #00a8ff;
    display: inline-block;
    padding-bottom: 5px;
}

footer p {
    line-height: 1.6;
    color: #bdc3c7;
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

footer ul li {
    margin-bottom: 12px;
}

footer ul li a {
    color: #bdc3c7;
    text-decoration: none;
    display: inline-block; /* Permite que la transformación funcione */
    transition: all 0.3s ease; /* Transición suave */
}

footer ul li a:hover {
    color: #00a8ff;
    transform: translateX(8px) scale(1.05); /* Se desliza y crece un poco */
    text-shadow: 0px 0px 8px rgba(0, 168, 255, 0.3); /* Brillo sutil */
}

/* Sección de contacto */
/* Estilo para los datos que no son enlaces */
footer li[alt] {
    color: #bdc3c7;
    font-size: 0.95rem;
}

/* Copyright */
.footer-bottom {
    width: 100%;
    text-align: center;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #34495e;
    font-size: 0.9rem;
    color: #bdc3c7;
}

/* VISTA MÓVIL */
@media (max-width: 768px) {
    .user-menu {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 15px 0;
        /*background: transparent !important;*/
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        /* Eliminamos cualquier rastro de bordes redondeados o fondos */
        /*background: transparent !important;*/
        border: none !important; 
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important; /* Línea separadora */
        border-radius: 0 !important;
    }

    .nav-links a.nav-item {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
        text-align: center;
        padding: 15px 0;
    }

    .user-profile-wrapper {
        border: none !important;
        background: none !important;
        padding: 0 !important;
        display: flex;
        align-items: center;
    }

    #theme-toggle {
        width: 100%;
        padding: 15px 0;
        background: transparent;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Línea final */
        display: flex;
        justify-content: center;
        margin: 0;
    }

    .admin-crown, .nav-icon-exit {
        width: 18px;
        height: auto;
        filter: none; /* Por si tenían algún efecto raro */
    }

    .menu-toggle {
        display: flex; /* Mostrar hamburguesa */
    }

    .navbar {
        padding: 0 20px; /* Línea original era 40px */
        justify-content: space-between;
        overflow: hidden;
    }

    .nav-links {
        display: flex; /* Oculta los enlaces para que no choquen con el logo */
        position: fixed;
        left: -100%; /* Lo sacamos de la pantalla a la izquierda */
        top: 80px;
        flex-direction: column;
        background-color: var(--bg-navbar);
        width: 100%;
        height: calc(100vh - 80px);
        text-align: center;
        transition: 0.4s ease;
        box-shadow: 0 10px 10px rgba(0,0,0,0.1);
        z-index: 999;    
    }

    /* Esta es la clase que activa el JavaScript */
    .nav-links.active {
        left: 0; /* Lo mete de nuevo a la pantalla */
        }

    .nav-item, 
    .theme-btn, 
    .login-btn {
        width: 100%;
        padding: 20px 0;
        font-size: 1.2rem;
        border-bottom: 1px solid var(--border-color);
        display: flex; /* Cambiado a flex para centrar iconos y texto */
        justify-content: center;
        align-items: center;
        transition: background 0.3s;
        background: none; /* Quitamos fondos de botón en móvil */
        border-radius: 0;
        margin: 0;
        color: var(--text-main);
    }

    .theme-btn{
        border-left: none;
        border-right: none;
        border-top: none;
        margin-left: 0;
    }

    .nav-item:active, .theme-btn:active {
        background-color: #f9f9f9;
        color: #00a8ff;
    }

    .logo {
        margin-right: 0;
    }

    .login-btn a{
        padding: 0;
        color: inherit;
        font-weight: 500;
        width: 100%;
        height: auto;
    }

    /* Animación del menú hamburguesa a X */
    .menu-toggle.is-active .bar:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    .menu-toggle.is-active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.is-active .bar:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    .upper-container h1 {
        font-size: 2.2rem;
    }
}