@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
    --primary: #80B9EE;
    --secondary: #B3BFCD;
    --white: #ffffff;
    --dark-blue: #283E51;
}

/* ── RESET Y BASE ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body,
body.dashboard-body {
    margin: 0;
    font-family: 'Inter', 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
    font-feature-settings: 'cv02','cv03','cv04','cv11';
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, #0f1e2d 0%, #1a2f45 25%, #283E51 50%, #1e3a5a 75%, #4B79A1 100%);
    background-size: 600% 600%;
    animation: bgShift 10s ease infinite;
    color: var(--white);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Orbe superior izquierdo — más visible */
body::before {
    content: '';
    position: fixed;
    top: -30%;
    left: -20%;
    width: 80%;
    height: 80%;
    background: radial-gradient(ellipse at center,
        rgba(128,185,238,0.18) 0%,
        rgba(75,121,161,0.10) 40%,
        transparent 70%
    );
    animation: orbita1 14s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
/* Orbe inferior derecho — más visible */
body::after {
    content: '';
    position: fixed;
    bottom: -25%;
    right: -15%;
    width: 75%;
    height: 75%;
    background: radial-gradient(ellipse at center,
        rgba(40,100,160,0.22) 0%,
        rgba(30,80,130,0.12) 40%,
        transparent 70%
    );
    animation: orbita2 18s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes bgShift {
    0%   { background-position: 0% 0%;     }
    25%  { background-position: 100% 0%;   }
    50%  { background-position: 100% 100%; }
    75%  { background-position: 0% 100%;   }
    100% { background-position: 0% 0%;     }
}
@keyframes orbita1 {
    0%   { transform: translate(0,0)      scale(1);    opacity:0.9; }
    33%  { transform: translate(8%,12%)   scale(1.1);  opacity:1;   }
    66%  { transform: translate(-5%,6%)   scale(0.95); opacity:0.8; }
    100% { transform: translate(0,0)      scale(1);    opacity:0.9; }
}
@keyframes orbita2 {
    0%   { transform: translate(0,0)      scale(1);    opacity:0.9; }
    33%  { transform: translate(-8%,-8%)  scale(1.12); opacity:1;   }
    66%  { transform: translate(6%,-4%)   scale(0.92); opacity:0.8; }
    100% { transform: translate(0,0)      scale(1);    opacity:0.9; }
}

/* Tercer orbe central sutil */
.bg-orbe-center {
    position: fixed;
    top: 30%;
    left: 35%;
    width: 40%;
    height: 40%;
    background: radial-gradient(ellipse at center,
        rgba(100,160,220,0.10) 0%,
        transparent 65%
    );
    animation: orbita3 22s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}
@keyframes orbita3 {
    0%   { transform: translate(0,0)     opacity:0.6; }
    50%  { transform: translate(-10%,8%) opacity:1;   }
    100% { transform: translate(0,0)     opacity:0.6; }
}

/* Asegurar que el contenido quede sobre las animaciones */
.navbar, .main-content, .modal-overlay,
.auth-page, .verify-page, .setup-page,
.clientes-page, .empleados-page, .presupuestos-page,
.usuarios-page, #splash, #perfil-overlay, #logout-confirm,
#ni-perfil-overlay, #ni-logout-confirm {
    position: relative;
    z-index: 1;
}
.navbar { z-index: 100; }

/* ── NAVBAR ───────────────────────────────────────────────────────────────── */
.navbar {
    background: rgba(0,0,0,0.2);
    backdrop-filter: blur(15px);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo { display: flex; align-items: center; gap: 10px; }
.mini-logo { width: 100px; }
.logo-text { font-size: 2.5rem; color: var(--secondary); margin: 0; }
.logo-text span { color: var(--primary); font-weight: bold; }
.menu-toggle { background: none; border: none; color: white; font-size: 2rem; cursor: pointer; }

.nav-links {
    display: none;
    list-style: none;
    position: absolute;
    top: 60px;
    right: 50px;
    background: var(--dark-blue);
    padding: 20px;
    border-radius: 10px;
    flex-direction: column;
    gap: 15px;
    margin: 0;
}
.nav-links.active { display: flex; }
.nav-links li { margin: 0; }

/* Ajuste de espaciado de los ítems del menú hamburguesa */
.nav-links li:nth-child(2) { margin-top: -10px; }
.nav-links li:nth-child(3) { margin-top: -15px; }
.nav-links li:nth-child(4) { margin-top: -20px; } /* Iniciar Sesión / Registrarse */
.nav-links li:nth-child(5) { margin-top: -10px; } /* Avatar de usuario */

.nav-links a { color: white; text-decoration: none; font-weight: 500; display: block; }
.highlight { color: var(--primary) !important; font-weight: bold; }

/* ── DASHBOARD ────────────────────────────────────────────────────────────── */
.main-content { padding: 20px; max-width: 1000px; margin: 0 auto; }

.search-bar {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    margin: 20px auto;
    border: 1px solid rgba(255,255,255,0.3);
}
.search-bar input {
    background: none; border: none; color: white;
    margin: 0; padding: 5px 10px; width: 100%; font-size: 1rem;
}
.search-bar input::placeholder { color: #cbd5e1; }
.search-bar input:focus { outline: none; }

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 250px);
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
}

.grid-item {
    width: 250px;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}
.grid-item:hover { background: rgba(255,255,255,0.2); transform: translateY(-5px); }
/* diseno-btn usa estilos estándar de grid-item */
.icon-box { font-size: 2rem; margin-bottom: 10px; }
.dash-footer { margin-top: 40px; text-align: center; opacity: 0.8; font-style: italic; }

/* ── MODAL OVERLAY ────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
    /* Scroll por si el modal es alto en pantallas pequeñas */
    overflow-y: auto;
    padding: 20px;
}

