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

:root {
    /* Institutional Palette (Purple JVN) */
    --p-h: 275;
    --p-s: 100%;
    --p-l: 25%;

    --primary: hsl(var(--p-h), var(--p-s), var(--p-l));
    --primary-light: hsl(var(--p-h), var(--p-s), calc(var(--p-l) + 15%));
    --primary-dark: hsl(var(--p-h), var(--p-s), calc(var(--p-l) - 10%));

    --accent: hsl(280, 85%, 60%);
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 0.5);
    --text-main: #0f172a;
    --text-muted: #475569;
    --input-bg: #ffffff;
    --input-border: #e2e8f0;
    --error: #ef4444;

    /* Premium Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-premium: 0 25px 50px -12px rgba(75, 0, 130, 0.15);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-image: url('https://bitrix24public.com/baltic.bitrix24.es/docs/pub/7d67c28887490ed8b6279de3f5fc8061/showPreview/?&token=5t3e659zc8yr');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-main);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* --- DYNAMIC MESH BACKGROUND --- */
.bg-mesh,
.bg-blob,
.bg-blob-2 {
    position: fixed !important;
    overflow: hidden !important;
    pointer-events: none !important;
    z-index: -1 !important;
    max-width: 100vw !important;
}

.bg-glass-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(68, 71, 91, 0.4); /* Reduced opacity to reveal background image */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: -1;
    pointer-events: none;
}

.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background: radial-gradient(at 0% 0%, hsla(275, 100%, 25%, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(280, 85%, 60%, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(275, 100%, 25%, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(280, 85%, 60%, 0.08) 0px, transparent 50%);
}

.bg-pattern-dots {
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px);
    background-size: 24px 24px;
}

.bg-blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: hsla(var(--p-h), var(--p-s), var(--p-l), 0.1);
    filter: blur(120px);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    animation: move 25s infinite alternate ease-in-out;
}

.bg-blob-2 {
    bottom: -100px;
    right: -100px;
    background: hsla(280, 85%, 60%, 0.1);
    animation-delay: -5s;
    width: 500px;
    height: 500px;
}

@keyframes move {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(100px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-50px, 80px) scale(0.9);
    }

    100% {
        transform: translate(60px, 60px) scale(1.05);
    }
}

/* --- COMPONENTS --- */

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 35px 60px -15px rgba(75, 0, 130, 0.2);
}

/* SweetAlert2 Fix */
.swal2-container {
    z-index: 15000 !important;
}

header {
    position: relative;
    z-index: 2000 !important;
}

h1,
h2,
h3 {
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* --- BUTTONS --- */
.btn-premium {
    background: linear-gradient(to right, hsl(275, 80%, 45%), hsl(275, 100%, 20%));
    color: white;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(75, 0, 130, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-cart {
    overflow: visible !important;
}

.btn-premium::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
    pointer-events: none;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(75, 0, 130, 0.3);
    filter: brightness(1.1);
}

.btn-premium:hover::after {
    left: 100%;
}

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

.btn-outline-premium {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline-premium:hover {
    background: hsla(var(--p-h), var(--p-s), var(--p-l), 0.05);
    transform: translateY(-1px);
}

/* --- INPUTS --- */
.input-premium {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--input-border);
    border-radius: 14px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.5);
}

.input-premium:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px hsla(var(--p-h), var(--p-s), var(--p-l), 0.1);
}

/* --- MODALS --- */
.modal-overlay,
.overlay-blur {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 10000;
    display: none;
    place-items: center !important;
    padding: 0;
    margin: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active,
.overlay-blur.active {
    display: grid !important;
    opacity: 1;
}

/* --- UTILITIES --- */
.view {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    position: relative;
    z-index: 1;
}

@media (max-width: 640px) {
    .view.active {
        padding-top: 10px;
    }
}

/* LOADER SPIN */
.spinner-premium {
    width: 64px;
    height: 64px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-left-color: white;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

@media (max-width: 640px) {
    .spinner-premium {
        width: 80px;
        height: 80px;
        border-width: 6px;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

body.no-scroll {
    overflow: hidden !important;
    height: 100vh !important;
}

/* User Profile Header */
.user-profile-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    padding: 6px 6px 6px 20px;
    border-radius: 99px;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
}

/* Obsolete header-stats-bar removed */

.header-stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.header-stat-label-group {
    display: flex;
    flex-direction: column;
}

.header-stat-item .label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0px;
    line-height: 1;
}

.header-stat-item .value-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--primary);
    background: hsla(var(--p-h), var(--p-s), var(--p-l), 0.1);
    padding: 4px 12px;
    border-radius: 10px;
    border: 1px solid hsla(var(--p-h), var(--p-s), var(--p-l), 0.1);
}

