/* =============================================
   HEADER DROPDOWN & DARK MODE — Lexica
   ============================================= */

/* ---- User Profile Container ---- */
.user-profile-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* ---- Profile Trigger (Avatar + Name + Chevron) ---- */
.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 14px 6px 6px;
    border-radius: 50px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ---- Avatar Circle ---- */
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9f1c, #e38a15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 16px;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 159, 28, 0.35);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.profile-trigger:hover .user-avatar {
    transform: scale(1.08);
}

/* ---- User Name ---- */
.user-display-name {
    font-weight: 800;
    font-size: 14px;
    color: #1a1a2e;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Chevron ---- */
.profile-chevron {
    width: 18px;
    height: 18px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    opacity: 0.6;
}

.user-profile-container.open .profile-chevron {
    transform: rotate(180deg);
}

/* ---- Dropdown Menu ---- */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.user-profile-container.open .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ---- Dropdown Header ---- */
.dropdown-header {
    padding: 18px 20px;
    background: linear-gradient(135deg, #83E4D1 0%, #5ac2af 100%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-header .user-avatar-lg {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff9f1c, #e38a15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
    color: #fff;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.dropdown-user-info {
    overflow: hidden;
}

.dropdown-user-name {
    font-weight: 900;
    font-size: 15px;
    color: #1a1a2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-user-role {
    font-size: 12px;
    color: rgba(26, 26, 46, 0.6);
    font-weight: 600;
}

/* ---- Dropdown Body ---- */
.dropdown-body {
    padding: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #2d3436;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    box-sizing: border-box;
}

.dropdown-item:hover {
    background: #f0faf7;
    color: #5ac2af;
    padding-left: 24px;
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.dropdown-item:hover svg {
    opacity: 1;
}

.dropdown-item span {
    flex: 1;
}

/* ---- Dropdown Separator ---- */
.dropdown-separator {
    height: 1px;
    background: linear-gradient(90deg, transparent 5%, #e0e0e0 50%, transparent 95%);
    margin: 4px 0;
}

/* ---- Logout Item ---- */
.dropdown-item.logout-item:hover {
    background: #fff0f0;
    color: #e74c3c;
}

/* =============================================
   DARK MODE TOGGLE SWITCH
   ============================================= */

.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.theme-toggle-wrapper:hover {
    background: #f0faf7;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 700;
    color: #2d3436;
}

.theme-toggle-label svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.theme-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d0d0d0;
    border-radius: 50px;
    transition: background 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .theme-switch {
    background: #ff9f1c;
}

body.dark-mode .theme-switch::after {
    transform: translateX(20px);
}

/* =============================================
   DARK MODE VARIABLES
   ============================================= */

body.dark-mode {
    /* Core variables shared across ALL pages */
    --primary: #2d9e8a;
    --primary-dark: #237d6d;
    --bg-main: #121220;
    --card-bg: #1a1a2e;
    --text-dark: #e8e8f0;
    --text-light: #a0a0b8;

    /* Extended variables (gameplay, sobre-nosotros, wiki) */
    --surface: #1a1a2e;
    --bg: #121220;
    --text: #e8e8f0;
    --muted: #a0a0b8;
    --border: #2a2a40;
    --teal: #2d9e8a;
    --teal-dark: #237d6d;
    --teal-light: #5ac2af;

    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.45);

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

/* ---- Header in dark mode ---- */
body.dark-mode header {
    background-color: #0e1a2b;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .header-top {
    background-color: #0e1a2b;
}

body.dark-mode .main-nav {
    background-color: rgba(26, 26, 46, 0.9);
}

body.dark-mode .main-nav a {
    color: #c0c0d0;
}

body.dark-mode .main-nav a:hover,
body.dark-mode .main-nav a.active {
    background-color: #2d9e8a;
    color: #fff;
}

/* ---- Profile trigger in dark mode ---- */
body.dark-mode .profile-trigger {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-mode .profile-trigger:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-mode .user-display-name {
    color: #e8e8f0;
}

body.dark-mode .profile-chevron {
    color: #e8e8f0;
}

/* ---- Dropdown in dark mode ---- */
body.dark-mode .profile-dropdown {
    background: #1e1e36;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

body.dark-mode .dropdown-header {
    background: linear-gradient(135deg, #1a3a4a 0%, #0e2a38 100%);
}

body.dark-mode .dropdown-user-name {
    color: #e8e8f0;
}

body.dark-mode .dropdown-user-role {
    color: rgba(232, 232, 240, 0.5);
}

body.dark-mode .dropdown-item {
    color: #c8c8d8;
}

body.dark-mode .dropdown-item:hover {
    background: rgba(45, 158, 138, 0.15);
    color: #5ac2af;
}

body.dark-mode .dropdown-separator {
    background: linear-gradient(90deg, transparent 5%, #2a2a40 50%, transparent 95%);
}

body.dark-mode .dropdown-item.logout-item:hover {
    background: rgba(231, 76, 60, 0.12);
    color: #ff6b6b;
}

body.dark-mode .theme-toggle-label {
    color: #c8c8d8;
}

body.dark-mode .theme-toggle-wrapper:hover {
    background: rgba(45, 158, 138, 0.15);
}

/* ---- Cards & Content in dark mode ---- */
body.dark-mode .card {
    background: var(--card-bg);
    border-top-color: var(--primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .card:hover {
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode h2 {
    color: #ff9f1c;
    border-bottom-color: #2a2a40;
}

body.dark-mode .card p {
    color: var(--text-light);
}

body.dark-mode .custom-list li {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.03);
    border-left-color: #ff9f1c;
}

body.dark-mode .custom-list li:hover {
    background: rgba(45, 158, 138, 0.1);
    color: var(--text-dark);
}

body.dark-mode .hero-section {
    background: var(--card-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

body.dark-mode .hero-title {
    color: #e8e8f0;
}

body.dark-mode .hero-subtitle {
    color: var(--text-light);
}

body.dark-mode .nivel {
    background: var(--card-bg);
    border-color: #2a2a40;
}

body.dark-mode .nivel:hover {
    border-color: #ff9f1c;
}

body.dark-mode .nivel-badge {
    background: #2a2a40;
}

body.dark-mode .alert-box {
    background-color: rgba(255, 193, 7, 0.1);
    border-left-color: #ff9f1c;
}

body.dark-mode .alert-box p {
    color: #daa520;
}

body.dark-mode .team-list li {
    background: rgba(255, 255, 255, 0.04);
    border-left-color: #ff9f1c;
}

/* ---- Footer in dark mode ---- */
body.dark-mode footer {
    background: #090912;
}

/* ---- Auth buttons in dark mode ---- */
body.dark-mode .btn-outline {
    border-color: #e8e8f0;
    color: #e8e8f0;
}

body.dark-mode .btn-outline:hover {
    background: #e8e8f0;
    color: #121220;
}

/* ---- Smooth transition on all elements ---- */
body,
header,
.header-top,
.main-nav,
.main-nav a,
.card,
h2,
.hero-section,
.hero-title,
.hero-subtitle,
.nivel,
.nivel-badge,
.alert-box,
.alert-box p,
footer,
.btn-outline,
.profile-trigger,
.profile-dropdown,
.dropdown-item,
.dropdown-header,
.dropdown-separator,
.theme-toggle-wrapper,
.theme-toggle-label {
    transition-property: background-color, color, border-color, box-shadow;
    transition-duration: 0.35s;
    transition-timing-function: ease;
}


/* =============================================
   ACCESSIBILITY UTILITIES
   ============================================= */

/* Font Scale */
body.font-scale-lg,
body.font-scale-lg p,
body.font-scale-lg span,
body.font-scale-lg a,
body.font-scale-lg button,
body.font-scale-lg label,
body.font-scale-lg li,
body.font-scale-lg input,
body.font-scale-lg textarea,
body.font-scale-lg select {
    font-size: 1.15rem !important;
}

body.font-scale-xl,
body.font-scale-xl p,
body.font-scale-xl span,
body.font-scale-xl a,
body.font-scale-xl button,
body.font-scale-xl label,
body.font-scale-xl li,
body.font-scale-xl input,
body.font-scale-xl textarea,
body.font-scale-xl select {
    font-size: 1.3rem !important;
}

/* Dyslexia Mode */
body.dyslexic-mode,
body.dyslexic-mode * {
    font-family: 'Comic Neue', 'Comic Sans MS', cursive, sans-serif !important;
    letter-spacing: 0.08em !important;
    line-height: 1.8 !important;
}

/* Text Spacing */
body.spacing-medium * {
    letter-spacing: 0.08em !important;
    line-height: 1.65 !important;
}

body.spacing-wide * {
    letter-spacing: 0.15em !important;
    line-height: 1.85 !important;
}

/* Large Cursor */
body.large-cursor,
body.large-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M0,0 L0,24 L6.5,17.5 L12,28 L15.5,26.5 L10.5,16 L17.5,16 Z" fill="black" stroke="white" stroke-width="2"/></svg>'), auto !important;
}

body.large-cursor a,
body.large-cursor button,
body.large-cursor [role="button"],
body.large-cursor select,
body.large-cursor input[type="submit"] {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path d="M8,2 L12,2 L12,6 L8,6 Z M8,26 L12,26 L12,30 L8,30 Z M2,8 L2,12 L6,12 L6,8 Z M26,8 L26,12 L30,12 L30,8 Z M8,8 L18,18 L14,19 L19,25 L16,27 L11,21 L8,24 Z" fill="black" stroke="white" stroke-width="2"/></svg>'), pointer !important;
}

/* Highlight Links */
body.highlight-links a:not(.btn) {
    text-decoration: underline !important;
    text-decoration-thickness: 3px !important;
    text-decoration-color: var(--accent, #ff9f1c) !important;
    font-weight: 900 !important;
    background-color: rgba(255, 159, 28, 0.15) !important;
    padding: 0 4px !important;
    border-radius: 4px !important;
}

/* Highlight Buttons */
body.highlight-buttons button,
body.highlight-buttons .btn,
body.highlight-buttons input[type="button"],
body.highlight-buttons input[type="submit"],
body.highlight-buttons select {
    outline: 4px solid var(--accent, #ff9f1c) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 12px rgba(255, 159, 28, 0.6) !important;
}

/* Focus Indicators */
body.focus-indicators *:focus,
body.focus-indicators *:focus-visible {
    outline: 4px solid #0056b3 !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 0 6px rgba(0, 86, 179, 0.4) !important;
}

body.dark-mode.focus-indicators *:focus,
body.dark-mode.focus-indicators *:focus-visible {
    outline: 4px solid #ffeb3b !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 0 6px rgba(255, 235, 59, 0.4) !important;
}

/* Interface Scale */
body.scale-sm {
    zoom: 0.9;
}

body.scale-lg {
    zoom: 1.1;
}

body.scale-xl {
    zoom: 1.25;
}

/* Reduced Animations */
body.reduce-animations *,
body.reduce-animations *::before,
body.reduce-animations *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

body.reduce-animations .hidden {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
}

/* =============================================
   COMPREHENSIVE GLOBAL DARK MODE STYLES
   ============================================= */
body.dark-mode {
    --bg-main: #121220;
    --card-bg: #1a1a2e;
    --text-dark: #e8e8f0;
    --text-light: #a0a0b8;
    --border: #2a2a40;
    --surface: #1a1a2e;
    --bg: #121220;
    --text: #e8e8f0;
    --muted: #a0a0b8;
}

/* Global resets for elements in dark mode */
body.dark-mode,
body.dark-mode main,
body.dark-mode .card,
body.dark-mode .section-card,
body.dark-mode .mechanic-card,
body.dark-mode .soporte-card,
body.dark-mode .faq-item,
body.dark-mode .thread-card,
body.dark-mode .thread-card-detail,
body.dark-mode .comment-card,
body.dark-mode .danger-zone,
body.dark-mode .auth-card,
body.dark-mode .beto-hero,
body.dark-mode .faq-content,
body.dark-mode .levels-grid,
body.dark-mode .nivel,
body.dark-mode .wiki-section,
body.dark-mode .faq-container {
    background-color: #1a1a2e !important;
    color: #e8e8f0 !important;
    border-color: #2a2a40 !important;
}

body.dark-mode body,
body.dark-mode .perfil-sidebar .perfil-card,
body.dark-mode .perfil-nav,
body.dark-mode .perfil-content {
    background-color: #121220 !important;
    color: #e8e8f0 !important;
}

/* Fix background on main wrapper if any */
body.dark-mode {
    background-color: #121220 !important;
}

/* Input elements (placeholders, textareas, selects) */
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="date"],
body.dark-mode select,
body.dark-mode textarea {
    background-color: #12122a !important;
    color: #ffffff !important;
    border: 2px solid #2a2a40 !important;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #8888aa !important;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: var(--primary-dark, #5ac2af) !important;
    background-color: #1e1e36 !important;
    outline: none;
}

/* Labels and captions */
body.dark-mode label,
body.dark-mode .input-group label {
    color: #c0c0d0 !important;
}

/* Links and titles */
body.dark-mode a:not(.btn):not(.main-nav a):not(.dropdown-item) {
    color: var(--primary-dark, #5ac2af) !important;
}

body.dark-mode a:not(.btn):not(.main-nav a):not(.dropdown-item):hover {
    color: var(--accent, #ff9f1c) !important;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6,
body.dark-mode strong {
    color: #ffffff !important;
}

/* Alerts and boxes */
body.dark-mode .alert-box,
body.dark-mode .foro-notice,
body.dark-mode .form-success {
    background-color: #0f2c25 !important;
    color: #a3e2d6 !important;
    border-left-color: var(--primary-dark) !important;
}

body.dark-mode .auth-error {
    background-color: #3b1313 !important;
    color: #ff9b9b !important;
    border-left-color: #e74c3c !important;
}

/* Tables, headers, lists */
body.dark-mode th {
    background-color: #20203a !important;
    color: #ffffff !important;
    border-bottom: 2px solid #2a2a40 !important;
}

body.dark-mode td {
    border-bottom: 1px solid #2a2a40 !important;
    color: #e8e8f0 !important;
}

body.dark-mode tr:hover td {
    background-color: #1b1b35 !important;
}

body.dark-mode .custom-list li {
    background-color: #20203a !important;
    color: #e8e8f0 !important;
    border-left-color: var(--accent) !important;
}

body.dark-mode .custom-list li:hover {
    background-color: #2a2a4c !important;
}

/* Sub-meta and date labels */
body.dark-mode .thread-meta,
body.dark-mode .thread-footer span,
body.dark-mode .faq-item p,
body.dark-mode .beto-desc,
body.dark-mode .levels-grid span,
body.dark-mode .level-info span {
    color: #a0a0b8 !important;
}

/* Forum Category Tag CSS classes */
.thread-tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
    transition: background-color 0.2s, color 0.2s;
}

.thread-tag.tag-skins {
    background-color: #ffeaa7;
    color: #d63031;
}

.thread-tag.tag-docentes {
    background-color: #dff9fb;
    color: #0abde3;
}

.thread-tag.tag-ayuda {
    background-color: var(--primary);
    color: var(--text-dark);
}

.thread-tag.tag-general {
    background-color: #e2e8f0;
    color: #4a5568;
}

/* Dark mode variations for forum category tags */
body.dark-mode .thread-tag.tag-skins {
    background-color: #453515 !important;
    color: #ffeaa7 !important;
}

body.dark-mode .thread-tag.tag-docentes {
    background-color: #153e45 !important;
    color: #dff9fb !important;
}

body.dark-mode .thread-tag.tag-ayuda {
    background-color: #123e35 !important;
    color: #83E4D1 !important;
}

body.dark-mode .thread-tag.tag-general {
    background-color: #2a2a40 !important;
    color: #c0c0d0 !important;
}

/* Footer rules in dark mode */
body.dark-mode footer {
    background-color: #0c141d !important;
    border-top: 1px solid #1a2736 !important;
}

/* =============================================
   OPTIMIZED SMOOTH ANIMATIONS & HOVERS
   ============================================= */

/* Fade-in transitions (used by IntersectionObserver) */
.hidden {
    opacity: 0 !important;
    transform: translateY(20px) scale(0.98) !important;
    filter: blur(4px) !important;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.left-hidden {
    opacity: 0 !important;
    transform: translateX(-30px) scale(0.98) !important;
    filter: blur(4px) !important;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.right-hidden {
    opacity: 0 !important;
    transform: translateX(30px) scale(0.98) !important;
    filter: blur(4px) !important;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.show {
    opacity: 1 !important;
    transform: translate(0) scale(1) !important;
    filter: blur(0) !important;
}

/* Delay helpers */
.delay-1 {
    transition-delay: 0.15s !important;
}

.delay-2 {
    transition-delay: 0.3s !important;
}

.delay-3 {
    transition-delay: 0.45s !important;
}

.delay-4 {
    transition-delay: 0.6s !important;
}

.delay-5 {
    transition-delay: 0.75s !important;
}

.delay-6 {
    transition-delay: 0.9s !important;
}

.delay-hero {
    transition-delay: 1s !important;
}

/* =============================================
   GLOBAL BUTTON STYLES
   ============================================= */
.btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 25px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    border: none;
    text-decoration: none;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease !important;
}

.btn-primary {
    background-color: var(--accent, #ff9f1c);
    color: white !important;
    box-shadow: 0 4px 10px rgba(255, 159, 28, 0.3);
}

.btn-primary:hover {
    background-color: var(--accent-hover, #e38a15);
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(255, 159, 28, 0.4);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid #111;
    color: #111 !important;
}

body.dark-mode .btn-outline {
    border-color: #ffffff;
    color: #ffffff !important;
}

.btn-outline:hover {
    background-color: #111;
    color: white !important;
    transform: translateY(-2px) !important;
}

body.dark-mode .btn-outline:hover {
    background-color: #ffffff;
    color: #111 !important;
}

.btn-large {
    font-size: 20px;
    padding: 15px 35px;
    margin-top: 20px;
    display: inline-block;
}

.btn-danger {
    background-color: #e74c3c;
    color: white !important;
}

.btn-danger:hover {
    background-color: #c0392b;
    transform: translateY(-2px) !important;
}

.btn:active {
    transform: translateY(1px) !important;
}

/* Card hover scaling premium effect */
.card,
.section-card,
.mechanic-card,
.thread-card,
.soporte-card {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        box-shadow 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
        background-color 0.3s ease,
        border-color 0.3s ease !important;
}

.card:hover,
.section-card:hover,
.mechanic-card:hover,
.soporte-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08) !important;
}

body.dark-mode .card:hover,
body.dark-mode .section-card:hover,
body.dark-mode .mechanic-card:hover,
body.dark-mode .soporte-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
}

/* ---- Logo con animación al pasar el cursor ---- */
.logo-animado {
    position: relative;
    width: 200px;
    height: auto;
    cursor: pointer;
    display: block;
}

.logo-animado .logo-imagen,
.logo-animado .logo-video {
    width: 100%;
    display: block;
}

.logo-animado .logo-video {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

.logo-animado:hover .logo-imagen {
    opacity: 0;
}

.logo-animado:hover .logo-video {
    opacity: 1;
}

/* =============================================
   DISEÑO RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .profile-trigger {
        padding: 5px 10px 5px 5px;
        gap: 8px;
    }

    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .user-display-name {
        max-width: 100px;
        font-size: 13px;
    }

    .profile-dropdown {
        right: -10px;
        min-width: 220px;
    }

    .user-actions {
        gap: 10px !important;
    }
}

@media (max-width: 480px) {
    .user-display-name {
        display: none;
    }

    .profile-trigger {
        padding: 5px;
        border-radius: 50%;
    }

    .profile-chevron {
        display: none;
    }

    .profile-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        max-height: 70vh;
        overflow-y: auto;
    }

    .user-profile-container.open .profile-dropdown {
        transform: translateY(0);
    }
}

/* =============================================
   SHARED HEADER & GLOBAL LAYOUT ACTIONS
   ============================================= */

header {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--primary);
    padding: 14px 20px;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background-color: var(--primary);
}

.logo-title {
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.logo-title .logo-img {
    height: 60px;
    width: 60px;
    object-fit: cover;
    border-radius: 12px;
}

.logo-title .titulo-img {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.logo-title:hover {
    transform: scale(1.03);
    cursor: pointer;
}

header h1 {
    margin: 0;
    font-size: 36px;
    font-weight: 900;
    color: #111;
    letter-spacing: 1px;
}

.user-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.main-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.main-nav a {
    color: var(--text-dark, #2d3436);
    font-size: 15px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.25s ease;
}

.main-nav a:hover,
.main-nav a.active {
    background-color: var(--primary);
    color: #111;
}

body.dark-mode .main-nav {
    background-color: rgba(26, 26, 46, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode .main-nav a {
    color: #e8e8f0;
}

body.dark-mode .main-nav a:hover,
body.dark-mode .main-nav a.active {
    background-color: var(--primary-dark);
    color: #fff;
}

/* =============================================
   SCROLL ANIMATIONS (Refined Timing & Subtlety)
   ============================================= */

.hidden {
    opacity: 0;
    transform: translateY(30px);
    filter: none;
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.show {
    opacity: 1;
    transform: translateY(0);
}

.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }
.delay-6 { transition-delay: 0.6s; }

/* Responsive adjustments for header-top and main-nav */
@media (max-width: 768px) {
    header {
        padding: 10px 14px;
    }
    .header-top {
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        gap: 8px !important;
    }
    .logo-title .logo-img {
        height: 44px;
        width: 44px;
    }
    .logo-title .titulo-img {
        height: 36px;
    }
    .logo-title {
        gap: 8px !important;
    }
    .user-actions {
        width: auto !important;
        flex-shrink: 0;
    }
    .main-nav a {
        font-size: 14px;
        padding: 6px 12px;
    }
}

/* Global Reset and Layout styles (fixes footer and removes link underlines) */
html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    font-family: 'Nunito', Arial, sans-serif;
    color: var(--text-dark, #2d3436);
    background-color: var(--bg-main, #f4f6f9);
    line-height: 1.6;
    letter-spacing: .5px;
}

main {
    flex: 1;
}

a, .main-nav a, .dropdown-header a, .footer-links a, #terminos {
    text-decoration: none !important;
}

/* =============================================
   COMPREHENSIVE RESPONSIVE LAYOUT SYSTEM
   ============================================= */

/* 1. Pantallas grandes (Desktop XL / 4K): Superiores a 1200px / 1400px */
@media (min-width: 1200px) {
    main, .page-content, .foro-container, .perfil-page {
        max-width: 1200px !important;
        margin: 30px auto 0 !important;
        padding: 30px 24px 60px !important;
        gap: 40px !important;
    }
}

@media (min-width: 1400px) {
    main, .page-content, .foro-container, .perfil-page {
        max-width: 1360px !important;
        padding: 40px 32px 80px !important;
        gap: 48px !important;
    }
}

/* 2. Ordenadores portátiles y de escritorio: Entre 992px y 1200px */
@media (min-width: 992px) and (max-width: 1199.98px) {
    main, .page-content, .foro-container, .perfil-page {
        max-width: 960px !important;
        margin: 25px auto 0 !important;
        padding: 25px 20px 50px !important;
        gap: 32px !important;
    }
}

/* 3. Tabletas y móviles grandes: Entre 600px y 992px */
@media (min-width: 600px) and (max-width: 991.98px) {
    main, .page-content, .foro-container, .perfil-page {
        max-width: 100% !important;
        margin: 20px 10px 0 !important;
        padding: 20px 16px 40px !important;
        gap: 28px !important;
    }
    
    .info-grid, .tech-grid, .skins-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

/* 4. Móviles pequeños y medianos: Anchos menores a 600px */
@media (max-width: 599.98px) {
    main, .page-content, .foro-container, .perfil-page {
        max-width: 100% !important;
        margin: 10px 5px 0 !important;
        padding: 15px 12px 30px !important;
        gap: 20px !important;
    }
    
    main > section, .page-content > section, .foro-container > section, .perfil-page > section,
    main > div.card, .page-content > div.card, .foro-container > div.card, .perfil-page > div.card {
        padding: 20px 16px !important;
        border-radius: var(--radius-md, 15px) !important;
    }

    .info-grid, .tech-grid, .team-grid, .problem-grid, .skins-grid, .videos-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}