/* ==========================================================================
   StreamoTV Mobile-First Responsive Stylesheet
   ========================================================================== */

:root {
  --bg-color: #0b0c10;
  --panel-bg: #1f2833;
  --accent-color: #4effbb;
  --accent-hover: #36c397;
  --text-main: #ffffff;
  --text-muted: #c5c6c7;
  --card-bg: #12161c;
  --border-color: #2c3540;
  --osd-bg: rgba(0, 0, 0, 0.85);
  --tv-bezel-bg: #15181c;
  --touch-target-min: 44px;
  --font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) transparent; 
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(
    circle at center,
    #1a222d 0%,
    var(--bg-color) 100%
  );
  color: var(--text-main);
  font-family: var(--font-family);
  touch-action: manipulation;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
}
.app-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 10px 16px; 
    gap: 15px;
    width: 100%;
    height: 54px;
}

/* TV Frame & Screen */
.tv-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1000px;
  height: 100%;
  margin: 0 auto;
  padding: 8px;
  gap: 8px;
  overflow: hidden;
}

.tv-screen-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background-color: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.7),
    inset 0 0 10px rgba(0, 0, 0, 0.8);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
}
 
.tv-screen {
  position: relative;
  width: 100%;
  height: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  overflow: hidden;
}

/* YouTube Iframe */
#player {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: auto;
}

/* Static Noise Transition Overlay */
.static-noise {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
  background: #111;
}

.static-noise canvas {
  width: 100%;
  height: 100%;
}

.static-noise.active {
  opacity: 0.95;
}

/* Power / Autoplay Overlay */
.start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 12, 16, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.start-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.power-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1f2833, #0f141a);
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(78, 255, 187, 0.3);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.power-btn:active {
  transform: scale(0.92);
  box-shadow: 0 0 30px rgba(78, 255, 187, 0.6);
}

.power-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

/* On-Screen Display Badge */
.osd-banner {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 8;
  background: var(--osd-bg);
  border-left: 4px solid var(--accent-color);
  padding: 10px 16px;
  border-radius: 0 8px 8px 0;
  color: #fff;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  max-width: 80%;
  pointer-events: none;
  animation: osdSlide 0.3s ease-out;
}

@keyframes osdSlide {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.osd-banner h2 {
  font-size: 18px;
  color: var(--accent-color);
  font-weight: 800;
  letter-spacing: 1px;
}

.osd-banner b {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

/* Remote Control Bar */
.remote-controls {
  display: flex;
  flex-direction: column;
  background: var(--tv-bezel-bg);
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 8px 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  gap: 12px;
  transition: all 0.3s ease;
}

.primary-controls {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 8px;
}

.secondary-controls {
  display: none;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  animation: fadeIn 0.2s ease-out;
}

.secondary-controls.active {
  display: flex;
}

.more-options-btn.active {
  background: var(--panel-bg);
  color: var(--text-main);
  border-color: var(--accent-color);
}

.remote-btn-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.btn-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.remote-control-btn {
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  color: var(--accent-color);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  cursor: pointer;
  outline: none;
  transition:
    background 0.15s ease,
    transform 0.1s ease;
}

.remote-control-btn:active {
  background: var(--panel-bg);
  transform: scale(0.92);
  color: var(--text-main);
}

.channels-list-btn {
  border-color: var(--accent-color);
}

.remote-group {
  display: flex;
  align-items: center;
  background: #000000;
  border-radius: 24px;
  padding: 2px 2px;
  border: 1px solid var(--border-color);
  gap: 4px;
}

.remote-display {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  padding: 0 8px;
  text-align: center;
  min-width: 55px;
  letter-spacing: 0.5px;
}

/* Toast Component */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--osd-bg);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
  display: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Modal Overlay & Channels Guide */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-card {
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  background: var(--panel-bg);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: #151a21;
}

.modal-header h2 {
  font-size: 17px;
  color: var(--accent-color);
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover,
.modal-close-btn:active {
  color: var(--text-main);
}

.modal-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

/* Channel Items */
.channel-lists {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loading-state {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 14px;
}

.channel-card-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.channel-card-item:active,
.channel-card-item.active {
  background: #1b232e;
  border-color: var(--accent-color);
}

.channel-badge {
  display: inline-block;
  background: #000;
  color: var(--accent-color);
  font-weight: 800;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  min-width: 55px;
  text-align: center;
}

.channel-thumb {
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
}

.channel-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.channel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-now-playing {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Responsive Enhancements for Tablet / Desktop */
@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
  }

  .modal-card {
    border-radius: 16px;
    max-height: 70vh;
  }

  .remote-panel-container {
    max-width: 650px;
    margin: 0 auto;
  }

  .osd-banner h2 {
    font-size: 20px;
  }
  .osd-banner b {
    font-size: 14px;
  }

  .remote-controls {
    flex-direction: row;
    justify-content: center;
  }
  .primary-controls {
    width: auto;
    justify-content: center;
  }
  .secondary-controls {
    display: flex;
    width: auto;
    padding-top: 0;
    border-top: none;
    padding-left: 12px;
    animation: none;
  }
  .more-options-btn {
    display: none;
  }
  .more-options-btn + .btn-label {
    display: none;
  }
}