.header-stat-item .value-text {
    font-size: 1rem;
    font-weight: 800;
    color: var(--slate-800);
}

.header-stat-divider {
    width: 1px;
    height: 20px;
    background: var(--card-border);
    margin: 0 16px;
    opacity: 0.6;
}

/* User Menu Trigger */
.user-menu-trigger {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--card-border);
    cursor: pointer;
    padding: 4px 4px 4px 12px;
    border-radius: 99px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-menu-trigger:hover {
    background: white;
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.user-menu-trigger:hover .avatar-circle {
    transform: rotate(15deg);
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 15px);
    width: max-content;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000 !important;
    padding: 10px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    color: #ef4444;
    /* Bright Red */
    font-weight: 800;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: rgba(239, 68, 68, 0.05);
}

.logout-link:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

/* DROPDOWN NAV FIXES (Globally Applied) */
.nav-link-dropdown, .logout-link-dropdown {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #334155; /* Dark slate for visibility */
    transition: all 0.2s ease;
    text-decoration: none;
    font-weight: 600;
}

.nav-link-dropdown:hover {
    background: rgba(79, 70, 229, 0.05);
    color: #4f46e5;
}

.logout-link-dropdown {
    color: #fda4af;
}

.logout-link-dropdown:hover {
    background: rgba(244, 63, 94, 0.1);
    color: #fb7185;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link svg {
    color: var(--primary);
    transition: transform 0.2s;
}

.nav-link:hover {
    background: hsla(var(--p-h), var(--p-s), var(--p-l), 0.05);
    color: var(--primary);
}

.nav-link:hover svg {
    transform: translateX(3px);
}

.dropdown-divider {
    height: 1px;
    background: var(--input-border);
    margin: 8px 0;
    opacity: 0.5;
}

@media (max-width: 768px) {
    .header-stats-bar {
        display: none;
    }

    .user-profile-container {
        padding-left: 6px;
    }
}

/* --- SHARED PREMIUM COMPONENTS --- */
.header-unified-bar {
    background: white;
    padding: 8px 12px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.header-unified-item {
    padding: 6px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.unified-label {
    font-size: 9px;
    font-weight: 900;
    color: #64748b;
    margin-bottom: 4px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.unified-value-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(204, 102, 255, 0.08);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid rgba(204, 102, 255, 0.2);
}

.unified-value-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.03);
    padding: 4px 12px;
    border-radius: 12px;
}

.unified-value-text {
    font-size: 1.1rem;
    font-weight: 900;
    color: #1e1b4b;
}

.unified-divider {
    width: 1px;
    height: 35px;
    background: rgba(0, 0, 0, 0.08);
}

.user-unified-trigger {
    background: rgba(79, 70, 229, 0.05);
    padding: 6px 16px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid rgba(79, 70, 229, 0.1);
    margin-left: 10px;
}

.user-unified-trigger:hover {
    background: rgba(79, 70, 229, 0.1);
}

.avatar-circle-xs {
    width: 28px;
    height: 28px;
    background: #4f46e5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    border: 2px solid white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.white-content-area {
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
}

@media (max-width: 640px) {
    .glass-card {
        border-radius: 20px;
        padding: 1.5rem;
    }
}

/* --- FORM TEXTURE BACKGROUND --- */
.bg-pattern-dots {
    background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
}

/* --- PREMIUM FORM INPUT WITH ICON --- */
.input-with-icon {
    width: 100%;
    padding: 14px 16px 14px 44px; /* Espacio izquierdo para el ícono */
    background-color: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 1rem; /* rounded-2xl */
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.3s ease;
    outline: none;
}

.input-with-icon:hover {
    border-color: #cbd5e1;
}

.input-with-icon:focus {
    background-color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px hsla(var(--p-h), var(--p-s), var(--p-l), 0.1);
}

.input-with-icon::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.input-icon-wrapper {
    position: relative;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    transition: color 0.3s ease;
}

.input-icon-wrapper:focus-within .input-icon {
    color: var(--primary);
}