/* ═══════════════════════════════════════════════════════════════
   Nett Widget Gallery – Frontend  (Light Glassmorphism)
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────── */
.nwgf {
    --pri:       #6366f1;
    --pri-dark:  #4f46e5;
    --pri-light: #818cf8;
    --accent:    #a855f7;
    --success:   #10b981;
    --warning:   #f59e0b;
    --danger:    #ef4444;
    --txt:       #1e293b;
    --txt2:      #475569;
    --txt3:      #94a3b8;
    --bg:        #f1f5f9;
    --surface:   #ffffff;
    --border:    #e2e8f0;
    --glass:     rgba(255,255,255,.72);
    --glass-b:   rgba(255,255,255,.35);
    --r-sm:  8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --sh-sm: 0 1px 3px rgba(0,0,0,.05);
    --sh-md: 0 4px 20px rgba(0,0,0,.07);
    --sh-lg: 0 12px 40px rgba(0,0,0,.10);
    --sh-xl: 0 24px 60px rgba(0,0,0,.14);
    --ease:  cubic-bezier(.4,0,.2,1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--txt);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
.nwgf *, .nwgf *::before, .nwgf *::after { box-sizing: border-box; margin: 0; padding: 0; }
.nwgf button { font-family: inherit; cursor: pointer; }
.nwgf-container { max-width: 1320px; margin: 0 auto; padding: 0 28px; }

/* ─────────────────────────────── HERO ──────────────────────── */
.nwgf-hero {
    position: relative;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 35%, #7c3aed 70%, #a855f7 100%);
    padding: 72px 28px 56px;
    text-align: center;
    overflow: hidden;
}
.nwgf-hero-bg { position: absolute; inset: 0; pointer-events: none; }
.nwgf-hero-orb {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: .35;
    animation: orbFloat 12s ease-in-out infinite alternate;
}
.nwgf-hero-orb--1 { width: 420px; height: 420px; background: #818cf8; top: -30%; left: -8%; }
.nwgf-hero-orb--2 { width: 320px; height: 320px; background: #f472b6; bottom: -20%; right: 5%; animation-delay: -4s; }
.nwgf-hero-orb--3 { width: 260px; height: 260px; background: #22d3ee; top: 10%; right: -10%; animation-delay: -8s; }
@keyframes orbFloat {
    0%  { transform: translate(0,0) scale(1); }
    100%{ transform: translate(30px,-20px) scale(1.12); }
}
.nwgf-hero-content { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }
.nwgf-hero-badge {
    display: inline-block;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff; font-size: .78rem; font-weight: 700;
    letter-spacing: .12em; text-transform: uppercase;
    padding: 6px 18px; border-radius: 100px;
    margin-bottom: 20px;
}
.nwgf-hero-title {
    font-size: clamp(1.8rem,4vw,2.8rem);
    font-weight: 800; color: #fff;
    line-height: 1.18; margin-bottom: 14px;
    letter-spacing: -.02em;
}
.nwgf-hero-desc {
    font-size: 1.05rem; color: rgba(255,255,255,.78);
    margin-bottom: 32px;
}
.nwgf-hero-desc strong { color: #fff; }

/* Search box (hero) */
.nwgf-search-box {
    position: relative; max-width: 520px; margin: 0 auto;
}
.nwgf-search-icon {
    position: absolute; left: 18px; top: 50%;
    transform: translateY(-50%); color: var(--txt3);
    pointer-events: none;
}
.nwgf-search-input {
    width: 100%; height: 54px;
    padding: 0 54px 0 50px;
    border: none; border-radius: 100px;
    font-size: .95rem; color: var(--txt);
    background: var(--glass);
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,.12), inset 0 0 0 1px rgba(255,255,255,.35);
    outline: none;
    transition: box-shadow .25s var(--ease);
}
.nwgf-search-input::placeholder { color: var(--txt3); }
.nwgf-search-input:focus {
    box-shadow: 0 8px 32px rgba(99,102,241,.25), inset 0 0 0 2px var(--pri-light);
}
.nwgf-kbd {
    position: absolute; right: 16px; top: 50%;
    transform: translateY(-50%);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 5px; padding: 2px 9px;
    font-size: .72rem; color: var(--txt3);
    font-family: inherit; line-height: 1.6;
}

/* ──────────────────────────── TOOLBAR ─────────────────────── */
.nwgf-toolbar {
    position: sticky; top: 0; z-index: 90;
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(1.6);
    border-bottom: 1px solid var(--border);
    padding: 18px 0 14px;
    box-shadow: var(--sh-sm);
    transition: box-shadow .3s;
}
.nwgf-toolbar.scrolled { box-shadow: var(--sh-md); }

/* Category pills */
.nwgf-cats {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}
.nwgf-cat {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: 100px;
    font-size: .82rem; font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface); color: var(--txt2);
    transition: all .22s var(--ease);
    white-space: nowrap;
}
.nwgf-cat:hover {
    border-color: var(--pri-light);
    color: var(--pri);
    background: rgba(99,102,241,.04);
}
.nwgf-cat.active {
    background: var(--pri); color: #fff;
    border-color: var(--pri);
    box-shadow: 0 2px 10px rgba(99,102,241,.35);
}
.nwgf-cat-count {
    font-size: .7rem; font-weight: 700;
    padding: 1px 7px; border-radius: 100px;
    background: rgba(0,0,0,.06);
}
.nwgf-cat.active .nwgf-cat-count { background: rgba(255,255,255,.25); }

/* Tag badges */
.nwgf-tags {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 14px;
}
.nwgf-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 14px; border-radius: 100px;
    font-size: .76rem; font-weight: 600;
    border: 1.5px solid color-mix(in srgb, var(--tag-color) 30%, transparent);
    background: color-mix(in srgb, var(--tag-color) 8%, transparent);
    color: var(--tag-color);
    transition: all .22s var(--ease);
}
.nwgf-tag:hover, .nwgf-tag.active {
    background: color-mix(in srgb, var(--tag-color) 16%, transparent);
    border-color: var(--tag-color);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--tag-color) 20%, transparent);
}
.nwgf-tag-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--tag-color);
}

