/* VoiceReel app pages (login, settings, future dashboard) - built on top of
   the variables and resets in style.css */

.app-user-email {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-right: 4px;
}

/* Login */

.auth-section {
  padding: 96px 0;
  display: flex;
  justify-content: center;
}

.auth-wrap {
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 40px 36px;
  background: var(--color-white);
  box-shadow: var(--shadow-soft);
}

.auth-card h1 {
  font-size: 1.6rem;
  margin: 0 0 24px;
}

.auth-field {
  display: block;
  margin-bottom: 18px;
}

.auth-field span {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--color-ink);
}

.auth-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

/* Redeem (AppSumo LTD codes) */

.redeem-form {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.redeem-form input {
  min-width: 260px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.redeem-form input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-ink);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-google:hover {
  border-color: var(--color-muted);
  box-shadow: var(--shadow-soft);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-muted);
  font-size: 0.8rem;
  margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-switch {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-muted);
  margin: 24px 0 0;
}

.auth-switch a {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}

.auth-error {
  background: #fdecec;
  color: #b3261e;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  margin: 0 0 18px;
}

.auth-success {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  margin: 24px 0;
}

/* Avatar picker */

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
  margin: 40px 0 32px;
}

.avatar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 12px 18px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  background: var(--color-white);
}

.avatar-card:hover {
  border-color: var(--color-primary);
}

.avatar-card label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.avatar-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.avatar-thumb {
  position: relative;
  width: 120px;
  height: 160px;
}

.avatar-card img,
.avatar-card-placeholder {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
}

.avatar-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-card-placeholder svg {
  width: 40px;
  height: 40px;
  stroke: var(--color-primary);
}

.avatar-preview-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 22, 43, 0.65);
  color: var(--color-white);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.avatar-preview-btn:hover {
  background: var(--color-primary);
}

.avatar-card-name {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.avatar-voice-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  cursor: pointer;
}

.avatar-voice-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.avatar-voice-btn.is-playing {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.avatar-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 0.75rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.avatar-card-selected {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-soft);
}

.avatar-card-selected .avatar-card-check {
  display: flex;
}

/* Video preview modal */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 43, 0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.modal-open {
  display: flex;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  padding: 16px;
}

.modal-content video {
  display: block;
  width: 100%;
  border-radius: var(--radius-sm);
  background: #000;
}

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}

/* ------------------------------------------------------------------ *
 * Authenticated app: shared nav, create flow, dashboard, billing.
 * (Feature: web self-serve create + Stripe credit packs.)
 * ------------------------------------------------------------------ */

/* App nav (upload / dashboard / billing / settings) */
.app-nav {
  display: flex;
  gap: 6px;
  flex: 1;
  margin: 0 24px;
}

.app-nav-link {
  color: var(--color-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.app-nav-link:hover {
  color: var(--color-ink);
  background: var(--color-primary-light);
}

.app-nav-link-active {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.app-credits {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border-radius: 999px;
  padding: 5px 12px;
  text-decoration: none;
  margin-right: 4px;
}

@media (max-width: 720px) {
  .app-nav { margin: 8px 0 0; flex-basis: 100%; order: 3; flex-wrap: wrap; }
}

.wrap-narrow {
  max-width: 640px;
}

/* API key display (settings.php) */
.api-key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 40px;
}

.api-key-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  background: var(--color-primary-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
}

/* Create flow (upload.php) */
.create-form {
  margin-top: 28px;
}

.create-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  padding: 28px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 20px;
}

.create-field {
  display: block;
}

.create-field > span {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-ink);
}

.create-field textarea,
.create-field input[type="file"] {
  width: 100%;
  font: inherit;
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--color-white);
}

.create-field textarea {
  resize: vertical;
  min-height: 120px;
}

.create-field textarea:disabled,
.create-field input:disabled {
  background: #f6f7fc;
  cursor: not-allowed;
}

.create-hint {
  display: block;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}

.create-or {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin: 20px 0;
  position: relative;
}

.create-or::before,
.create-or::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: var(--color-border);
}

.create-or::before { left: 0; }
.create-or::after { right: 0; }

/* Dashboard (dashboard.php) */
.dash-empty {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
  color: var(--color-muted);
}

.dash-empty p { margin: 0 0 18px; }

.job-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
}

.job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  margin-bottom: 10px;
}

.job-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0; /* flex items don't shrink below content size by default - without this the title's ellipsis never triggers */
}

.job-title {
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-muted);
  font-size: 0.85rem;
}

.job-type { line-height: 1; }
.job-date { color: var(--color-muted); font-size: 0.85rem; }

.job-side { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.job-action { display: flex; align-items: center; gap: 8px; }

.job-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* In-flight states share a neutral "working" look; done/failed stand out. */
.job-badge-pending,
.job-badge-transcribing,
.job-badge-scripting,
.job-badge-rendering {
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.job-badge-done {
  color: #0f7a3d;
  background: #e4f6ec;
}

.job-badge-failed {
  color: #b42318;
  background: #fde7e5;
}

.job-error { color: #b42318; font-size: 0.85rem; }

@media (max-width: 560px) {
  .job-row { flex-direction: column; align-items: flex-start; }
}

/* Billing (billing.php) */
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin: 28px 0 16px;
}

.pack-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-white);
  box-shadow: var(--shadow-soft);
  padding: 28px 24px;
  text-align: center;
}

.pack-name { font-size: 1.1rem; margin: 0 0 8px; }
.pack-price { font-size: 2.2rem; font-weight: 700; color: var(--color-ink); margin: 0; }
.pack-credits { font-weight: 600; color: var(--color-primary); margin: 4px 0 2px; }
.pack-unit { color: var(--color-muted); font-size: 0.85rem; margin: 0 0 18px; }
.pack-footnote { color: var(--color-muted); font-size: 0.85rem; }
