/* Video Library – shared styles */
:root {
    --primary: #00d9ff;
    --secondary: #7b2cbf;
    --accent: #ff006e;
    --whatsapp: #25d366;
    --dark: #0a0e27;
    --darker: #050714;
    --light: #e0e7ff;
    --text-muted: #a9b4d8;
    --panel: rgba(14, 19, 52, 0.88);
    --border: rgba(0, 217, 255, 0.28);
    --radius: 14px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 50%, #1a1a3e 100%) fixed;
    color: var(--light);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--primary); }
a:hover { color: #7deeff; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.visually-hidden, .offscreen {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; left: -9999px;
}

/* ---------- header ---------- */
.site-header {
    background: rgba(10, 14, 39, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.header-inner {
    max-width: 1300px; margin: 0 auto; padding: 0.9rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand {
    font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; text-decoration: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.site-nav { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.site-nav a, .link-button {
    color: var(--light); text-decoration: none; padding: 0.45rem 0.8rem; border-radius: 8px;
    font: inherit; font-size: 0.95rem; background: none; border: 0; cursor: pointer;
}
.site-nav a:hover, .link-button:hover { background: rgba(0, 217, 255, 0.12); color: var(--primary); }
.site-nav a.active { background: rgba(0, 217, 255, 0.18); color: var(--primary); font-weight: 600; }
.inline-form { display: inline; }

.page { max-width: 1300px; margin: 0 auto; padding: 1.5rem; }
h1 { font-size: 1.8rem; margin-bottom: 0.75rem; color: #fff; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; color: #fff; }
h3 { font-size: 1rem; margin: 1rem 0 0.5rem; color: #fff; }
.muted, .hint { color: var(--text-muted); }
.hint { font-size: 0.85rem; margin-top: 0.25rem; }

/* ---------- forms & buttons ---------- */
.field-label {
    display: block; margin: 0.9rem 0 0.35rem; color: var(--primary);
    font-weight: 600; font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase;
}
input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
    width: 100%; padding: 0.7rem 0.85rem; font: inherit; color: var(--light);
    background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: 8px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.2);
}
select option { background: var(--dark); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.65rem 1.1rem; border: 0; border-radius: 8px; cursor: pointer;
    font: inherit; font-weight: 600; text-decoration: none; white-space: nowrap;
    background: linear-gradient(135deg, var(--primary), #00a8cc); color: var(--darker);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 217, 255, 0.35); color: var(--darker); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn-secondary { background: rgba(123, 44, 191, 0.85); color: #fff; }
.btn-secondary:hover { background: var(--secondary); color: #fff; box-shadow: 0 4px 16px rgba(123, 44, 191, 0.4); }
.btn-danger { background: rgba(255, 0, 110, 0.85); color: #fff; }
.btn-danger:hover { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(255, 0, 110, 0.4); }
.btn-whatsapp { background: var(--whatsapp); color: #062b14; }
.btn-whatsapp:hover { color: #062b14; box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4); }
.btn-small { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; margin-top: 1.25rem; }
.link-like { color: var(--primary); text-decoration: underline; cursor: pointer; }
.check-label { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; cursor: pointer; }
.check-label input { width: 1.1rem; height: 1.1rem; accent-color: var(--primary); }

.alert { padding: 0.8rem 1rem; border-radius: 8px; margin: 0.75rem 0; }
.alert-error { background: rgba(255, 0, 110, 0.15); border: 1px solid var(--accent); color: #ffb3d1; }
.alert-success { background: rgba(37, 211, 102, 0.12); border: 1px solid var(--whatsapp); color: #b9f5cf; }
.alert-info { background: rgba(255, 196, 0, 0.1); border: 1px solid rgba(255, 196, 0, 0.45); color: #ffe08a; }
.notice { background: rgba(123, 44, 191, 0.2); border: 1px solid var(--secondary); padding: 0.8rem 1rem; border-radius: 8px; }

.badge {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
    background: rgba(0, 217, 255, 0.15); color: var(--primary); border: 1px solid var(--border);
}
.badge-public { background: rgba(37, 211, 102, 0.15); color: #8ff0b5; border-color: rgba(37, 211, 102, 0.4); }
.badge-unlisted { background: rgba(0, 217, 255, 0.15); color: var(--primary); }
.badge-private { background: rgba(255, 0, 110, 0.15); color: #ffb3d1; border-color: rgba(255, 0, 110, 0.4); }
.badge-processing { background: rgba(255, 196, 0, 0.15); color: #ffe08a; border-color: rgba(255, 196, 0, 0.4); }
.badge-failed { background: rgba(255, 0, 110, 0.2); color: #ffb3d1; border-color: var(--accent); }

/* ---------- library ---------- */
.filters {
    display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem 1.25rem 1.25rem; margin-bottom: 1.5rem;
}
.filter-group { min-width: 160px; }
.filter-group.grow { flex: 1 1 260px; }

.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.video-card {
    display: block; text-decoration: none; color: inherit;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.video-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 10px 30px rgba(0, 217, 255, 0.2); color: inherit; }
.video-thumb, .row-thumb {
    position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, rgba(0, 217, 255, 0.2), rgba(123, 44, 191, 0.25)); overflow: hidden;
}
.video-thumb img, .row-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.play-icon {
    position: relative; z-index: 1; width: 56px; height: 56px; border-radius: 50%;
    background: rgba(0, 217, 255, 0.9); display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s ease;
}
.play-icon::after {
    content: ''; margin-left: 4px;
    border-left: 18px solid var(--dark); border-top: 11px solid transparent; border-bottom: 11px solid transparent;
}
.video-card:hover .play-icon { transform: scale(1.15); }
.duration {
    position: absolute; right: 0.5rem; bottom: 0.5rem; z-index: 1; padding: 0.1rem 0.45rem;
    background: rgba(0, 0, 0, 0.75); color: #fff; border-radius: 6px; font-size: 0.8rem; font-variant-numeric: tabular-nums;
}
.video-card-body { padding: 1rem 1.1rem 1.2rem; }
.video-title { font-size: 1.05rem; margin: 0 0 0.35rem; color: #fff; }
.video-title a { color: #fff; text-decoration: none; }
.video-title a:hover { color: var(--primary); }
.video-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; color: var(--text-muted); font-size: 0.88rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state h1 { margin-bottom: 0.5rem; }
.empty-state p { margin-bottom: 1rem; }

/* ---------- watch page ---------- */
.back-link { text-decoration: none; font-weight: 600; display: inline-block; margin-bottom: 1rem; }
.watch { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.player-frame { background: #000; }
.player { display: block; width: 100%; max-height: 75vh; aspect-ratio: 16 / 9; background: #000; }
.player-placeholder {
    aspect-ratio: 16 / 9; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem; padding: 2rem; text-align: center; color: var(--text-muted);
}
.watch-info { padding: 1.5rem; }
.watch-info h1 { margin-bottom: 0.5rem; }
.action-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.25rem 0; }
.description { white-space: normal; color: var(--light); margin-bottom: 1rem; max-width: 75ch; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
    background: rgba(0, 217, 255, 0.15); color: var(--primary); padding: 0.25rem 0.75rem;
    border-radius: 999px; font-size: 0.82rem; border: 1px solid var(--border); text-decoration: none;
}
a.tag:hover { background: rgba(0, 217, 255, 0.3); }

.spinner {
    width: 48px; height: 48px; border-radius: 50%;
    border: 4px solid rgba(0, 217, 255, 0.2); border-top-color: var(--primary); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- auth ---------- */
.auth-card {
    max-width: 440px; margin: 2rem auto; padding: 2rem;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.auth-card > .muted { margin-top: 1.25rem; }

/* ---------- dialogs ---------- */
.dialog {
    margin: auto; width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
    padding: 1.5rem; color: var(--light);
    background: #0d1236; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }
.dialog-close-form { position: absolute; top: 0.75rem; right: 0.75rem; }
.dialog-close {
    width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1.4rem; line-height: 1;
    background: rgba(255, 0, 110, 0.85); color: #fff;
}
.share-video-title { color: var(--text-muted); margin-bottom: 0.5rem; padding-right: 2rem; }
.copy-row { display: flex; gap: 0.5rem; }
.copy-row input { min-width: 0; }
.copy-status { min-height: 1.3em; font-size: 0.85rem; color: var(--primary); margin-top: 0.35rem; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.qr-block { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.qr-canvas { width: 200px; height: 200px; border-radius: 8px; background: #fff; image-rendering: pixelated; }

/* ---------- dashboard ---------- */
.page-head { margin-bottom: 1.25rem; }
.app-promo {
    margin: 0 0 1.25rem; padding: 0.7rem 1rem; border-radius: 10px; font-size: 0.92rem;
    background: rgba(0, 217, 255, 0.08); border: 1px solid var(--border); color: var(--text-muted);
}
.app-promo strong { color: var(--light); }
.app-promo a { font-weight: 600; margin-left: 0.25rem; white-space: nowrap; }
.usage-bar { height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; margin-top: 0.5rem; max-width: 420px; }
.usage-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--secondary)); }

.upload-panel, .panel {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; margin-bottom: 1.5rem;
}
.dropzone {
    border: 2px dashed var(--border); border-radius: var(--radius); padding: 2rem 1rem; text-align: center; cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: rgba(0, 217, 255, 0.07); }
.upload-options { max-width: 380px; }
.upload-list { list-style: none; margin-top: 1rem; display: grid; gap: 0.75rem; }
.upload-item {
    display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 0.75rem; align-items: center;
    padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: rgba(0, 0, 0, 0.25);
}
.upload-name { font-weight: 600; overflow-wrap: anywhere; }
.upload-item progress { grid-column: 1 / -1; width: 100%; height: 8px; accent-color: var(--primary); }
.upload-status { grid-column: 1; font-size: 0.88rem; color: var(--text-muted); }
.upload-item [data-cancel] { grid-column: 2; grid-row: 1; }
.upload-error .upload-status { color: #ffb3d1; }

.my-videos { display: grid; gap: 1rem; }
.video-row {
    display: grid; grid-template-columns: 220px 1fr; gap: 1.1rem; align-items: start;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem;
}
.video-row.is-target { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 0, 110, 0.35); }
.row-thumb { border-radius: 10px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.75rem; }
.visibility-select { width: auto; padding: 0.4rem 0.6rem; font-size: 0.88rem; }

.thumb-tools { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.thumb-tool + .thumb-tool { margin-top: 0.25rem; }
input[type="file"] { color: var(--text-muted); font: inherit; font-size: 0.9rem; }

/* ---------- admin ---------- */
.inline-fields { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.invite-result { margin-top: 1rem; }
.invite-result .copy-row { flex-wrap: wrap; margin-top: 0.5rem; }
.invite-result .copy-row input { flex: 1 1 280px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid rgba(0, 217, 255, 0.12); vertical-align: middle; }
.table th { color: var(--primary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; }
.table td:last-child { white-space: nowrap; text-align: right; }
.table tr.is-disabled td { opacity: 0.55; }
.quota-input { max-width: 110px; padding: 0.35rem 0.5rem; }
.quota-input.is-saved { border-color: var(--whatsapp); }
code { font-family: ui-monospace, Consolas, monospace; color: #fff; }

/* ---------- the π access button ---------- */
.pi-access {
    position: fixed; right: 2rem; bottom: 2rem; z-index: 40;
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; text-decoration: none;
    color: rgba(0, 217, 255, 0.45);
    background: rgba(10, 14, 39, 0.7); backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 217, 255, 0.2);
    transition: all 0.3s ease;
}
.pi-access:hover, .pi-access:focus-visible {
    color: var(--primary); background: rgba(10, 14, 39, 0.95); border-color: var(--primary);
    transform: scale(1.1); box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
}

/* ---------- small screens ---------- */
@media (max-width: 700px) {
    .page { padding: 1rem; }
    .header-inner { padding: 0.75rem 1rem; }
    .brand { font-size: 1.2rem; }
    h1 { font-size: 1.45rem; }
    .filters { padding: 0.75rem 1rem 1rem; gap: 0.5rem 0.75rem; }
    .filter-group { flex: 1 1 140px; min-width: 0; }
    .filters .btn { flex: 1 1 100%; }
    .video-row { grid-template-columns: 1fr; }
    .watch-info { padding: 1rem; }
    .copy-row { flex-wrap: wrap; }
    .pi-access { right: 1rem; bottom: 1rem; width: 45px; height: 45px; font-size: 1.3rem; }
}
