@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg-0: #ffffff;
  --bg-1: #f8f8fa;
  --bg-2: #f0f0f3;
  --bg-3: #e8e8ec;
  --bg-hover: #ededf0;
  --border: #e0e0e5;
  --border-light: #eaeaef;
  --text-0: #111118;
  --text-1: #3c3c43;
  --text-2: #6e6e7a;
  --text-3: #9d9daa;
  --accent: #4f46e5;
  --accent-light: #6366f1;
  --accent-subtle: rgba(79, 70, 229, 0.08);
  --accent-mid: rgba(79, 70, 229, 0.15);
  --danger: #dc2626;
  --danger-subtle: rgba(220, 38, 38, 0.08);
  --success: #16a34a;
  --success-subtle: rgba(22, 163, 74, 0.08);
  --warning: #d97706;
  --warning-subtle: rgba(217, 119, 6, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --transition: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-0: #0c0c0e;
    --bg-1: #141416;
    --bg-2: #1c1c20;
    --bg-3: #26262b;
    --bg-hover: #222227;
    --border: #2a2a30;
    --border-light: #222228;
    --text-0: #f0f0f2;
    --text-1: #c0c0c8;
    --text-2: #8a8a96;
    --text-3: #5c5c68;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-subtle: rgba(99, 102, 241, 0.12);
    --accent-mid: rgba(99, 102, 241, 0.2);
    --danger-subtle: rgba(220, 38, 38, 0.15);
    --success-subtle: rgba(22, 163, 74, 0.15);
    --warning-subtle: rgba(217, 119, 6, 0.15);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  }
}

/* ========== Reset ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-0);
  color: var(--text-0);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ========== Animations ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spinIn {
  from { opacity: 0; transform: rotate(-90deg) scale(0.5); }
  to { opacity: 1; transform: rotate(0deg) scale(1); }
}

/* ========== Form Elements ========== */
input[type="text"],
input[type="password"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select {
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

input::placeholder { color: var(--text-3); }

/* ========== Buttons ========== */
button, .btn {
  background: var(--bg-2);
  color: var(--text-0);
  border: 1px solid var(--border);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.84rem;
  font-family: inherit;
  font-weight: 500;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

button:hover, .btn:hover {
  background: var(--bg-3);
  border-color: var(--border);
}

button:active, .btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.btn-small {
  padding: 0.38rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: var(--danger-subtle);
}

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--bg-2);
  color: var(--text-0);
}

.error-msg {
  background: var(--danger-subtle);
  color: var(--danger);
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  animation: slideDown 0.25s ease both;
}

/* ========== Login / Password Pages ========== */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg-1);
}

.login-card {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-card h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
}

.login-card .subtitle {
  color: var(--text-2);
  font-size: 0.875rem;
  margin-bottom: 1.6rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.login-card button[type="submit"] {
  margin-top: 0.4rem;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 0.65rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.login-card button[type="submit"]:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.login-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.2rem;
  animation: spinIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.login-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ========== Admin Layout ========== */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  animation: slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.logo-icon {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

section h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}

section h2 span {
  font-weight: 400;
  color: var(--text-3);
}

/* ========== Upload ========== */
.upload-section {
  margin-bottom: 2rem;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.upload-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 1rem;
  position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.drop-zone-icon {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  transition: transform 0.25s ease;
}

.drop-zone:hover .drop-zone-icon {
  transform: translateY(-3px);
}

.drop-zone p {
  color: var(--text-2);
  font-size: 0.85rem;
}

.drop-zone .browse-link {
  color: var(--accent);
  font-weight: 500;
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.expiry-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
  grid-column: 1 / -1;
}

.expiry-row input[type="date"] { flex: 1; min-width: 130px; }
.expiry-row input[type="time"] { width: 110px; flex: 0 0 auto; }

.expiry-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  grid-column: 1 / -1;
}

.expiry-preset {
  font-size: 0.72rem !important;
  padding: 0.3rem 0.55rem !important;
  background: var(--bg-2) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-2) !important;
  border-radius: 5px !important;
  cursor: pointer;
  transition: all var(--transition);
}

.expiry-preset:hover {
  background: var(--accent-subtle) !important;
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--text-1);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.upload-area-progress {
  padding: 2rem 1.5rem;
  text-align: center;
}

.upload-area-progress .upload-progress-bar {
  max-width: 320px;
  margin: 0 auto;
  height: 8px;
  border-radius: 4px;
}

.upload-area-progress .upload-progress-fill {
  border-radius: 4px;
}

.upload-area-progress-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 0.75rem;
}

#upload-btn {
  grid-column: 1 / -1;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  padding: 0.65rem;
  font-weight: 600;
}

#upload-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

