/* ─────────────────────────────────────────────────────────────
   Newsletter Dropdown Menu — Stylesheet
   Compatible with la mayoría de temas WordPress
   ───────────────────────────────────────────────────────────── */

/* ── Contenedor principal ─────────────────────────────── */
.nm-dropdown {
    position: relative;
    display: inline-block;
    font-family: inherit;
    z-index: 9999;
}

/* ── Botón toggle ─────────────────────────────────────── */
.nm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: transparent;
    border: 2px solid currentColor;
    border-radius: 6px;
    font-size: 0.92em;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    color: inherit;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    line-height: 1;
}

.nm-toggle:hover,
.nm-toggle:focus-visible {
    background: rgba(0,0,0,0.07);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    outline: none;
}

/* Icono de sobre */
.nm-toggle-icon svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Flecha chevron */
.nm-arrow svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    vertical-align: middle;
}

.nm-dropdown.nm-open .nm-arrow svg {
    transform: rotate(180deg);
}

/* ── Lista desplegable ────────────────────────────────── */
.nm-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 320px;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.08);
    list-style: none;
    margin: 0;
    padding: 6px;
    z-index: 9999;
    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top left;
    transition:
        opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Abrir */
.nm-dropdown.nm-open .nm-list {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Flecha decorativa */
.nm-list::before {
    content: '';
    position: absolute;
    top: -7px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-left: 1px solid rgba(0,0,0,0.12);
    border-top: 1px solid rgba(0,0,0,0.12);
    transform: rotate(45deg);
    border-radius: 2px 0 0 0;
}

/* ── Elementos de la lista ────────────────────────────── */
.nm-item {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nm-link {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 7px;
    text-decoration: none !important;
    color: #222222 !important;
    transition: background 0.14s ease;
}

.nm-link:hover,
.nm-link:focus-visible {
    background: #f3f7ff;
    outline: none;
}

.nm-item-title {
    font-size: 0.88em;
    font-weight: 600;
    line-height: 1.35;
    color: #1a1a2e !important;
    display: block;
}

.nm-item-date {
    font-size: 0.75em;
    color: #888 !important;
    font-weight: 400;
    display: block;
}

/* Separador entre items */
.nm-item + .nm-item {
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-top: 2px;
    padding-top: 2px;
}

/* ── Estado vacío ─────────────────────────────────────── */
.nm-empty {
    font-size: 0.85em;
    color: #999;
    font-style: italic;
}

/* ── Cuando está en el menú de navegación ─────────────── */
li.nm-menu-item {
    display: flex !important;
    align-items: center;
    list-style: none;
}

/* ── Dark mode automático ─────────────────────────────── */
@media (prefers-color-scheme: dark) {
    .nm-list {
        background: #1e1e2e;
        border-color: rgba(255,255,255,0.12);
    }
    .nm-list::before {
        background: #1e1e2e;
        border-color: rgba(255,255,255,0.12);
    }
    .nm-link {
        color: #e0e0e0 !important;
    }
    .nm-link:hover {
        background: rgba(255,255,255,0.08);
    }
    .nm-item-title {
        color: #f0f0f0 !important;
    }
    .nm-item-date {
        color: #888 !important;
    }
    .nm-item + .nm-item {
        border-color: rgba(255,255,255,0.08);
    }
    .nm-toggle:hover {
        background: rgba(255,255,255,0.08);
    }
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 600px) {
    .nm-list {
        min-width: 260px;
        max-width: calc(100vw - 24px);
        left: 50%;
        transform: translateX(-50%) translateY(-8px) scale(0.98);
    }
    .nm-dropdown.nm-open .nm-list {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    .nm-list::before {
        left: 50%;
        transform: translateX(-50%) rotate(45deg);
    }
}