/* Results bar */
.nwgf-results-bar {
    display: flex; align-items: center; justify-content: space-between;
}
.nwgf-results-text { font-size: .82rem; color: var(--txt3); }
.nwgf-results-text strong { color: var(--txt); }
.nwgf-view-toggle {
    display: flex; background: var(--bg); border-radius: var(--r-sm);
    padding: 3px; border: 1px solid var(--border);
}
.nwgf-vbtn {
    width: 34px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none; color: var(--txt3);
    border-radius: 6px; transition: all .2s var(--ease);
}
.nwgf-vbtn.active { background: var(--pri); color: #fff; }
.nwgf-vbtn:hover:not(.active) { color: var(--txt); background: var(--surface); }

/* ──────────────────────────── BODY / GRID ────────────────── */
.nwgf-body { padding: 32px 0 12px; min-height: 420px; }

.nwgf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
    gap: 24px;
}
.nwgf-grid.nwgf-grid--list {
    grid-template-columns: 1fr;
    gap: 14px;
}

/* ────────────────────────── WIDGET CARD ─────────────────── */
.nwgf-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
    cursor: pointer;
    animation: cardUp .45s var(--ease) backwards;
}
@keyframes cardUp {
    from { opacity: 0; transform: translateY(18px) scale(.97); }
}

.nwgf-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--sh-lg);
    border-color: var(--pri-light);
}

/* Thumb */
.nwgf-card-thumb {
    position: relative; height: 210px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    overflow: hidden;
}
.nwgf-card-thumb iframe {
    position: absolute; top: 0; left: 0;
    width: 200%; height: 200%;
    border: none;
    transform: scale(.5); transform-origin: top left;
    pointer-events: none;
}
.nwgf-card-loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    z-index: 1;
    transition: opacity .35s;
}
.nwgf-card-loader.done { opacity: 0; pointer-events: none; }

/* Overlay with play button */
.nwgf-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15,23,42,0) 40%, rgba(15,23,42,.55) 100%);
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity .3s var(--ease);
    z-index: 2;
}
.nwgf-card:hover .nwgf-card-overlay { opacity: 1; }

