/* ============================================================
   AllVideo — UI Components
   AllPixel Technologies | allvideo.in
   ============================================================ */

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover:not(:disabled) { opacity: .85; }

.btn-brand {
  background: var(--primary);
  color: #fff;
}
.btn-brand:hover:not(:disabled) { background: var(--primary-hover); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: var(--bg-tertiary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-sm  { padding: 5px 14px; font-size: 13px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; }
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-full);
  aspect-ratio: 1;
}

/* ── Icon Button ──────────────────────────────────────── */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--text);
  transition: background var(--transition);
  flex-shrink: 0;
  position: relative;
}
.icon-btn:hover { background: var(--bg-tertiary); }
.icon-btn .material-symbols-rounded { font-size: 22px; }

/* ── Avatar ───────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}
.avatar.xs  { width: 24px; height: 24px; }
.avatar.sm  { width: 32px; height: 32px; }
.avatar.md  { width: 40px; height: 40px; }
.avatar.lg  { width: 56px; height: 56px; }
.avatar.xl  { width: 80px; height: 80px; }
.avatar.xxl { width: 120px; height: 120px; }

/* Verified badge */
.verified-icon {
  color: var(--primary);
  font-size: 14px !important;
  vertical-align: middle;
}

/* ── Forms ────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-label { font-size: 14px; font-weight: 600; color: var(--text); }
.form-input {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  width: 100%;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(14,165,233,.15);
}
.form-input::placeholder { color: var(--text-tertiary); }

.form-input.error { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-secondary); }

.textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.char-count { font-size: 12px; color: var(--text-secondary); text-align: right; }

.input-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  transition: border-color var(--transition);
}
.input-prefix:focus-within { border-color: var(--primary); }
.input-prefix > span {
  padding: 10px 12px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 14px;
  border-right: 1px solid var(--border);
}
.input-prefix .form-input { border: none; box-shadow: none; }

.radio-group { display: flex; gap: 20px; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

/* ── Modal ────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
}
.modal.open { display: flex; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  max-width: 520px;
  margin: 16px;
  animation: modal-in .2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--bg-tertiary); color: var(--text); }

/* ── Auth Modal ───────────────────────────────────────── */
.auth-modal-box { max-width: 440px; padding: 32px; }

.auth-step { display: flex; flex-direction: column; gap: 0; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 20px; }
.auth-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }
.auth-back { margin-bottom: 16px; }
.auth-divider {
  text-align: center;
  position: relative;
  color: var(--text-secondary);
  font-size: 13px;
  margin: 16px 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 44%;
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-register-link { text-align: center; font-size: 14px; color: var(--text-secondary); }
.auth-resend { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 16px; }

/* OTP inputs */
.otp-input-group { display: flex; gap: 10px; justify-content: center; margin-bottom: 24px; }
.otp-input {
  width: 50px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.otp-input:focus { border-color: var(--primary); }
.otp-input.filled { border-color: var(--primary); background: var(--primary-light); }

/* ── Upload Modal ─────────────────────────────────────── */
.upload-modal-box { max-width: 800px; }

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 40px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  margin: 24px;
  transition: border-color var(--transition), background var(--transition);
  cursor: pointer;
  text-align: center;
}
.upload-dropzone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-dropzone h3 { font-size: 16px; font-weight: 600; }
.upload-dropzone p { font-size: 13px; color: var(--text-secondary); }
.upload-icon { font-size: 64px; color: var(--primary); }

.upload-form { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 0 24px 24px; }
.upload-preview { position: relative; }
.upload-preview-video {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius-md);
}
.upload-progress {
  margin-top: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  height: 6px;
  overflow: hidden;
  position: relative;
}
.upload-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width .3s ease;
  width: 0;
}
#upload-progress-text {
  position: absolute;
  right: 0;
  top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.thumbnail-upload {
  position: relative;
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16/9;
  background: var(--bg-tertiary);
}
.thumbnail-upload img { width: 100%; height: 100%; object-fit: cover; }
.thumbnail-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transition: opacity var(--transition);
}
.thumbnail-upload:hover .thumbnail-overlay { opacity: 1; }

.upload-actions {
  grid-column: 1/-1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Toast Notifications ──────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  min-width: 300px;
  max-width: 500px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  animation: toast-in .3s ease;
  pointer-events: all;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.toast.removing {
  animation: toast-out .3s ease forwards;
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}
.toast-success .material-symbols-rounded { color: var(--success); }
.toast-error   .material-symbols-rounded { color: var(--danger); }
.toast-info    .material-symbols-rounded { color: var(--primary); }

/* ── Notification Panel ───────────────────────────────── */
.notification-panel {
  position: fixed;
  top: var(--header-h);
  right: 16px;
  width: 380px;
  max-height: calc(100vh - var(--header-h) - 16px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: dropdown-in .15s ease;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.notif-header h3 { font-size: 16px; font-weight: 700; }

.notif-list { overflow-y: auto; flex: 1; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  transition: background var(--transition);
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}
.notif-item:hover { background: var(--bg-tertiary); }
.notif-item.unread { background: var(--primary-light); }

.notif-icon { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-text { font-size: 13px; line-height: 1.4; }
.notif-time { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.notif-empty { padding: 40px; text-align: center; color: var(--text-secondary); font-size: 14px; }

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── User Dropdown ────────────────────────────────────── */
.user-dropdown {
  position: fixed;
  top: var(--header-h);
  right: 8px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  overflow: hidden;
  animation: dropdown-in .15s ease;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-user-info { padding: 16px 20px; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  width: 100%;
}
.dropdown-item:hover { background: var(--bg-tertiary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item .material-symbols-rounded { font-size: 20px; color: var(--text-secondary); }
.dropdown-item.danger .material-symbols-rounded { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Toggle Switch */
.toggle-switch {
  margin-left: auto;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
}
.toggle-on .toggle-switch { background: var(--primary); }
.toggle-on .toggle-switch::after { transform: translateX(18px); }

/* ── Link Button ──────────────────────────────────────── */
.link-btn {
  background: none;
  border: none;
  color: var(--link);
  cursor: pointer;
  font-size: inherit;
  font-family: var(--font);
  padding: 0;
  transition: color var(--transition);
}
.link-btn:hover { color: var(--link-hover); text-decoration: underline; }

/* ── Avatar Button ────────────────────────────────────── */
.avatar-btn {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  transition: opacity var(--transition);
}
.avatar-btn:hover { opacity: .85; }

/* Timer text */
.timer-text { font-size: 13px; color: var(--text-secondary); margin-left: 4px; }

/* ── Subscribe Button ─────────────────────────────────── */
.btn-subscribe {
  background: var(--text);
  color: var(--bg);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), opacity var(--transition);
}
.btn-subscribe.subscribed {
  background: var(--bg-tertiary);
  color: var(--text);
}
.btn-subscribe:hover { opacity: .85; }

/* ── Description Box ──────────────────────────────────── */
.description-box {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.6;
}
.description-box.collapsed { max-height: 80px; overflow: hidden; position: relative; }
.description-box.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg-tertiary));
}
.show-more-btn {
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  margin-top: 8px;
  background: none;
  border: none;
  font-family: var(--font);
  padding: 0;
}

/* ── Library / History Grid ───────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
}
.history-item:hover { background: var(--bg-tertiary); }
.history-thumb {
  width: 160px;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-tertiary);
  position: relative;
}
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,.3);
}
.progress-fill {
  height: 100%;
  background: var(--primary);
}

/* ── Studio / Upload page ─────────────────────────────── */
.studio-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
