/* ═══════════════════════════════════════════════════
   NXP TICKER — FRONTEND CSS (Wuxiaworld-Inspired Sync)
═══════════════════════════════════════════════════ */

/* ── Ticker Bar ── */
.nxptk-ticker {
    position: relative;
    background: var(--nxp-primary, #3B82F6);
    height: 34px;
    display: flex;
    align-items: center;
    overflow: hidden;
    z-index: 900;
    flex-shrink: 0;
}

/* Label pill with active pulse */
.nxptk-ticker__label {
    display: flex;
    align-items: center;
    gap: 7px;
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0 16px;
    height: 100%;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Pulsing dot components */
.nxptk-ticker__pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    position: relative;
    flex-shrink: 0;
    animation: nxptkPulse 2s ease-in-out infinite;
}
.nxptk-ticker__pulse::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    animation: nxptkPulseRing 2s ease-in-out infinite;
}
@keyframes nxptkPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(0.85); }
}
@keyframes nxptkPulseRing {
    0%    { opacity: 0.6; transform: scale(1); }
    100%  { opacity: 0;   transform: scale(2.2); }
}

/* Viewport — clips the scrolling track */
.nxptk-ticker__viewport {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    height: 100%;
}

/* Scrolling track */
.nxptk-ticker__track {
    display: flex;
    align-items: center;
    will-change: transform;
    animation: nxptkScroll var(--nxptk-duration, 50s) linear infinite;
}
.nxptk-ticker__track.paused,
.nxptk-ticker[data-pause-hover="1"]:hover .nxptk-ticker__track {
    animation-play-state: paused;
}
@keyframes nxptkScroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Individual items */
.nxptk-ticker__item {
    color: #fff;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    text-decoration: none;
    height: 34px;
    transition: background 0.15s;
    cursor: default;
    box-sizing: border-box;
}
a.nxptk-ticker__item { cursor: pointer; }
a.nxptk-ticker__item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
}

.nxptk-ticker__dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

