/* ============================================================
   Sovbit User Portal - Styles
   ============================================================ */

:root {
    --bg-primary: #0d0d1a;
    --bg-secondary: #12122a;
    --bg-card: #1a1a2e;
    --bg-input: #0f0f20;
    --border: #2a2a4a;
    --orange: #f7931a;
    --orange-dim: rgba(247, 147, 26, 0.15);
    --orange-border: rgba(247, 147, 26, 0.3);
    --text-primary: #e8e8f0;
    --text-muted: #7878a0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --nostr-purple: #8b5cf6;
    --sidebar-width: 240px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: var(--orange);
    word-break: break-all;
}

/* ============================================================
   Login Page
   ============================================================ */

.login-page {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 16px;
    border-radius: 50%;
}

.login-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.extension-status { margin-bottom: 20px; text-align: center; font-size: 0.9rem; }
.ext-found { color: var(--success); }
.ext-missing { color: var(--warning); }

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px;
    color: var(--danger);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.loading-message {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-footer p { margin-bottom: 6px; }

.login-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 0.75rem 0;
    position: relative;
}
.login-divider::before,
.login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

/* ============================================================
   Portal Layout
   ============================================================ */

.portal-page { display: flex; }

.portal-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--orange-dim);
    border: 1px solid var(--orange-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--orange);
    overflow: hidden;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-npub-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
    text-decoration: none;
}

.nav-item.active {
    color: var(--orange);
    background: var(--orange-dim);
    border-right: 2px solid var(--orange);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.back-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    text-decoration: none;
}

.back-link:hover { color: var(--text-primary); text-decoration: none; }

/* Main content */
.portal-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 48px 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}

.tab-content {
    display: none;
    width: 100%;
    max-width: 1100px;
}
.tab-content.active { display: block; }

.account-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
}

.account-top-row .card { margin-bottom: 0; }

@media (max-width: 860px) {
    .portal-main { padding: 32px 24px; }
    .account-top-row { grid-template-columns: 1fr; }
}


.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 0.9rem; }

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* ============================================================
   Info Grid (Account)
   ============================================================ */

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.info-value {
    font-size: 1rem;
    font-weight: 500;
}

.info-value.highlight { font-size: 1.6rem; font-weight: 700; }
.info-value.highlight.good { color: var(--success); }
.info-value.highlight.warning { color: var(--warning); }
.info-value.highlight.danger { color: var(--danger); }
.info-value.mono { font-family: monospace; font-size: 0.8rem; }
.info-value.small { font-size: 0.82rem; }

/* Pubkey row */
.pubkey-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pubkey-value-row {
    margin: 8px 0 10px;
}

.pubkey-value-row .info-value {
    display: block;
    word-break: break-all;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    line-height: 1.5;
}

.pubkey-copy-row {
    display: flex;
    gap: 8px;
}

/* ============================================================
   Connection Details
   ============================================================ */

.connection-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.connection-item:last-child { border-bottom: none; }

.conn-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.conn-value-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ============================================================
   Slider
   ============================================================ */

.slider-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.slider-days-label {
    font-size: 1.1rem;
    font-weight: 600;
}

.days-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    margin: 4px 0 8px;
}

.days-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--orange);
    cursor: pointer;
    border: 2px solid #000;
}

.days-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--orange);
    cursor: pointer;
    border: 2px solid #000;
}

