:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(19, 26, 42, 0.75);
  --bg-card-hover: rgba(27, 36, 58, 0.85);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-glow: rgba(0, 242, 254, 0.3);
  
  --primary-glow: #00f2fe;
  --primary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --secondary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --accent-yt: #ff2a5f;
  --accent-yt-gradient: linear-gradient(135deg, #ff0844 0%, #ffb199 100%);
  --admin-gradient: linear-gradient(135deg, #f59e0b 0%, #ec4899 100%);
  --success: #10b981;
  --warning: #f59e0b;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-heading: 'Outfit', sans-serif;

  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(0, 242, 254, 0.25);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Background Ambient Glowing Blobs */
.glow-bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: #4facfe;
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 600px;
  height: 600px;
  background: #764ba2;
  bottom: -150px;
  right: -150px;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 52px;
  height: 52px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #000;
  box-shadow: var(--shadow-glow);
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

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

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

.brand-text code {
  color: var(--primary-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* User Pill & Rank Badges */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.user-pill.badge-admin {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.user-pill.badge-user {
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: var(--primary-glow);
}

.user-pill.badge-guest {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #000;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-main);
  margin-bottom: 2rem;
}

.downloader-card .card-header {
  margin-bottom: 1.5rem;
}

.downloader-card .card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.downloader-card .card-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.icon-yt {
  color: #ff0033;
}

/* Guest Banner */
.guest-banner {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.guest-banner-icon {
  width: 44px;
  height: 44px;
  background: rgba(245, 158, 11, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.guest-banner-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.guest-banner-text strong {
  color: #fbbf24;
}

.guest-banner-text a {
  color: var(--primary-glow);
  text-decoration: underline;
  cursor: pointer;
}

/* Download Form */
.download-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.input-group {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.4rem;
  transition: all 0.25s ease;
}

.input-group:focus-within {
  border-color: var(--primary-glow);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.2);
}

.input-icon {
  display: flex;
  align-items: center;
  padding: 0 1rem;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-family: var(--font-main);
  font-size: 1rem;
  outline: none;
  padding: 0.6rem 0.5rem;
}

.input-group input::placeholder {
  color: var(--text-dim);
}

.form-row-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
}

.folder-select-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.form-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.9rem;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.form-select option {
  background: #111827;
  color: #fff;
}

.quality-selector-group {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.quality-options {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quality-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.quality-chip input {
  display: none;
}

.quality-chip.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.15);
}

/* Progress Visualizer */
.progress-box {
  margin-top: 1.5rem;
  padding: 1.4rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.progress-title-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.step-badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  background: rgba(0, 242, 254, 0.15);
  color: var(--primary-glow);
  border-radius: var(--radius-sm);
}

.percent-text {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-glow);
}

.progress-bar-container {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary-gradient);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
  transition: width 0.3s ease;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.step-item {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.step-item.active {
  color: var(--primary-glow);
  font-weight: 600;
}

.step-item.done {
  color: var(--success);
}

/* Explorer Section & Toolbar */
.dashboard-section {
  margin-top: 0.5rem;
}

.explorer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumbs-container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.breadcrumb-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.breadcrumb-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.breadcrumb-chip.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--primary-glow);
  color: var(--primary-glow);
  font-weight: 600;
}

.breadcrumb-separator {
  color: var(--text-dim);
  font-size: 0.75rem;
}

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

.count-badge {
  padding: 0.4rem 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Media & Folders Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Folder Card */
.folder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.folder-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-glow);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 24px rgba(0, 242, 254, 0.15);
}

.folder-icon-box {
  width: 52px;
  height: 52px;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary-glow);
  flex-shrink: 0;
}

.folder-details {
  flex: 1;
  overflow: hidden;
}

.folder-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.folder-card-actions {
  display: flex;
  gap: 0.3rem;
}

/* Media Card */
.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.media-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-glow);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}

.media-thumb-box {
  position: relative;
  width: 100%;
  height: 180px;
  background: #000;
  overflow: hidden;
}

.media-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

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

.play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  cursor: pointer;
}

.media-thumb-box:hover .play-overlay {
  opacity: 1;
}

.play-btn-circle {
  width: 54px;
  height: 54px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-size: 1.4rem;
  box-shadow: var(--shadow-glow);
}

.media-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 0.25rem 0.6rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-volume {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.media-body {
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.media-title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-meta-row {
  display: flex;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.owner-badge {
  color: var(--primary-glow);
}

.url-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
}

.url-text {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--primary-glow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.copy-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.3rem;
  transition: color 0.2s ease;
}

.copy-icon-btn:hover {
  color: #fff;
}

.media-card-footer {
  display: flex;
  gap: 0.4rem;
  padding: 0.8rem 1.2rem;
  border-top: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.15);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  grid-column: 1 / -1;
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: var(--text-dim);
  margin: 0 auto 1.2rem;
}

.empty-state h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-card {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-main);
  animation: fadeIn 0.25s ease-out;
  overflow: hidden;
}

.modal-lg {
  max-width: 780px;
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

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

.modal-close:hover {
  color: #fff;
}

.settings-form {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group textarea {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: #fff;
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
}

.form-group textarea {
  font-family: monospace;
  font-size: 0.8rem;
  resize: vertical;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary-glow);
}

.form-group small {
  font-size: 0.75rem;
  color: var(--text-dim);
}



.modal-footer {
  padding: 1.2rem 1.8rem;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* User Management Modal Components */
.users-modal-body {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  max-height: 70vh;
  overflow-y: auto;
}

.add-user-card {
  padding: 1.2rem;
  border-radius: var(--radius-md);
  margin-bottom: 0;
}

.add-user-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 0.8rem;
  margin-bottom: 1rem;
}

@media (max-width: 600px) {
  .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.users-table-container h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-table th, .users-table td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.users-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.2);
}

.role-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.role-tag.admin {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.role-tag.user {
  background: rgba(0, 242, 254, 0.2);
  color: var(--primary-glow);
}

.role-tag.guest {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* Player Modal */
.player-container {
  padding: 1rem;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 350px;
}

.player-container video, .player-container audio {
  width: 100%;
  max-height: 480px;
  border-radius: var(--radius-md);
}

.hidden {
  display: none !important;
}

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

/* Footer */
.app-footer {
  margin-top: auto;
  padding-top: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}
