:root {
  --bg-primary: #2d2a2e;
  --bg-secondary: #221f22;
  --bg-glass: rgba(34, 31, 34, 0.8);
  --accent-primary: #ab9df2;
  --accent-secondary: #9580ff;
  --accent-gradient: linear-gradient(135deg, #ab9df2 0%, #9580ff 100%);
  --text-primary: #fcfcfa;
  --text-secondary: #939293;
  --text-muted: #727072;
  --success: #a9dc76;
  --error: #ff6188;
  --border-color: rgba(147, 146, 147, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(171, 157, 242, 0.3);
}

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

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

/* Header Bar */
.header-bar {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-bar h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-login-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.admin-login-btn:hover {
  background: var(--accent-gradient);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.admin-login-btn.logged-in {
  background: var(--accent-gradient);
  border-color: var(--accent-primary);
}

.admin-login-btn.logged-in:hover::after {
  content: ' ?';
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
  color: var(--text-primary);
}

/* Main Container */
.main-container {
  display: flex;
  height: calc(100vh - 60px);
  gap: 1rem;
  padding: 1rem;
}

/* Player Area (Left Side) */
.player-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  /* 16:9 aspect ratio */
  background: #000;
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.video-info {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
}

.video-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.video-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

.sync-status {
  color: var(--success);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-left: auto;
}

/* Admin Controls */
.admin-controls {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
}

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

.admin-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.btn-logout {
  padding: 0.375rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  color: var(--error);
  border-color: var(--error);
}

.admin-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.admin-btn {
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.admin-btn:hover {
  background: var(--accent-gradient);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

/* Inline Admin Controls (within video-info) */
.admin-controls-inline {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.admin-controls-inline .admin-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.admin-controls-inline .admin-btn {
  padding: 0.625rem;
  font-size: 0.8125rem;
}

/* Sync Control */
.sync-control {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.control-label {
  font-weight: 500;
  font-size: 0.875rem;
}

/* Inline Sync Control (within video-info) */
.sync-control-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.sync-control-inline .control-label {
  font-size: 0.8125rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  transition: 0.3s;
  border-radius: 26px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: 0.3s;
  border-radius: 50%;
}

input:checked+.slider {
  background: var(--accent-gradient);
  border-color: var(--accent-primary);
}

input:checked+.slider:before {
  transform: translateX(22px);
  background-color: white;
}

/* Queue Area (Right Side) */
.queue-area {
  width: 350px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1rem;
}

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

.queue-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.queue-count {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

/* Submission Section */
.submission-section {
  transition: opacity 0.3s ease;
}

.lock-notice {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
  font-size: 0.8125rem;
  text-align: center;
}

.form-group {
  display: flex;
  gap: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="password"] {
  flex: 1;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.btn-submit {
  padding: 0.75rem 1.25rem;
  background: var(--accent-gradient);
  border: none;
  border-radius: 0.5rem;
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-sub.admin-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.admin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-submit.locked {
  background: var(--error);
  opacity: 1;
}

.feedback {
  padding: 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.feedback.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}

.feedback.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--error);
}

/* Queue List */
.queue-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.queue-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem 1rem;
  font-size: 0.875rem;
}

/* Queue Section Header */
.queue-section-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  padding: 0.75rem 0.5rem 0.5rem;
  margin-top: 0.5rem;
}

.queue-section-header:first-child {
  margin-top: 0;
}

/* Queue Separator */
.queue-separator {
  height: 1px;
  background: var(--border-color);
  margin: 1rem 0;
}

/* Queue Item */
.queue-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  transition: all 0.3s ease;
}

.queue-item:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

.queue-item-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.queue-item-info {
  flex: 1;
  min-width: 0;
}

.queue-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.25rem;
}

.queue-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Queue Item Delete Button */
.queue-item-delete {
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(255, 97, 136, 0.2);
  color: var(--error);
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.queue-item-delete:hover {
  background: var(--error);
  color: var(--text-primary);
  transform: scale(1.1);
}

/* Admin Control Mode */
.admin-control-mode {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toggle-switch.small {
  width: 44px;
  height: 24px;
}

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

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

.control-label {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
}

.admin-btn.full-width {
  width: 100%;
}

/* Playlist Items */
.playlist-item {
  opacity: 0.8;
}

.playlist-item:hover {
  opacity: 1;
}

/* Queue Item More */
.queue-item-more {
  text-align: center;
  padding: 0.75rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-style: italic;
}

/* Scrollbar Styling */
.queue-list::-webkit-scrollbar {
  width: 8px;
}

.queue-list::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}

.queue-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.queue-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-container {
    flex-direction: column;
    height: auto;
  }

  .queue-area {
    width: 100%;
    max-height: 400px;
  }

  .admin-buttons {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-bar {
    padding: 0.5rem 1rem;
  }

  .header-bar h1 {
    font-size: 1.25rem;
  }

  .main-container {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .modal-content {
    padding: 1.5rem;
  }
}