@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-yt: #ff0000;
  --accent-yt-hover: #dc2626;
  --accent-blue: #2563eb;
  --accent-green: #059669;
  --accent-purple: #7c3aed;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-main: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: var(--transition);
}

.admin-logo-area {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.admin-logo-icon {
  background: var(--accent-yt);
  color: white;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

.admin-logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.admin-logo-text span {
  color: var(--accent-yt);
}

.admin-nav {
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
}

.admin-nav-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  transform: translateX(4px);
}

.admin-nav-item.active {
  background: var(--accent-yt);
  color: #fff;
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.25);
}

.admin-nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.admin-sidebar-footer {
  padding: 18px 14px;
  border-top: 1px solid var(--border-color);
}

.btn-visit-site {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-visit-site:hover {
  background: #e2e8f0;
}

/* Main Content Area */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  height: 70px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-page-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-content {
  padding: 32px;
  flex: 1;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.stat-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper svg {
  width: 26px;
  height: 26px;
}

.stat-icon-red { background: #fee2e2; color: #ef4444; }
.stat-icon-blue { background: #dbeafe; color: #3b82f6; }
.stat-icon-green { background: #d1fae5; color: #10b981; }
.stat-icon-purple { background: #ede9fe; color: #8b5cf6; }

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Search Box Container */
.search-banner {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.search-banner h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: var(--text-main);
}

.search-banner p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.search-input-group {
  display: flex;
  gap: 12px;
  max-width: 800px;
}

.search-input {
  flex: 1;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 0.98rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--accent-yt);
  box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.15);
}

.btn-search {
  background: var(--accent-yt);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0 26px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-search:hover {
  background: var(--accent-yt-hover);
}

/* Video Search Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px;
}

.yt-result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.yt-result-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-4px);
  box-shadow: var(--shadow-main);
}

.yt-thumb-wrapper {
  position: relative;
  aspect-ratio: 16/9;
  background: #f1f5f9;
  overflow: hidden;
}

.yt-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.yt-result-card:hover .yt-thumb-wrapper img {
  transform: scale(1.04);
}

.yt-duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.yt-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.yt-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-main);
}

.yt-card-channel {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.yt-card-channel img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.yt-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.yt-card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.btn-import {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-yt);
  background: var(--accent-yt);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-import:hover {
  background: var(--accent-yt-hover);
}

.btn-import.imported {
  background: var(--accent-green);
  border-color: var(--accent-green);
  cursor: default;
}

.btn-preview {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
}

.btn-preview:hover {
  background: #f1f5f9;
}

/* Table Area */
.admin-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.admin-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  padding: 14px 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  vertical-align: middle;
  color: var(--text-main);
}

.admin-table tr:hover td {
  background: #f8fafc;
}

.table-video-cell {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 360px;
}

.table-thumb {
  width: 96px;
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #f1f5f9;
  flex-shrink: 0;
}

.table-video-title {
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.btn-action-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #f8fafc;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-action-icon:hover {
  color: var(--text-main);
  border-color: #cbd5e1;
  background: #f1f5f9;
}

.btn-action-icon.btn-delete:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #ef4444;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s forwards;
}

.toast.toast-success { border-left-color: var(--accent-green); }
.toast.toast-error { border-left-color: #ef4444; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-content {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 24px;
}

.btn-close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.5rem;
}