.slider-marks {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.slider-marks span {
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

.slider-marks span:hover { color: var(--orange); }

.price-breakdown {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.total-row {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.savings { color: var(--success); }

/* ============================================================
   Renewal
   ============================================================ */

.renewal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.invoice-row {
    display: flex;
    gap: 8px;
    margin: 16px 0 8px;
}

.invoice-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-family: monospace;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.invoice-note {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.qr-container {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

.qr-container canvas, .qr-container img {
    border-radius: 0;
    border: none;
    background: #ffffff;
    padding: 12px;
    display: block;
}

.renewal-success {
    text-align: center;
    padding: 20px;
    color: var(--success);
}

.success-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

/* ============================================================
   Tools Tab
   ============================================================ */

.tool-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.tool-error {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: var(--danger);
    font-size: 0.88rem;
}

.tool-result-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    align-items: start;
}

.tool-result-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tool-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.tool-status {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.tool-status-ok  { color: var(--success); }
.tool-status-err { color: var(--danger); }

/* ============================================================
   Files Placeholder
   ============================================================ */

.placeholder-section {
    text-align: center;
    padding: 48px 20px;
}

.placeholder-icon {
    margin-bottom: 16px;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
}

.placeholder-section h3 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.placeholder-section p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 420px;
    margin: 0 auto 8px;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-success { background: rgba(16,185,129,0.15); color: var(--success); border: 1px solid rgba(16,185,129,0.3); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); border: 1px solid rgba(245,158,11,0.3); }

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--orange);
    color: #000;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   Toast
   ============================================================ */

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.88rem;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.25s;
    max-width: 320px;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--orange); }

/* ============================================================
   Spinner
   ============================================================ */

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ============================================================
   Files Tab
   ============================================================ */

.quota-bar {
    height: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.quota-fill {
    height: 100%;
    background: var(--orange);
    border-radius: 4px;
    transition: width 0.4s ease;
    min-width: 2px;
}

.quota-fill.warning { background: var(--warning); }
.quota-fill.danger  { background: var(--danger); }

.quota-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Generic progress bar (video upload) ─────────────────────────────────── */
.progress-bar-outer {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}
.progress-bar-inner {
    height: 100%;
    background: var(--nostr-purple);
    border-radius: 3px;
    transition: width 0.2s ease;
    min-width: 2px;
}

/* ── Files sub-tabs ───────────────────────────────────────────────────────── */
.files-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.files-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 8px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 0;
    transition: color 0.15s, border-color 0.15s;
}

.files-tab:hover { color: var(--text); }

.files-tab.active {
    color: var(--orange);
    border-bottom-color: var(--orange);
}

.files-tab-panel { /* no special styling needed, just shown/hidden */ }

/* ── Gallery ──────────────────────────────────────────────────────────────── */
.files-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.gallery-tile {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border);
    aspect-ratio: 1;
    cursor: pointer;
    transition: border-color 0.15s;
}

.gallery-tile:hover { border-color: var(--orange-border); }

.gallery-thumb {
    width: 100%;
    height: 100%;
    position: relative;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-thumb-icon {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.gallery-video-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
    pointer-events: none;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.18s;
    padding: 12px;
}

.gallery-tile:hover .gallery-overlay { opacity: 1; }

.gallery-name {
    font-size: 0.8rem;
    color: #fff;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-actions {
    display: flex;
    gap: 6px;
}

.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s;
}

.file-card:hover { border-color: var(--orange-border); }

.file-preview {
    height: 140px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.file-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-thumb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    width: 100%;
    height: 100%;
}

.file-meta {
    padding: 10px 12px 6px;
    flex: 1;
}

.file-name {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.file-details {
    display: flex;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-card-actions {
    display: flex;
    gap: 6px;
    padding: 8px 10px 10px;
}

.file-card-actions .btn { flex: 1; justify-content: center; }

.files-empty,
.files-loading-msg {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }

/* ============================================================
   Upload Zone
   ============================================================ */

.upload-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
    border-color: var(--orange);
    background: var(--orange-dim);
    color: var(--text-primary);
}

.upload-drop-zone p { font-size: 0.9rem; margin: 0; }

.upload-browse-link {
    color: var(--orange);
    text-decoration: underline;
    cursor: pointer;
}

.upload-queue {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.upload-queue-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.uq-progress {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    overflow: hidden;
    margin-top: -4px;
}

.uq-progress-fill {
    height: 100%;
    background: var(--nostr-purple);
    border-radius: 2px;
    transition: width 0.1s;
    width: 0%;
}

.uq-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.uq-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 340px;
}

.uq-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.uq-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.uq-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
}

.uq-pending   { background: rgba(120,120,160,0.15); color: var(--text-muted); border: 1px solid var(--border); }
.uq-uploading { background: rgba(247,147,26,0.15);  color: var(--orange);     border: 1px solid var(--orange-border); }
.uq-done      { background: rgba(16,185,129,0.15);  color: var(--success);    border: 1px solid rgba(16,185,129,0.3); }
.uq-error     { background: rgba(239,68,68,0.15);   color: var(--danger);     border: 1px solid rgba(239,68,68,0.3); }

.uq-error-msg {
    font-size: 0.78rem;
    color: var(--danger);
    max-width: 200px;
    text-align: right;
    line-height: 1.3;
}

/* ============================================================
   Profile Tab
   ============================================================ */

/* Banner */
.profile-banner {
    width: 100%;
    height: 140px;
    background: var(--bg-input);
    border-bottom: 2px dashed var(--border);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background-size: cover;
    background-position: center;
}

.profile-banner:hover { border-color: var(--orange); }

.profile-banner-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

/* Avatar area below banner */
.profile-avatar-area {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding: 0 20px 16px;
    margin-top: -36px;
    position: relative;
    background: var(--bg-card);
}

.profile-avatar-edit {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
    background: var(--bg-input);
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    transition: opacity 0.15s;
}

.profile-avatar-edit:hover { opacity: 0.85; }

.profile-avatar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.profile-avatar-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    border-radius: 50%;
    color: #fff;
}

