:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #273449;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #8B0A30;
  --primary-hover: #a5113d;
  --blue: #2563eb;
  --success: #16a34a;
  --danger: #dc2626;
}
* { box-sizing: border-box; font-family: "Vazirmatn", Tahoma, sans-serif; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }

.overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, 0.82); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.login-card {
  width: 100%; max-width: 370px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px; text-align: center;
}
.login-icon { font-size: 40px; margin-bottom: 6px; }
.login-card h1 { margin: 0 0 4px; font-size: 18px; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; direction: ltr; }
.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 10px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
.login-card input:focus { border-color: var(--primary); }
.error-text { color: #f87171; font-size: 12px; margin-top: 8px; min-height: 18px; }

.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-weight: 700; font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  background: rgba(59, 130, 246, 0.16); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}

.container { max-width: 1180px; margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }

.upload-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.upload-top h2, .gallery-head h2 { margin: 0; font-size: 15.5px; }
.hint { font-size: 11.5px; color: var(--muted); }
.upload-controls { margin-bottom: 12px; }
.title-input, .search-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 13px; outline: none;
}
.title-input:focus, .search-input:focus { border-color: var(--primary); }
.search-input { max-width: 280px; }

.drop-zone {
  border: 2px dashed #475569; border-radius: 12px; padding: 28px 16px; text-align: center;
  cursor: pointer; transition: all 0.15s; background: rgba(15, 23, 42, 0.45);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: rgba(139, 10, 48, 0.1); }
.drop-icon { font-size: 30px; margin-bottom: 6px; }
.drop-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.drop-sub { font-size: 11.5px; color: var(--muted); }

.progress-wrap { margin-top: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.progress-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 7px; }
.progress-track { height: 9px; background: #1e293b; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #e11d48); transition: width 0.25s ease; }
.status-msg { font-size: 12.5px; margin-top: 10px; min-height: 18px; color: #86efac; }

.gallery-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 14px; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 34px 16px; color: var(--muted); font-size: 13px; }

.video-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.thumb-wrap { position: relative; aspect-ratio: 16 / 10; background: #020617; overflow: hidden; cursor: pointer; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, 0.28); font-size: 34px; transition: background 0.15s;
}
.thumb-wrap:hover .play-badge { background: rgba(2, 6, 23, 0.45); }
.dur-badge {
  position: absolute; bottom: 8px; left: 8px; background: rgba(2, 6, 23, 0.85); color: #fff;
  padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; direction: ltr;
}
.size-badge {
  position: absolute; bottom: 8px; right: 8px; background: rgba(15, 23, 42, 0.85); color: #93c5fd;
  padding: 2px 7px; border-radius: 6px; font-size: 11px; direction: ltr;
}

.video-body { padding: 11px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.video-title { font-weight: 700; font-size: 13px; line-height: 1.45; word-break: break-word; }
.video-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.video-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.action-row { display: flex; gap: 6px; }

.btn {
  border: 0; border-radius: 8px; padding: 8px 13px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s, background 0.15s; text-align: center;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-xs { padding: 5px 8px; font-size: 11.5px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #334155; }
.btn-danger { background: rgba(220, 38, 38, 0.16); color: #fca5a5; border: 1px solid rgba(220, 38, 38, 0.4); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.modal-card {
  width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h3 { margin: 0; font-size: 14.5px; }
.modal-links { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
