/* =========================
   Base
========================= */
* { box-sizing: border-box; }

body {
  font-family: "Century Gothic", sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #0d0d0d, #1a1a1a);
  color: #fff;
  overflow-x: hidden;
}

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

/* When modal opens */
body.modal-open .page,
body.modal-open .topbar {
  filter: blur(6px);
  transition: filter 0.25s ease;
}

/* =========================
   Spinner
========================= */
.spinner {
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top: 5px solid #fff;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =========================
   Splash
========================= */
.splash-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #0d0d0d, #1a1a1a);
  z-index: 999;
}

.splash-logo {
  width: 250px;
  max-width: 60%;
  margin-bottom: 18px;
  transform: scale(0.92);
}

.splash-message {
  font-size: 1.1em;
  font-weight: 500;
  margin-bottom: 18px;
  opacity: 0.95;
  text-shadow: 0 2px 6px rgba(0,0,0,0.7);
}

/* =========================
   Loading overlay
========================= */
.loading-screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;
}

/* =========================
   Login
========================= */
.login-container {
  width: min(460px, 92vw);
  margin: 10vh auto 0;
  padding: 34px 28px;
  background: rgba(20,20,20,0.95);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.7);
  text-align: center;
  opacity: 0; /* fades in via JS */
}

.login-container .logo {
  width: 160px;
  max-width: 60%;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.7));
}

.login-container h2 {
  margin: 10px 0 18px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.7);
  font-size: 1.15rem;
}

/* Inputs + buttons */
.login-container input[type="text"],
.login-container input[type="password"],
.login-container button {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  outline: none;
}

.login-container input[type="text"],
.login-container input[type="password"] {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.55);
  color: #fff;
}

.login-container button {
  background: #ff3c3c;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, filter 0.18s ease;
}

.login-container button:hover {
  background: #ff1a1a;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255,255,255,0.12) !important;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.18) !important;
}

.error-message {
  margin-top: 8px;
  color: #ff6666;
  font-weight: bold;
}

.info-message {
  margin-top: 8px;
  color: #cfd7ff;
  font-weight: 600;
}

/* ✅ Password + eye icon inline */
.input-with-icon {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}
.input-with-icon input {
  width: 100%;
  margin-bottom: 0;
  padding-right: 50px; /* room for the button */
}

/* button takes full height to center perfectly */
.input-with-icon .icon-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 8px;
  width: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  background: transparent;
  color: rgba(255,255,255,0.78);
  cursor: pointer;
  padding: 0;
  border-radius: 10px;
}

.input-with-icon .icon-btn:hover,
.input-with-icon .icon-btn:active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.input-with-icon .icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* =========================
   Topbar (videos page)
========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.brand .title {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand .title b { font-size: 0.95rem; }
.brand .title span { font-size: 0.78rem; opacity: 0.8; }

.search-container {
  flex: 1;
  display: flex;
  justify-content: center;
}

#search-input {
  width: 100%;
  max-width: 520px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.45);
  color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45);
}
#search-input:focus {
  outline: none;
  box-shadow: 0 0 20px rgba(255,60,60,0.55);
  border-color: rgba(255,60,60,0.6);
}

.right-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 0.9rem;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  color: #fff;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.12);
  transition: transform 0.18s ease, background 0.18s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.18); }
.btn.danger { background: #ff3c3c; border-color: transparent; }
.btn.danger:hover { background: #ff1a1a; }

/* Page wrapper */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

/* =========================
   Watch history
========================= */
#historySection {
  display: none;
  margin: 10px 0 18px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  opacity: 0.95;
}

.history-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.history-item {
  cursor: pointer;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
}
.history-item:hover { transform: translateY(-2px); }

.history-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.history-meta {
  padding: 10px 10px 12px;
}

.history-meta .t {
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 4px;
}
.history-meta .d {
  opacity: 0.75;
  font-size: 0.78rem;
}

/* =========================
   Video grid
========================= */
#video-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.video-container {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.30);
  box-shadow: 0 18px 45px rgba(0,0,0,0.55);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.video-container:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 28px rgba(255,255,255,0.18);
}

/* ✅ thumbnails NOT zoomed out */
.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: center;
  display: block;
}

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.15));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.video-container:hover .overlay { opacity: 1; }

.overlay .title {
  font-weight: 800;
  font-size: 1rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
.overlay .date {
  margin-top: 4px;
  font-size: 0.82rem;
  opacity: 0.9;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* NEW badge */
.new-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, #ff512f, #dd2476);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 6px 9px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.55);
  z-index: 5;
}

/* =========================
   Modal
========================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.92);
  padding: 60px 10px;
  backdrop-filter: blur(10px);
}

#modal iframe {
  width: 92%;
  max-width: 980px;
  aspect-ratio: 16/9;
  margin: 0 auto;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.75);
  display: block;
  border: 0;
}

#close {
  position: absolute;
  top: 16px;
  right: 18px;
  color: #fff;
  font-size: 40px;
  font-weight: 900;
  cursor: pointer;
  transition: color 0.2s ease;
}
#close:hover { color: #ff5555; }

/* =========================
   MOBILE polish
========================= */
@media (max-width: 820px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    min-width: unset;
    flex: 1;
  }

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

  #search-input {
    max-width: 100%;
  }

  .right-actions {
    justify-content: flex-end;
    width: 100%;
    order: 2;
  }

  #video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .history-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .page {
    padding: 14px 12px 34px;
  }
}

@media (max-width: 480px) {
  .login-container {
    margin-top: 8vh;
    padding: 28px 18px;
  }

  .login-container .logo {
    width: 140px;
  }

  .login-container h2 {
    font-size: 1.05rem;
  }

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

  .history-row {
    grid-template-columns: 1fr;
  }

  .pill {
    font-size: 0.85rem;
    padding: 7px 10px;
  }

  .btn {
    padding: 9px 10px;
    border-radius: 12px;
  }
}
/* =========================
   RADIO
========================= */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 180px);
  justify-content: center;
  gap: 18px;

  margin-top: 40px;
  width: 100%;
}

/* responsive */
@media (max-width: 700px) {
  .grid {
    grid-template-columns: repeat(2, 160px);
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: repeat(1, 80%);
  }
}

.radio-player {
  margin-top: 30px;
  padding: 18px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  text-align: center;
}

.radio-player audio {
  width: 100%;
  margin-top: 10px;
}

.visualiser {
  width: 100%;
  height: 80px;
  margin: 10px 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

#visualiser {
  width: 100%;
  height: 80px;
  background: transparent;
}

/* PROGRESS */
.progress {
  width: 90%;
  max-width: 500px;
  height: 4px;
  background: #222;
  border-radius: 10px;
  margin-top: 10px;
  overflow: hidden;
}

.bar {
  height: 100%;
  width: 0%;
  background: #00e5ff;
}

.play-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #00e5ff;
  color: #000;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0,229,255,0.4);
  transition: 0.2s;
}

.play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(0,229,255,0.7);
}

.container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

/* GRID NOW IS A BLOCK INSIDE CENTER */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 180px);
  gap: 18px;
}

/* responsive */
@media (max-width: 700px) {
  .grid {
    grid-template-columns: repeat(2, 160px);
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: repeat(1, 180px);
  }
}