.nwgf-play-btn {
    width: 58px; height: 58px; border-radius: 50%;
    background: rgba(255,255,255,.16);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,.35);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    transform: scale(.7);
    transition: all .3s var(--ease);
}
.nwgf-card:hover .nwgf-play-btn { transform: scale(1); }
.nwgf-play-btn:hover {
    background: var(--pri); border-color: var(--pri);
    transform: scale(1.12) !important;
    box-shadow: 0 8px 28px rgba(99,102,241,.45);
}

/* Card body */
.nwgf-card-body { padding: 18px 20px 20px; }
.nwgf-card-title {
    font-size: .95rem; font-weight: 650;
    color: var(--txt); margin: 0 0 3px;
    line-height: 1.35;
}
.nwgf-card-cat {
    font-size: .75rem; color: var(--txt3); font-weight: 500;
}

/* Card tags */
.nwgf-card-tags {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 10px;
}
.nwgf-card-chip {
    display: inline-block;
    padding: 2px 9px; border-radius: 100px;
    font-size: .67rem; font-weight: 650;
}

/* Card footer */
.nwgf-card-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--border);
}
.nwgf-card-badges { display: flex; gap: 4px; }
.nwgf-badge {
    padding: 2px 7px; border-radius: 4px;
    font-size: .63rem; font-weight: 750;
    letter-spacing: .04em; text-transform: uppercase;
}
.nwgf-badge--php  { background: rgba(99,102,241,.1);  color: var(--pri); }
.nwgf-badge--css  { background: rgba(16,185,129,.1);  color: var(--success); }

