/* =========================================
   NEXUS BASE — Reset, Typography, Utilities
   ========================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--nx-text-primary);
    background-color: var(--nx-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--nx-text-link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }
h1,h2,h3,h4,h5,h6 { line-height: 1.25; font-weight: 600; }
p { margin: 0; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* ── Typography ──────────────────────────── */

.nx-text-sm   { font-size: 0.8125rem; }
.nx-text-md   { font-size: 0.9375rem; }
.nx-text-lg   { font-size: 1.0625rem; }
.nx-text-xl   { font-size: 1.25rem; }
.nx-text-2xl  { font-size: 1.5rem; }

.nx-text-muted    { color: var(--nx-text-secondary); }
.nx-text-primary  { color: var(--nx-text-primary); }
.nx-text-link     { color: var(--nx-primary); }
.nx-font-semibold { font-weight: 600; }
.nx-font-bold     { font-weight: 700; }

/* ── Spacing utilities ───────────────────── */
.nx-mt-sm { margin-top: var(--nx-spacing-sm); }
.nx-mt-md { margin-top: var(--nx-spacing-md); }
.nx-mb-md { margin-bottom: var(--nx-spacing-md); }
.nx-p-md  { padding: var(--nx-spacing-md); }

/* ── Flexbox utils ───────────────────────── */
.nx-flex        { display: flex; }
.nx-flex-center { display: flex; align-items: center; }
.nx-flex-between{ display: flex; align-items: center; justify-content: space-between; }
.nx-flex-col    { display: flex; flex-direction: column; }
.nx-gap-sm      { gap: var(--nx-spacing-sm); }
.nx-gap-md      { gap: var(--nx-spacing-md); }

/* ── Cards ───────────────────────────────── */
.nx-card {
    background: var(--nx-card);
    border-radius: var(--nx-radius);
    box-shadow: var(--nx-shadow);
    border: 1px solid var(--nx-border-light);
    overflow: hidden;
}

/* ── Avatars ─────────────────────────────── */
.nx-avatar {
    border-radius: var(--nx-radius-full);
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--nx-border);
}
.nx-avatar-xs  { width: 28px;  height: 28px; }
.nx-avatar-sm  { width: 36px;  height: 36px; }
.nx-avatar-md  { width: 40px;  height: 40px; }
.nx-avatar-lg  { width: 56px;  height: 56px; }
.nx-avatar-xl  { width: 96px;  height: 96px; }
.nx-avatar-2xl { width: 140px; height: 140px; }

/* ── Badges ──────────────────────────────── */
.nx-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    background: var(--nx-accent);
    border-radius: var(--nx-radius-full);
    border: 2px solid var(--nx-card);
}
.nx-badge-xs { min-width: 14px; height: 14px; font-size: 0.5625rem; padding: 0 3px; }

/* ── Buttons ─────────────────────────────── */
.nx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: var(--nx-radius);
    border: none;
    cursor: pointer;
    transition: background var(--nx-transition), opacity var(--nx-transition);
    white-space: nowrap;
    text-decoration: none;
}
.nx-btn:hover { opacity: 0.9; text-decoration: none; }
.nx-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.nx-btn-primary   { background: var(--nx-primary);       color: #fff; }
.nx-btn-secondary { background: var(--nx-border);        color: var(--nx-text-primary); }
.nx-btn-danger    { background: var(--nx-accent);        color: #fff; }
.nx-btn-ghost     { background: transparent;             color: var(--nx-text-primary); }
.nx-btn-sm        { padding: 6px 12px; font-size: 0.8125rem; border-radius: var(--nx-radius-sm); }
.nx-btn-lg        { padding: 12px 24px; font-size: 1rem; }
.nx-btn-block     { width: 100%; }
.nx-btn-icon      { padding: 8px; border-radius: var(--nx-radius); }
.nx-link-btn      { color: var(--nx-primary); font-size: 0.875rem; font-weight: 500; cursor: pointer; }
.nx-link-btn:hover{ text-decoration: underline; }

/* ── Forms ───────────────────────────────── */
.nx-form-group { margin-bottom: var(--nx-spacing-md); }
.nx-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nx-text-secondary);
}
.nx-input,
.nx-textarea,
.nx-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    color: var(--nx-text-primary);
    background: var(--nx-bg-secondary);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    transition: border-color var(--nx-transition), box-shadow var(--nx-transition);
    outline: none;
}
.nx-input:focus,
.nx-textarea:focus,
.nx-select:focus {
    border-color: var(--nx-primary);
    box-shadow: 0 0 0 3px var(--nx-primary-light);
}
.nx-textarea { resize: vertical; min-height: 100px; }
.nx-input-error { border-color: var(--nx-accent) !important; }
.nx-error-msg   { color: var(--nx-accent); font-size: 0.8125rem; margin-top: 4px; }

/* ── Dividers ────────────────────────────── */
.nx-divider { border: none; border-top: 1px solid var(--nx-border); margin: var(--nx-spacing-md) 0; }

