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

:root {
  --bg-primary: #0f0f13;
  --bg-surface: #18181f;
  --bg-card: #20202b;
  --bg-hover: #2a2a38;
  --primary-accent: #ff0055;
  --primary-gradient: linear-gradient(135deg, #ff0055, #ff5500);
  --text-main: #f1f1f5;
  --text-muted: #9e9ea7;
  --border-color: #2e2e3d;
  --badge-public: #00e676;
  --badge-unlisted: #ffab00;
  --badge-private: #ff5252;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden !important;
  position: relative;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Hamburger Button */
.hamburger-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

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

/* Sidebar Backdrop Overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Sidebar Drawer */
.mobile-sidebar-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 80vw;
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  z-index: 999;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.mobile-sidebar-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.close-drawer-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition);
}

.close-drawer-btn:hover {
  color: var(--primary-accent);
}

.drawer-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.drawer-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  margin-bottom: 0.3rem;
}

.drawer-link:hover {
  background: var(--bg-card);
  color: var(--primary-accent);
}

.drawer-link i {
  width: 20px;
  text-align: center;
  color: var(--primary-accent);
}

/* Header Navbar */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(24, 24, 31, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.brand-logo i {
  color: var(--primary-accent);
  font-size: 1.6rem;
}

.brand-logo span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-bar {
  flex: 1;
  max-width: 500px;
  display: flex;
  align-items: center;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-bar input:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.25);
}

.search-bar i {
  position: absolute;
  left: 0.9rem;
  color: var(--text-muted);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

.category-tabs .btn {
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  min-height: 40px;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 0, 85, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 0, 85, 0.45);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #bd2130;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  min-height: 34px;
}

/* Main Container */
.main-layout {
  padding: 2rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  width: 100%;
}

/* Category Page Responsive Layout */
.category-page-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
  width: 100%;
}

/* Video Grid */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  width: 100%;
}

.video-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 0, 85, 0.4);
}

.thumb-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
  background: #000;
  overflow: hidden;
}

.thumb-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.play-icon-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 50px;
  height: 50px;
  background: rgba(255, 0, 85, 0.85);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.2rem;
  opacity: 0;
  transition: var(--transition);
}

.video-card:hover .play-icon-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.badge-visibility {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-public { background: var(--badge-public); color: #000; }
.badge-unlisted { background: var(--badge-unlisted); color: #000; }
.badge-private { background: var(--badge-private); color: #fff; }

.video-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

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

.video-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
}

/* Watch Container */
.watch-container {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  width: 100%;
}

.player-wrapper {
  width: 100%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
}

.player-wrapper video {
  width: 100%;
  max-height: 70vh;
  display: block;
  outline: none;
}

.watch-details {
  margin-top: 1.2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.watch-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  word-break: break-word;
}

.watch-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.watch-meta-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.share-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  max-width: 100%;
}

.share-url-input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.85rem;
  width: 220px;
  outline: none;
  font-family: monospace;
}

.watch-description {
  margin-top: 1.2rem;
  font-size: 0.95rem;
  color: #ccc;
  white-space: pre-line;
  word-break: break-word;
}

/* Dashboard Tables & Stats */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
  width: 100%;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 0, 85, 0.15);
  color: var(--primary-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 700;
}

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

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: transparent;
}

table.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

table.custom-table th,
table.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

table.custom-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-weight: 600;
}

/* Responsive Table to Cards Transformation for Mobile (<= 768px) */
@media (max-width: 768px) {
  table.custom-table,
  table.custom-table tbody,
  table.custom-table tr,
  table.custom-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  table.custom-table thead {
    display: none !important;
  }

  table.custom-table tr {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }

  table.custom-table td {
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    word-break: break-word;
  }

  table.custom-table td:last-child {
    border-bottom: none;
  }

  .category-page-layout {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

/* Form Controls */
.form-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  max-width: 650px;
  margin: 0 auto;
  width: 100%;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  min-height: 44px;
}

.form-control:focus {
  border-color: var(--primary-accent);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.alert-danger {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid var(--badge-private);
  color: #ff5252;
}

.alert-success {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid var(--badge-public);
  color: #00e676;
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Media Queries (Responsive Design)
   ========================================================================== */

/* Tablets & Small Desktops (<= 1024px) */
@media (max-width: 1024px) {
  .watch-container {
    grid-template-columns: 1fr;
  }
}

/* Tablets / Mobile Landscape (<= 768px) */
@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }

  .desktop-only-actions {
    display: none !important;
  }

  .brand-logo {
    font-size: 1.2rem;
  }

  .search-bar {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .main-layout {
    padding: 1.25rem 1rem;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .form-card {
    padding: 1.5rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }

  .category-tabs {
    flex-wrap: wrap;
  }
}

/* Smartphones / Mobile Portrait (<= 576px) */
@media (max-width: 576px) {
  .header {
    padding: 0.65rem 0.85rem;
  }

  .admin-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .admin-section-header .btn {
    width: 100%;
  }

  .brand-logo span {
    font-size: 1.1rem;
  }

  .btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  .category-tabs {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .category-tabs .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .watch-details {
    padding: 1rem;
  }

  .watch-title {
    font-size: 1.15rem;
  }

  .watch-stats-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .share-box {
    width: 100%;
    justify-content: space-between;
  }

  .share-url-input {
    width: 100%;
    font-size: 0.75rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-sm);
  }
}