.auth-modal.extra {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255,255,255,0.3);
    width: 100%;
    max-width: 370px;
    text-align: center;
}

h2 { margin: 0 0 20px; color: #80B9EE; }

/* ── INPUTS GENERALES ─────────────────────────────────────────────────────── */
input, select {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    background: rgba(255,255,255,0.15);
    color: var(--white);
    transition: border-color 0.2s, background 0.2s;
}
input::placeholder { color: rgba(255,255,255,0.6); }
input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.22);
}
select option { background: var(--dark-blue); color: white; }

/* Dos inputs en fila (nombre + apellido) */
.input-row {
    display: flex;
    gap: 8px;
}
.input-row input { margin-bottom: 12px; }

/* ── WRAPPER CONTRASEÑA (CLAVE DEL FIX) ──────────────────────────────────── */
/*
 * El pass-wrapper es position:relative y contiene SOLO el input y el botón ojo.
 * La caja de requisitos es un hermano FUERA del wrapper, así el ojo
 * NO se mueve cuando aparece la caja de hints.
 */
.pass-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

.pass-wrapper input {
    width: 100%;
    margin-bottom: 0;          /* El margin lo da el wrapper, no el input */
    padding-right: 44px;       /* Espacio para el botón ojo */
}

/* Botón ojo: absolutamente posicionado dentro del wrapper */
.toggle-pass {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    line-height: 1;
    color: rgba(255,255,255,0.7);
    transition: color 0.2s;
    /* Asegura que no empuje nada */
    display: flex;
    align-items: center;
    justify-content: center;
}
.toggle-pass:hover { color: var(--white); }

/* ── CAJA DE REQUISITOS DE CONTRASEÑA ─────────────────────────────────────── */
/*
 * Va FUERA del pass-wrapper (hermano en el DOM) para no afectar el ojo.
 * Se muestra/oculta con la clase .hidden mediante JS.
 */
.password-hints {
    background: rgba(0,0,0,0.35);
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 4px;
    margin-bottom: 12px;
    text-align: left;
}

.password-hints .hint {
    font-size: 12px;
    line-height: 1.9;
    color: rgba(255,255,255,0.65);
    transition: color 0.2s;
}

.password-hints .hint.ok {
    color: #7ed0a0;
}

/* ── BOTONES ──────────────────────────────────────────────────────────────── */
.btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: opacity 0.2s, transform 0.1s;
    width: 100%;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-close {
    background: none;
    border: none;
    color: var(--secondary);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 4px;
}

.btn-login {
    background: var(--primary);
    color: var(--white);
    border: 1px solid white;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}
.btn-register {
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
}

/* ── PERFIL Y DROPDOWN ────────────────────────────────────────────────────── */
.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-avatar {
    width: 40px; height: 40px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
    transition: transform 0.3s;
    border: 2px solid rgba(255,255,255,0.2);
    user-select: none;
}
.user-avatar:hover { transform: scale(1.05); }

.user-dropdown {
    position: absolute;
    top: 55px; right: 0;
    background: rgba(40,62,81,0.95);
    backdrop-filter: blur(10px);
    list-style: none;
    padding: 8px 0;
    border-radius: 12px;
    display: none;
    width: 170px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    z-index: 1001;
    margin: 0;
}
.user-dropdown.active { display: block; animation: fadeInDown 0.2s ease-out; }
.user-dropdown li a {
    color: var(--white);
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s, padding-left 0.2s, color 0.2s;
}
.user-dropdown li a:hover {
    background: rgba(128,185,238,0.2);
    color: var(--primary);
    padding-left: 25px;
}

/* ── TOAST (NOTIFICACIONES) ───────────────────────────────────────────────── */
/*
 * El contenedor está en el HTML como <div id="toast-container">.
 * Los toasts se apilan verticalmente desde arriba al centro.
 */
#toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    /* Ancho máximo para no ocupar toda la pantalla en desktop */
    width: 90%;
    max-width: 420px;
    pointer-events: none; /* Los toasts no bloquean clics */
}

.toast {
    width: 100%;
    background: #1a252f;
    color: #fff;
    padding: 14px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    border-left: 5px solid #ff4d4d;
    pointer-events: auto;
    animation: toastIn 0.35s ease forwards;
}

.toast.success { border-left-color: #7ed0a0; }
.toast.error   { border-left-color: #ff4d4d; }
.toast.info    { border-left-color: var(--primary); }

@keyframes toastIn {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateY(0);     opacity: 1; }
    to   { transform: translateY(-20px); opacity: 0; }
}

/* ── GRID EN PANTALLAS GRANDES ────────────────────────────────────────────── */
@media (max-width: 860px) {
    .grid-container { grid-template-columns: repeat(2, 250px); }
}
@media (max-width: 560px) {
    .grid-container { grid-template-columns: repeat(1, minmax(200px, 300px)); }
    .grid-item { width: 100%; }
}

/* ── MODAL DISEÑO responsive ── */
@media (max-width: 600px) {
    .diseno-grid { grid-template-columns: 1fr; }
    .input-row { flex-direction: column; gap: 0; }
}

/* ── ANIMACIONES ──────────────────────────────────────────────────────────── */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── UTILIDADES ───────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
