:root {
  --primary: #e91e63;
  --bg-dark: #0f0f0f;
  --text: #ffffff;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
}

/* ===== PLAYER WRAPPER ===== */
.player-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}

/* ===== LOADER ===== */
.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
  z-index: 10;
}

@keyframes spin {
  0%   { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes spin-icon {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ===== BIG PLAY BUTTON ===== */
.big-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: rgba(233, 30, 99, 0.9);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 20;
  box-shadow: 0 0 30px rgba(233, 30, 99, 0.45);
}

.big-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--primary);
  box-shadow: 0 0 40px rgba(233, 30, 99, 0.6);
}

.big-play-btn svg {
  width: 34px;
  height: 34px;
  fill: white;
  margin-left: 5px;
}

.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 24px 32px;
  border-radius: 10px;
  text-align: center;
  display: none;
  z-index: 50;
  font-size: 15px;
}

.retry-btn {
  margin-top: 12px;
  padding: 8px 20px;
  background: var(--primary);
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}
.retry-btn:hover { background: #c2185b; }

/* ===== CONTROLS CONTAINER ===== */
.controls-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, transparent 100%);
  padding: 20px 20px 15px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 30;
}

.player-wrapper:hover .controls-container,
.player-wrapper.paused .controls-container {
  opacity: 1;
}

/* ===== PROGRESS BAR ===== */
.progress-area {
  width: 100%;
  height: 5px;
  background: rgba(255,255,255,0.2);
  cursor: pointer;
  border-radius: 5px;
  position: relative;
  margin-bottom: 14px;
  transition: height 0.15s;
}

.progress-area:hover { height: 8px; }

.progress-bar {
  height: 100%;
  background: var(--primary);
  width: 0%;
  border-radius: 5px;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.progress-area:hover .progress-bar::after {
  transform: translateY(-50%) scale(1);
}

/* ===== CONTROLS ROW ===== */
.controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.left-controls,
.right-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ===== BUTTONS ===== */
.btn {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, color 0.2s;
}

.btn:hover {
  transform: scale(1.12);
  color: var(--primary);
}

.btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Refresh button spinning state */
.btn.refreshing {
  color: var(--primary);
  pointer-events: none;
}
.btn.refreshing svg {
  animation: spin-icon 0.7s linear infinite;
}

/* ===== TIME DISPLAY ===== */
.time-display {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 0.02em;
}

/* ===== VOLUME ===== */
.volume-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  width: 0;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  appearance: none;
  -webkit-appearance: none;
  transition: width 0.3s;
  cursor: pointer;
  outline: none;
}

.volume-container:hover .volume-slider {
  width: 80px;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
}

/* ===== SERVER DROPDOWN ===== */
.server-menu {
  position: relative;
}

.server-dropdown {
  position: absolute;
  bottom: 42px;
  right: 0;
  background: rgba(15, 15, 15, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 10px;
  width: 240px;
  max-height: 360px;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}

.server-dropdown.active {
  display: flex;
  animation: dropUp 0.22s ease;
}

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

/* Search inside dropdown */
.dropdown-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.dropdown-search svg {
  width: 16px;
  height: 16px;
  fill: rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.dropdown-search input {
  background: none;
  border: none;
  color: #fff;
  font-size: 13px;
  outline: none;
  width: 100%;
  font-family: inherit;
}
.dropdown-search input::placeholder { color: rgba(255,255,255,0.3); }

#channelsContainer {
  overflow-y: auto;
  flex: 1;
}

#channelsContainer::-webkit-scrollbar { width: 4px; }
#channelsContainer::-webkit-scrollbar-track { background: transparent; }
#channelsContainer::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

.server-item {
  padding: 11px 15px;
  cursor: pointer;
  transition: background 0.18s;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 8px;
}

.server-item:last-child { border-bottom: none; }
.server-item:hover { background: rgba(255,255,255,0.09); }

.server-item.active {
  color: var(--primary);
  font-weight: 600;
  background: rgba(233, 30, 99, 0.1);
}

.server-item.active::before {
  content: '▶';
  font-size: 10px;
  flex-shrink: 0;
}

.server-item.loading-item {
  color: rgba(255,255,255,0.4);
  cursor: default;
  justify-content: center;
  font-size: 12px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .controls-container { padding: 15px 14px 12px; }
  .volume-slider { display: none; }
  .time-display { font-size: 11px; }
  .server-dropdown { width: 200px; }
}

/* ===== TOAST NOTIFICATION ===== */
#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 999;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
  opacity: 0;
  white-space: nowrap;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
