html,
body {
    overflow-x: hidden;
    width: 100%;
}

:root {
    --bg-deep: #050505;
    --bg-card: #0f0f12;
    --bg-input: #16161a;
    --header-bg: rgba(17, 17, 17);
    /* <-- Nueva variable para el header */
    --primary: #FF5E57;
    --primary-hover: #a5403b;
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #ffffff;
    --text-muted: #e0e0e0;
    --border: #222226;
    --radius: 12px;
    --font-main: 'Inter', sans-serif;
}

/* =========================================
   NUEVOS TEMAS
   ========================================= */
[data-theme="light"] {
    --bg-deep: #f8f9fa;
    --bg-card: #ffffff;
    --bg-input: #e9ecef;
    --header-bg: rgba(255, 255, 255);
    --text-main: #1a1a1a;
    --text-muted: #4a4a4a;
    --border: #dee2e6;
}

[data-theme="dim"] {
    --bg-deep: #22272e;
    --bg-card: #2d333b;
    --bg-input: #373e47;
    --header-bg: rgba(34, 39, 46);
    --text-main: #adbac7;
    --text-muted: #768390;
    --border: #444c56;
}

/* =========================================
   1. CONTENEDOR PRINCIPAL DEL HEADER
   ========================================= */
#af-header {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 9999;
    background-color: var(--header-bg);
    /* <-- Ahora usa la variable */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.af-navbar {
    width: 100%;
}

.af-navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    height: 55px;
}

/* =========================================
   2. LOGOTIPO
   ========================================= */
.af-logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.af-logo-image {
    height: 38px;
    width: auto;
    border-radius: 8px;
    object-fit: contain;
}

.af-logo {
    font-family: var(--font-main);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

/* =========================================
   3. NAVEGACIÓN ESCRITORIO (Desktop)
   ========================================= */
.af-nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.af-nav-links li {
    display: flex;
    align-items: center;
}

.af-nav-links a {
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.af-nav-links a:hover {
    color: var(--primary);
}

.af-nav-links form {
    margin: 0;
    padding: 0;
    display: flex;
}

.af-nav-button-link {
    background: transparent;
    border: none;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.af-nav-button-link:hover {
    color: var(--danger);
}

/* =========================================
   SELECTOR DE TEMAS (NUEVO)
   ========================================= */
.af-theme-selector {
    position: relative;
    display: flex;
    align-items: center;
}

.af-theme-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.af-theme-icon {
    stroke: var(--text-muted);
    transition: stroke 0.2s ease, transform 0.2s ease;
}

.af-theme-btn:hover .af-theme-icon {
    stroke: var(--primary);
    transform: rotate(15deg);
}

.af-theme-menu {
    position: absolute;
    top: 130%;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 0;
    list-style: none;
    min-width: 150px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 10000;
}

.af-theme-selector.active .af-theme-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.af-theme-menu button {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 10px 15px;
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.af-theme-menu button:hover {
    background-color: var(--bg-input);
    color: var(--primary);
}

/* =========================================
   4. ICONOS ESPECIALES (Subir / Perfil)
   ========================================= */
.af-icon-link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main) !important;
}

.af-upload-icon {
    stroke: var(--text-muted);
    transition: stroke 0.2s ease, transform 0.2s ease;
}

.af-icon-link:hover .af-upload-icon {
    stroke: var(--primary);
    transform: translateY(-2px);
}

.af-profile-link {
    display: flex;
    align-items: center;
}

.af-profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    background-color: var(--bg-input);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.af-profile-link:hover .af-profile-avatar {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.af-profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.af-profile-avatar-placeholder {
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    background-color: var(--primary);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================
   5. BOTÓN HAMBURGUESA (Móvil)
   ========================================= */
.af-burger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10001;
}

.af-burger div {
    width: 24px;
    height: 2px;
    background-color: var(--text-main);
    margin: 5px;
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* =========================================
   6. RESPONSIVE (Móviles y Tablets)
   ========================================= */
@media screen and (max-width: 768px) {
    .af-burger {
        display: block;
    }

    .af-nav-links {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        width: 70%;
        max-width: 300px;
        background-color: var(--bg-card);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 30px;
        box-shadow: -10px 0 20px rgba(0, 0, 0, 0.5);
        border-left: 1px solid var(--border);
        z-index: 10000;
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.4s ease-in-out, visibility 0s 0.4s;
    }

    .af-nav-links.nav-active {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.4s ease-in-out, visibility 0s 0s;
    }

    .af-nav-links li {
        opacity: 0;
    }

    .af-nav-links a,
    .af-nav-button-link {
        font-size: 1.2rem;
    }

    /* Ajuste para el menú de temas en móvil */
    .af-theme-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        transform: none;
        display: none;
        width: 100%;
    }

    .af-theme-selector.active .af-theme-menu {
        display: block;
    }

    .af-theme-menu button {
        text-align: center;
    }

    .af-burger.toggle .af-line1 {
        transform: rotate(-45deg) translate(-5px, 5px);
    }

    .af-burger.toggle .af-line2 {
        opacity: 0;
    }

    .af-burger.toggle .af-line3 {
        transform: rotate(45deg) translate(-5px, -5px);
    }
}

@media screen and (max-width: 400px) {
    .af-nav-links {
        width: 100%;
        max-width: 100%;
    }
}

/* =========================================
   7. KEYFRAMES
   ========================================= */
@keyframes af-navLinkFade {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Punto rojo de notificaciones */
/* Punto rojo de notificaciones */
.af-notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background-color: var(--success);
    /* Rojo brillante tipo iOS */
    /* Usamos la variable del header para que el borde se fusione con el fondo actual */
    border: 2px solid var(--header-bg);
    border-radius: 50%;
    z-index: 10;
    animation: af-pulse 2s infinite;
    /* Pequeño latido opcional */
}

/* Opcional: Animación suave para llamar la atención */
@keyframes af-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}