.profile-avatar-edit:hover .avatar-upload-overlay { opacity: 1; }

/* Profile form */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
    resize: vertical;
    box-sizing: border-box;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--orange);
}

.form-control:focus {
    border-color: var(--nostr-purple);
    box-shadow: 0 0 0 2px rgba(139,92,246,0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

/* Upload status */
.profile-upload-status {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: none;
}

/* NIP-05 section */
.nip05-current-row {
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
    display: none;
}

.nip05-current-row strong {
    color: var(--text-primary);
}

.nip05-input-row {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.nip05-input-row input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    min-width: 0;
}

.nip05-at-sep {
    color: var(--text-muted);
    padding: 0 4px;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.nip05-domain {
    color: var(--text-muted);
    padding: 9px 12px 9px 0;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Profile actions row */
.profile-actions-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 4px;
}

.profile-action-status {
    font-size: 0.85rem;
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    display: none;
}

/* Profile hero card — remove default overflow so avatar can bleed */
.profile-hero-card {
    overflow: visible !important;
}

/* Tools 2-column layout */
.tools-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.tools-columns .card {
    margin-bottom: 0;
}

@media (max-width: 860px) {
    .tools-columns { grid-template-columns: 1fr; }
}

/* Profile 2-column layout */
.profile-columns {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    align-items: start;
}

.profile-right-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-right-col .card {
    margin-bottom: 0;
}

@media (max-width: 860px) {
    .profile-columns {
        grid-template-columns: 1fr;
    }
}

/* Label hint (secondary text next to label) */
.label-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

/* Inline input inside NIP-05 row (matches form-group inputs) */
#nip05-username-input {
    background: transparent;
    border: none;
    padding: 9px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    width: 100%;
    min-width: 0;
}

/* Profile load status (inline near card header) */
#profile-load-status {
    display: none;
}

/* Profile backup meta (Tools tab) */
.profile-backup-meta {
    margin-top: 14px;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.88rem;
    display: none;
}

.profile-backup-meta strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

.profile-backup-meta .backup-fields {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Contact Admin modal overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.modal-close:hover { color: var(--text-primary); }

/* ── HLS Video Player ────────────────────────────────────────────────────────── */

.gallery-tier-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.04em;
    pointer-events: none;
}

#video-player-modal {
    align-items: center;
    justify-content: center;
}

#video-player-modal .modal-box {
    padding: 0;
    overflow: hidden;
}

#video-player-modal .modal-header {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.video-status-msg {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    padding: 1rem;
}

.video-status-error {
    color: #f87171;
    font-size: 0.9rem;
}

.uq-transcode-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    display: block;
}

.gallery-transcoding-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.72);
    color: #facc15;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    padding: 4px 6px;
    letter-spacing: 0.03em;
    pointer-events: none;
}

/* ── Videos Tab ──────────────────────────────────────────────────────────────── */

.video-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.video-card-thumb {
    flex-shrink: 0;
    width: 120px;
    height: 68px;
    border-radius: 5px;
    overflow: hidden;
    background: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card-thumb-icon {
    font-size: 1.8rem;
    color: rgba(255,255,255,0.3);
}

.video-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.35);
}

.video-card-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0);
    color: rgba(255,255,255,0);
    font-size: 1.4rem;
    transition: background 0.15s, color 0.15s;
}

.video-card-thumb:hover .video-card-play-overlay {
    background: rgba(0,0,0,0.45);
    color: #fff;
}