#upload-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.progress-bar {
  margin-top: 0.65rem;
  background: var(--bg-2);
  border-radius: 20px;
  height: 26px;
  position: relative;
  overflow: hidden;
  animation: fadeIn 0.2s ease;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 20px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0%;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.progress-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-0);
  mix-blend-mode: difference;
}

#upload-status {
  margin-top: 0.5rem;
  font-size: 0.84rem;
  font-weight: 500;
}

#upload-status.success { color: var(--success); }
#upload-status.error { color: var(--danger); }

/* ========== Section Header & View Toggle ========== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-header h2 {
  margin-bottom: 0;
}

.view-toggle {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-3);
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  border-radius: 0;
}

.toggle-btn:hover {
  color: var(--text-1);
  background: transparent;
  transform: none;
}

.toggle-btn.active {
  background: var(--bg-0);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ========== Filter Bar ========== */
.filter-bar {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.filter-group label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-group select,
.filter-group input[type="date"] {
  padding: 0.4rem 0.6rem;
  font-size: 0.78rem;
  min-width: 100px;
}

.filter-apply-btn {
  align-self: flex-end;
}

/* ========== Video Grid ========== */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.video-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.25s ease;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
  display: block;
  color: inherit;
}

.video-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.video-card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  overflow: hidden;
}

.video-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.video-card:hover .video-card-thumb img {
  transform: scale(1.04);
}


.video-card-badges {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  display: flex;
  gap: 0.25rem;
}

.video-card-info {
  padding: 0.75rem;
}

.video-card-title {
  font-weight: 500;
  font-size: 0.88rem;
  margin-bottom: 0.3rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.76rem;
  color: var(--text-2);
}

.video-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-2);
}

.video-card-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-3);
  padding: 0.2rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-icon:hover {
  color: var(--danger);
  background: var(--danger-subtle);
  transform: none;
}

.btn-icon.copy-link:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

a.video-card-title {
  display: block;
  color: inherit;
  text-decoration: none;
}

a.video-card-title:hover {
  text-decoration: none;
  color: var(--accent-light);
}

a.video-card-thumb {
  display: block;
  text-decoration: none;
}

/* Upload progress card */
.video-card.uploading .video-card-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-card.uploading .video-card-thumb img {
  display: none;
}

.upload-progress-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.upload-progress-bar {
  width: 70%;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0%;
  position: relative;
}

.upload-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.upload-progress-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
}

/* Error card overlay */
.upload-progress-overlay.error {
  background: var(--bg-2);
}

/* Error card in grid */
.video-card.error-card {
  opacity: 0.7;
}

.video-card.error-card .video-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Placeholder thumbnail for processing/error */
.thumb-placeholder {
  width: 88px;
  height: 50px;
  border-radius: 5px;
  background: var(--bg-3);
  background-image: linear-gradient(90deg, var(--bg-3), var(--bg-2), var(--bg-3));
  background-size: 200% 100%;
}

.thumb-placeholder:not(.error) {
  animation: shimmer 1.8s infinite;
}

/* ========== Video Table ========== */
.video-list-section {
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.video-table-wrapper {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.video-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.video-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: var(--bg-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.video-table td {
  padding: 0.6rem 0.85rem;
  border-top: 1px solid var(--border-light);
  vertical-align: middle;
}

.video-table tbody tr {
  transition: background var(--transition);
}

.video-table tbody tr:hover td {
  background: var(--bg-hover);
}

.clickable-row {
  cursor: pointer;
}

.thumb {
  width: 88px;
  height: 50px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--bg-2);
  transition: transform var(--transition);
}

.thumb:hover {
  transform: scale(1.06);
}

.thumb-wrapper {
  position: relative;
  display: inline-block;
}

.thumb-overlay {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.4;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.thumb-overlay-sm {
  font-size: 0.58rem;
  padding: 1px 4px;
  bottom: 3px;
  right: 3px;
}

.title-cell {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-active { background: var(--success-subtle); color: var(--success); }
.badge-archived { background: var(--warning-subtle); color: var(--warning); }
.badge-expired { background: var(--danger-subtle); color: var(--danger); }
.badge-locked { background: var(--accent-subtle); color: var(--accent); margin-left: 0.25rem; }
.badge-processing { background: var(--accent-subtle); color: var(--accent); }


.empty-state {
  color: var(--text-3);
  text-align: center;
  padding: 3.5rem 2rem;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}

/* ========== Detail Page ========== */
.detail-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-2);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}

.detail-back:hover {
  color: var(--text-0);
  text-decoration: none;
}

.detail-header-actions {
  display: flex;
  gap: 0.4rem;
}

.detail-player-full {
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.detail-player-full video {
  width: 100%;
  display: block;
  max-height: 65vh;
}

/* Image display on detail page */
.detail-image-full {
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.detail-image-full a {
  display: block;
  line-height: 0;
}

.detail-image-full img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.detail-processing-state {
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-1);
  border: 1px solid var(--border);
  aspect-ratio: 16 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.detail-processing-inner {
  text-align: center;
  max-width: 300px;
}

.detail-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

.detail-video-title {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.detail-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-2);
}

.detail-info-right {
  flex-shrink: 0;
}

.detail-status-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: 22px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
}

/* Small toggle for table rows */
.toggle-switch-sm {
  width: 32px;
  height: 18px;
}

.toggle-switch-sm .toggle-slider {
  border-radius: 18px;
}

.toggle-switch-sm .toggle-slider::before {
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
}

.toggle-switch-sm input:checked + .toggle-slider::before {
  transform: translateX(14px);
}

.toggle-cell,
.actions-cell {
  cursor: pointer;
}

.actions-cell {
  white-space: nowrap;
}

.actions-cell .btn-icon {
  vertical-align: middle;
}

/* Share Link */
.detail-share {
  margin-bottom: 1.5rem;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

.detail-share label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 0.35rem;
}

.detail-share-row {
  display: flex;
  gap: 0.4rem;
}

.detail-share-row input {
  flex: 1;
  background: var(--bg-1);
  color: var(--text-1);
  font-size: 0.84rem;
  cursor: text;
}

/* Two-Column Layout */
.detail-columns {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 1.5rem;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.detail-settings form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.detail-settings label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.3rem;
}

.detail-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: -0.1rem;
}

.detail-password {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: 'DM Sans', monospace;
  font-size: 0.78rem;
  color: var(--text-1);
  user-select: all;
}

.detail-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-bottom: 0.6rem;
}