/* List variant */
.nwgf-grid--list .nwgf-card {
    display: grid;
    grid-template-columns: 220px 1fr;
}
.nwgf-grid--list .nwgf-card-thumb {
    height: 100%; min-height: 150px;
    border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.nwgf-grid--list .nwgf-card-body {
    display: flex; flex-direction: column; justify-content: center;
}

/* ── Spinner used in both cards and modal ── */
.nwgf-spinner, .nwgf-spinner-lg {
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--pri);
    animation: spin .65s linear infinite;
}
.nwgf-spinner { width: 26px; height: 26px; }
.nwgf-spinner-lg { width: 38px; height: 38px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ────────────────────── SKELETON LOADER ─────────────────── */
.nwgf-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
    gap: 24px;
}
.nwgf-skeleton-card {
    background: var(--surface); border-radius: var(--r-lg);
    overflow: hidden; border: 1px solid var(--border);
}
.nwgf-skeleton-thumb { height: 210px; background: linear-gradient(110deg, #e2e8f0 30%, #f1f5f9 50%, #e2e8f0 70%); background-size: 250% 100%; animation: shimmer 1.6s linear infinite; }
.nwgf-skeleton-body { padding: 18px 20px 22px; }
.nwgf-skeleton-line { border-radius: 6px; background: linear-gradient(110deg, #e2e8f0 30%, #f1f5f9 50%, #e2e8f0 70%); background-size: 250% 100%; animation: shimmer 1.6s linear infinite; }
.nwgf-skeleton-line--title { height: 16px; width: 65%; margin-bottom: 10px; }
.nwgf-skeleton-line--sub   { height: 12px; width: 40%; }
@keyframes shimmer { to { background-position: -250% 0; } }

/* ────────────────────── EMPTY STATE ─────────────────────── */
.nwgf-empty {
    text-align: center; padding: 72px 24px;
    animation: cardUp .45s var(--ease) backwards;
}
.nwgf-empty-icon { margin-bottom: 18px; opacity: .7; }
.nwgf-empty-title { font-size: 1.15rem; font-weight: 700; color: var(--txt); margin-bottom: 6px; }
.nwgf-empty-desc  { font-size: .9rem; color: var(--txt3); margin-bottom: 24px; }

.nwgf-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 22px; border-radius: var(--r-sm);
    font-size: .85rem; font-weight: 600; border: none;
    transition: all .22s var(--ease);
}
.nwgf-btn--primary { background: var(--pri); color: #fff; }
.nwgf-btn--primary:hover { background: var(--pri-dark); box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.nwgf-btn--outline {
    background: var(--surface); color: var(--pri);
    border: 2px solid var(--pri);
}
.nwgf-btn--outline:hover { background: rgba(99,102,241,.06); }

/* ────────────────────── PAGINATION ──────────────────────── */
.nwgf-pagination-wrap { padding: 8px 0 56px; }
.nwgf-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 6px; flex-wrap: wrap;
}
.nwgf-page {
    min-width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    font-size: .88rem; font-weight: 600;
    border: 1px solid var(--border);
    background: var(--surface); color: var(--txt2);
    transition: all .22s var(--ease);
}
.nwgf-page:hover:not(.active):not(.disabled) {
    border-color: var(--pri-light);
    color: var(--pri);
    background: rgba(99,102,241,.04);
}
.nwgf-page.active {
    background: var(--pri); color: #fff;
    border-color: var(--pri);
    box-shadow: 0 2px 10px rgba(99,102,241,.3);
}
.nwgf-page.disabled {
    opacity: .4; cursor: default; pointer-events: none;
}
.nwgf-page-dots {
    width: 40px; text-align: center;
    color: var(--txt3); font-weight: 600;
    user-select: none; cursor: default;
}

/* ──────────────────── PREVIEW MODAL ─────────────────────── */
.nwgf-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity .3s var(--ease);
}
.nwgf-modal.open { opacity: 1; pointer-events: all; }

.nwgf-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(15,23,42,.55);
    backdrop-filter: blur(10px);
}

.nwgf-modal-dialog {
    position: relative;
    width: 92vw; max-width: 1400px;
    height: 88vh;
    background: var(--surface);
    border-radius: var(--r-xl);
    box-shadow: var(--sh-xl);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: scale(.94) translateY(14px);
    transition: transform .35s var(--ease);
}
.nwgf-modal.open .nwgf-modal-dialog {
    transform: scale(1) translateY(0);
}

.nwgf-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 26px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.nwgf-modal-title {
    font-size: 1.05rem; font-weight: 700; color: var(--txt);
    margin: 0;
}
.nwgf-modal-cat {
    display: inline-block;
    font-size: .72rem; font-weight: 650;
    padding: 3px 11px; border-radius: 100px;
    background: rgba(99,102,241,.1); color: var(--pri);
    margin-left: 10px;
}
.nwgf-modal-info { display: flex; align-items: center; }
.nwgf-modal-tools { display: flex; align-items: center; gap: 12px; }

/* Viewport switcher */
.nwgf-vp-switcher {
    display: flex; background: var(--surface);
    border-radius: var(--r-sm); padding: 3px;
    border: 1px solid var(--border);
}
.nwgf-vp {
    width: 36px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none; color: var(--txt3);
    border-radius: 6px; transition: all .2s var(--ease);
}
.nwgf-vp.active { background: var(--pri); color: #fff; }
.nwgf-vp:hover:not(.active) { color: var(--txt); background: var(--bg); }

.nwgf-modal-close {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: var(--surface);
    border-radius: 50%; color: var(--txt3);
    transition: all .2s var(--ease);
}
.nwgf-modal-close:hover { background: rgba(239,68,68,.1); color: var(--danger); }

/* Modal body → iframe */
.nwgf-modal-body {
    flex: 1; padding: 22px;
    overflow: hidden;
    background: #e2e8f0;
    display: flex; justify-content: center;
}
.nwgf-modal-frame-wrap {
    width: 100%; height: 100%;
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--sh-md);
    background: #fff;
    transition: max-width .4s var(--ease);
    position: relative;
}
.nwgf-iframe {
    width: 100%; height: 100%; border: none;
    background: #fff;
}
.nwgf-modal-loader {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: #fff;
    z-index: 1;
    transition: opacity .3s;
}
.nwgf-modal-loader.hidden { opacity: 0; pointer-events: none; }

/* ──────────────────── RESPONSIVE ────────────────────────── */
@media (max-width: 900px) {
    .nwgf-hero { padding: 52px 20px 40px; }
    .nwgf-grid { grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 18px; }
    .nwgf-grid--list .nwgf-card { grid-template-columns: 1fr; }
    .nwgf-grid--list .nwgf-card-thumb { height: 180px; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}
@media (max-width: 600px) {
    .nwgf-hero-title { font-size: 1.6rem; }
    .nwgf-grid { grid-template-columns: 1fr; }
    .nwgf-modal-dialog { width: 98vw; height: 94vh; border-radius: var(--r-lg); }
    .nwgf-vp-switcher { display: none; }
    .nwgf-cats { gap: 6px; }
    .nwgf-cat { padding: 6px 14px; font-size: .78rem; }
}