/* ── Loading spinner ─────────────────────── */
.nx-spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--nx-border);
    border-top-color: var(--nx-primary);
    border-radius: 50%;
    animation: nx-spin 0.7s linear infinite;
    margin: 0 auto;
}
.nx-spinner-lg { width: 40px; height: 40px; border-width: 4px; }

@keyframes nx-spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────── */
.nx-empty-state {
    text-align: center;
    padding: var(--nx-spacing-xl);
    color: var(--nx-text-muted);
}
.nx-empty-state svg { margin: 0 auto var(--nx-spacing-md); opacity: 0.4; }
.nx-empty-state h3  { margin-bottom: var(--nx-spacing-sm); }

/* ── Toast notifications ─────────────────── */
.nx-toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--nx-z-toast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.nx-toast {
    padding: 12px 20px;
    background: #333;
    color: #fff;
    border-radius: var(--nx-radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--nx-shadow-md);
    pointer-events: auto;
    animation: nx-toast-in 0.3s ease forwards;
}
.nx-toast-success { background: #2e7d32; }
.nx-toast-error   { background: var(--nx-accent); }

@keyframes nx-toast-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes nx-toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-12px); }
}

/* ── Modals ──────────────────────────────── */
.nx-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: calc(var(--nx-z-modal) - 1);
    backdrop-filter: blur(2px);
}
.nx-modal {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: var(--nx-z-modal);
    padding: var(--nx-spacing-md);
}
.nx-modal-box {
    background: var(--nx-card);
    border-radius: var(--nx-radius-lg);
    box-shadow: var(--nx-shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: nx-modal-in 0.25s ease;
}
.nx-modal-post { max-width: 580px; }
@keyframes nx-modal-in {
    from { opacity: 0; transform: scale(0.94) translateY(-16px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.nx-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--nx-spacing-md);
    border-bottom: 1px solid var(--nx-border);
}
.nx-modal-title { font-size: 1.125rem; font-weight: 700; }
.nx-modal-body  { padding: var(--nx-spacing-md); }

/* ── Dropdowns ───────────────────────────── */
.nx-dropdown {
    position: absolute;
    background: var(--nx-card);
    border: 1px solid var(--nx-border);
    border-radius: var(--nx-radius);
    box-shadow: var(--nx-shadow-md);
    z-index: var(--nx-z-dropdown);
    animation: nx-dropdown-in 0.15s ease;
    min-width: 200px;
}
@keyframes nx-dropdown-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.nx-dropdown-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    font-weight: 700;
    border-bottom: 1px solid var(--nx-border);
}
.nx-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    font-size: 0.9375rem;
    color: var(--nx-text-primary);
    width: 100%;
    text-align: left;
    transition: background var(--nx-transition);
    border-radius: 0;
    text-decoration: none;
}
.nx-dropdown-item:hover { background: var(--nx-bg); text-decoration: none; color: var(--nx-text-primary); }
.nx-dropdown-divider  { border-top: 1px solid var(--nx-border); margin: 4px 0; }
.nx-dropdown-footer {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nx-primary);
    border-top: 1px solid var(--nx-border);
    text-decoration: none;
}
.nx-dropdown-footer:hover { background: var(--nx-bg); text-decoration: none; }

/* ── Lightbox ────────────────────────────── */
.nx-lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: calc(var(--nx-z-modal) + 10);
    display: flex; align-items: center; justify-content: center;
}
.nx-lightbox-content { max-width: 90vw; max-height: 90vh; }
.nx-lightbox-content img { max-width: 90vw; max-height: 90vh; object-fit: contain; border-radius: var(--nx-radius); }
.nx-lightbox-close,
.nx-lightbox-prev,
.nx-lightbox-next {
    position: absolute;
    color: #fff;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: var(--nx-radius-full);
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background var(--nx-transition);
}
.nx-lightbox-close:hover,
.nx-lightbox-prev:hover,
.nx-lightbox-next:hover { background: rgba(255,255,255,0.3); }
.nx-lightbox-close { top: 16px; right: 16px; }
.nx-lightbox-prev  { left: 16px; top: 50%; transform: translateY(-50%); }
.nx-lightbox-next  { right: 16px; top: 50%; transform: translateY(-50%); }

/* ── Verified badge ──────────────────────── */
.nx-verified-badge { display: inline-flex; align-items: center; }
.nx-verified-icon  { display: inline-block; vertical-align: middle; margin-left: 2px; }

/* ── Tags / Pills ────────────────────────── */
.nx-tag {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    font-size: 0.75rem; font-weight: 600;
    border-radius: var(--nx-radius-full);
    background: var(--nx-primary-light);
    color: var(--nx-primary);
}

/* ── Section title ───────────────────────── */
.nx-section-title { font-size: 1rem; font-weight: 700; margin-bottom: var(--nx-spacing-md); }
.nx-see-all-link  { display: block; text-align: center; padding: 8px; font-size: 0.875rem; font-weight: 600; color: var(--nx-primary); }