.view-history-container {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.view-history-container::-webkit-scrollbar { width: 4px; }
.view-history-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.view-history {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.view-history th {
  text-align: left;
  padding: 0.45rem 0.65rem;
  background: var(--bg-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.view-history td {
  padding: 0.4rem 0.65rem;
  border-top: 1px solid var(--border-light);
  color: var(--text-1);
  word-break: break-all;
}

.view-history tbody tr {
  transition: background var(--transition);
}

.view-history tbody tr:hover td {
  background: var(--bg-hover);
}

/* ========== Public Video Page ========== */
.video-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: #000;
}

.video-container video {
  width: 100%;
  max-width: 100%;
  max-height: 86vh;
  border-radius: 8px;
  background: #000;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.public-image {
  max-width: 100%;
  max-height: 86vh;
  border-radius: 8px;
  object-fit: contain;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.video-title {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  font-weight: 400;
  color: #aaa;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

.video-message {
  text-align: center;
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.video-message h1 {
  font-size: 3.5rem;
  font-weight: 200;
  color: #333;
  margin-bottom: 0.4rem;
  letter-spacing: -0.04em;
}

.video-message p {
  color: #666;
  font-size: 0.95rem;
}

/* ========== Delete Confirm Modal ========== */
.confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease both;
}

.confirm-dialog {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.confirm-dialog h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-0);
  text-transform: none;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.confirm-dialog p {
  font-size: 0.84rem;
  color: var(--text-2);
  margin-bottom: 1rem;
  line-height: 1.4;
}

.confirm-dialog .checkbox-label {
  margin-bottom: 1rem;
  font-size: 0.78rem;
  color: var(--text-3);
}

.confirm-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.confirm-actions .btn-cancel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
}

.confirm-actions .btn-cancel:hover {
  background: var(--bg-3);
}

.confirm-actions .btn-confirm-delete {
  background: var(--danger);
  border: 1px solid var(--danger);
  color: #fff;
}

.confirm-actions .btn-confirm-delete:hover {
  opacity: 0.9;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  color: var(--text-0);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

.pagination-btn {
  text-decoration: none;
  color: var(--text-1);
}

.pagination-btn.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.pagination-num {
  min-width: 32px;
  text-align: center;
  text-decoration: none;
  color: var(--text-1);
}

.pagination-num.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  pointer-events: none;
}

.pagination-num:hover:not(.active) {
  background: var(--bg-3);
  text-decoration: none;
}

.pagination-ellipsis {
  color: var(--text-3);
  font-size: 0.84rem;
  padding: 0 0.2rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .admin-container { padding: 1rem; }
  .detail-container { padding: 1rem; }
  .upload-fields { grid-template-columns: 1fr; }
  .expiry-row { flex-direction: column; align-items: stretch; }
  .detail-columns { grid-template-columns: 1fr; }
  .detail-info-bar { flex-direction: column; }
  .detail-meta { flex-wrap: wrap; }
  .video-table { font-size: 0.75rem; }
  .video-table th:nth-child(5), .video-table td:nth-child(5),
  .video-table th:nth-child(6), .video-table td:nth-child(6) { display: none; }
  .thumb { width: 72px; height: 40px; }
  .thumb-placeholder { width: 72px; height: 40px; }
  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-group select, .filter-group input[type="date"] { width: 100%; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
}