/* Structure parts and opacity styles */
.nxptk-ticker__title-part {
    font-weight: 600;
}
.nxptk-ticker__sep {
    opacity: 0.5;
}
.nxptk-ticker__msg-part {
    opacity: 0.75;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nxptk-ticker__item-pin {
    font-size: 0.75rem;
    margin-left: 2px;
}

/* Left edge accents for priority notifications */
.nxptk-ticker__item--warning { border-left: 3px solid #F59E0B; }
.nxptk-ticker__item--danger  { border-left: 3px solid #EF4444; }
.nxptk-ticker__item--success { border-left: 3px solid #10B981; }
.nxptk-ticker__item--promo   { border-left: 3px solid #8B5CF6; }
.nxptk-ticker__item--pinned  { font-weight: 700; }

/* Interactive Close Button */
.nxptk-ticker__close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.15);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 10px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.nxptk-ticker__close:hover {
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
}

/* Hidden state */
.nxptk-ticker.hidden {
    height: 0;
    opacity: 0;
    pointer-events: none;
    transition: height 0.25s, opacity 0.25s;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .nxptk-ticker { display: none !important; }
}

/* ══ BANNER ════════════════════════════════════════════ */
.nxptk-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    font-family: var(--font-ui, 'DM Sans', sans-serif);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    animation: nxptkBannerIn 0.4s cubic-bezier(0.22,1,0.36,1);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
@keyframes nxptkBannerIn {
    from { opacity: 0; transform: translateY(-100%); max-height: 0; }
    to   { opacity: 1; transform: translateY(0);      max-height: 80px; }
}

.nxptk-banner--info    { background: rgba(59,130,246,0.12);  color: #93C5FD; border-left: 3px solid #3B82F6; }
.nxptk-banner--success { background: rgba(16,185,129,0.12);  color: #6EE7B7; border-left: 3px solid #10B981; }
.nxptk-banner--warning { background: rgba(245,158,11,0.12);  color: #FCD34D; border-left: 3px solid #F59E0B; }
.nxptk-banner--danger  { background: rgba(239,68,68,0.12);   color: #FCA5A5; border-left: 3px solid #EF4444; }
.nxptk-banner--promo   { background: linear-gradient(90deg, rgba(139,92,246,0.15), rgba(59,130,246,0.1)); color: #C4B5FD; border-left: 3px solid #8B5CF6; }

/* Light mode overrides */
body.nxp-light .nxptk-banner--info    { background: rgba(59,130,246,0.08);  color: #1D4ED8; }
body.nxp-light .nxptk-banner--success { background: rgba(16,185,129,0.08);  color: #065F46; }
body.nxp-light .nxptk-banner--warning { background: rgba(245,158,11,0.08);  color: #92400E; }
body.nxp-light .nxptk-banner--danger  { background: rgba(239,68,68,0.08);   color: #991B1B; }
body.nxp-light .nxptk-banner--promo   { background: rgba(139,92,246,0.08);  color: #4C1D95; }

.nxptk-banner__icon  { font-size: 1.1rem; flex-shrink: 0; }
.nxptk-banner__body  { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.nxptk-banner__title { font-weight: 700; }
.nxptk-banner__msg   { opacity: 0.85; }
.nxptk-banner__cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.12);
    color: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}
.nxptk-banner__cta:hover { background: rgba(255,255,255,0.22); text-decoration: none; color: inherit; }
.nxptk-banner__close {
    background: none;
    border: none;
    color: currentColor;
    opacity: 0.5;
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    border-radius: 4px;
    transition: opacity 0.15s;
    display: flex;
    align-items: center;
}
.nxptk-banner__close:hover { opacity: 1; }

/* ══ TOAST ZONE ══════════════════════════════════════ */
.nxptk-toast-zone {
    position: fixed;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 360px;
    width: calc(100vw - 32px);
}
.nxptk-toast-zone--bottom-right  { bottom: 20px; right: 20px; }
.nxptk-toast-zone--bottom-left   { bottom: 20px; left:  20px; }
.nxptk-toast-zone--top-right     { top: 80px; right: 20px; flex-direction: column-reverse; }
.nxptk-toast-zone--top-left      { top: 80px; left:  20px; flex-direction: column-reverse; }
.nxptk-toast-zone--bottom-center { bottom: 20px; left: 50%; transform: translateX(-50%); }
.nxptk-toast-zone--top-center    { top: 80px; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; }

/* Toast card */
.nxptk-toast {
    pointer-events: all;
    background: var(--nxp-surface, #1c1c1c);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.3);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-family: var(--font-ui, 'DM Sans', sans-serif);
    opacity: 0;
    transform: translateX(20px) scale(0.96);
    transition: opacity 0.3s cubic-bezier(0.22,1,0.36,1), transform 0.3s cubic-bezier(0.22,1,0.36,1);
    min-width: 0;
    width: 100%;
}
.nxptk-toast-zone--bottom-left  .nxptk-toast,
.nxptk-toast-zone--top-left     .nxptk-toast { transform: translateX(-20px) scale(0.96); }
.nxptk-toast-zone--bottom-center .nxptk-toast,
.nxptk-toast-zone--top-center    .nxptk-toast { transform: translateY(12px) scale(0.96); }

.nxptk-toast.show {
    opacity: 1;
    transform: translateX(0) scale(1) !important;
}
.nxptk-toast.hide {
    opacity: 0;
    transform: translateX(24px) scale(0.94) !important;
    pointer-events: none;
}

/* Type accent strips */
.nxptk-toast--info    { border-left: 3px solid #3B82F6; }
.nxptk-toast--success { border-left: 3px solid #10B981; }
.nxptk-toast--warning { border-left: 3px solid #F59E0B; }
.nxptk-toast--danger  { border-left: 3px solid #EF4444; }
.nxptk-toast--promo   { border-left: 3px solid #8B5CF6; }

.nxptk-toast__icon  { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.nxptk-toast__body  { flex: 1; min-width: 0; }
.nxptk-toast__title {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--nxp-text, #E8E8F0);
    margin-bottom: 2px;
}
.nxptk-toast__msg {
    font-size: 0.8rem;
    color: var(--nxp-text-2, #adadad);
    line-height: 1.5;
}
.nxptk-toast__cta {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--nxp-primary, #3B82F6);
    text-decoration: none;
}
.nxptk-toast__cta:hover { text-decoration: underline; color: var(--nxp-primary, #3B82F6); }
.nxptk-toast__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nxp-text-3, #636363);
    padding: 2px;
    font-size: 0.85rem;
    flex-shrink: 0;
    transition: color 0.15s;
    display: flex;
    align-items: center;
}
.nxptk-toast__close:hover { color: var(--nxp-text, #E8E8F0); }

/* Progress bar (auto-dismiss countdown) */
.nxptk-toast__progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.25;
    border-radius: 0 0 12px 12px;
    animation: nxptkProgress linear forwards;
}
@keyframes nxptkProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* ══ RESPONSIVE ════════════════════════════════════════ */
@media (max-width: 480px) {
    .nxptk-ticker { height: 32px; }
    .nxptk-ticker__label { padding: 0 10px; font-size: 0.6rem; gap: 5px; }
    .nxptk-ticker__item  { font-size: 0.75rem; padding: 0 8px; }
    .nxptk-toast-zone { max-width: calc(100vw - 24px); }
}