.video-card-body {
    flex: 1;
    min-width: 0;
}

.video-card-title {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.2rem;
}

.video-card-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.video-card-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.video-card-status-note {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.video-card-variants {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.video-quality-chip {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(139,92,246,0.15);
    color: var(--nostr-purple);
    border: 1px solid rgba(139,92,246,0.25);
    letter-spacing: 0.03em;
}

.video-card-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.25rem;
}

.video-card-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-end;
}

@media (max-width: 500px) {
    .video-card { flex-wrap: wrap; }
    .video-card-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
}

/* ── Video gallery toolbar ───────────────────────────────────────────────────── */

.vf-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.vf-tabs { display: flex; gap: 0.25rem; }

.vf-tab {
    background: none;
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.vf-tab:hover { background: var(--bg-secondary); color: var(--text-primary); }
.vf-tab-active { background: var(--nostr-purple); border-color: var(--nostr-purple); color: #fff; }
.vf-tab-active:hover { background: var(--nostr-purple); color: #fff; }

.vf-tab-count {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border-radius: 1rem;
    padding: 0 0.4rem;
    font-size: 0.75rem;
    min-width: 1.2rem;
    text-align: center;
}
.vf-tab:not(.vf-tab-active) .vf-tab-count { background: var(--bg-secondary); }

.vf-view-toggle { display: flex; gap: 0.25rem; }

.vf-bulk-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.vf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 0 0.5rem;
}
.vf-page-info { font-size: 0.85rem; color: var(--text-muted); }

/* Card grid wrapper */
.video-card-grid { display: flex; flex-direction: column; gap: 0.5rem; }

/* Checkbox on video card */
.video-card-cb-wrap {
    flex-shrink: 0;
    width: 1.5rem;
    display: flex;
    align-items: flex-start;
    padding-top: 0.25rem;
}
.video-card-cb {
    cursor: pointer;
    accent-color: var(--nostr-purple);
    width: 1rem;
    height: 1rem;
}
.video-card.selected {
    background: rgba(139,92,246,0.08);
    border-color: var(--nostr-purple);
}

/* Compact table view */
.video-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.video-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.video-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.vt-row:hover { background: var(--bg-secondary); }
.vt-row.selected { background: rgba(139,92,246,0.08); }
.vt-cb { cursor: pointer; accent-color: var(--nostr-purple); }

.video-table-thumb {
    width: 64px;
    height: 36px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}
.video-table-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Publish to Nostr button ─────────────────────────────────────────────────
   Purple accent button for the NIP-07 "Sign & Publish" flow.
   Uses --nostr-purple so it's visually distinct from primary (orange) actions. */
.btn-nostr {
    background: transparent;
    color: var(--nostr-purple);
    border: 1px solid var(--nostr-purple);
}
.btn-nostr:hover:not(:disabled) {
    background: var(--nostr-purple);
    color: #fff;
}

/* ── Publish modal: kind selector ────────────────────────────────────────────*/
.publish-kind-option {
    flex: 1;
    cursor: pointer;
}
.publish-kind-option input[type="radio"] {
    display: none;
}
.publish-kind-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    transition: border-color 0.15s, background 0.15s;
    font-size: 0.85rem;
    line-height: 1.3;
}
.publish-kind-option input[type="radio"]:checked + .publish-kind-label {
    border-color: var(--nostr-purple);
    background: rgba(139,92,246,0.10);
}
.publish-kind-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    color: var(--nostr-purple);
}

/* ── Payment Targets (NIP-A3) ────────────────────────────────────────────────*/
.payto-empty {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.payto-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.payto-entry:last-child { border-bottom: none; }
.payto-type-badge {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--orange-dim);
    border: 1px solid var(--orange-border);
    color: var(--orange);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 72px;
    text-align: center;
}
.payto-authority {
    flex: 1;
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    word-break: break-all;
    min-width: 0;
}
.payto-remove { flex-shrink: 0; padding: 2px 7px; }
.payto-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}
.payto-type-select {
    padding: 7px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    flex-shrink: 0;
}
.payto-type-select:focus { outline: none; border-color: var(--orange); }
.payto-type-custom { max-width: 90px; }
.payto-add-row .form-control { flex: 1; min-width: 120px; }
