/* M3U Player — fullscreen app shell (hub theme) */

body.tool-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.tool-nav-app .tool-nav-inner {
  max-width: none;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tool-nav-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  margin-right: 0.5rem;
  min-width: 0;
}

.tool-nav-player-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hub-text);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ah-app {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#ah-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Sidebar */
#ah-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--hub-border);
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

#ah-channel-list {
  flex: 1;
  overflow-y: auto;
}

.ah-ch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

.ah-ch:hover {
  background: rgba(99, 102, 241, 0.08);
}

.ah-ch.active {
  background: rgba(99, 102, 241, 0.18);
  border-left-color: var(--hub-primary);
}

.ah-ch-fav {
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: #64748b;
  padding: 2px 4px;
  line-height: 1;
  cursor: pointer;
  font-size: 0.85rem;
}

.ah-ch-fav:hover,
.ah-ch-fav.is-fav {
  color: #fbbf24;
}

.ah-ch-fav.is-fav i {
  font-weight: 900;
}

#ah-btn-fav.is-fav {
  color: #fbbf24 !important;
}

.ah-ch-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.8);
}

.ah-ch-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ah-ch-group {
  font-size: 0.68rem;
  color: var(--hub-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player area */
#ah-player-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000;
  min-width: 0;
}

#ah-video-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

#ah-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#ah-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #475569;
  gap: 12px;
  width: 100%;
  height: 100%;
}

#ah-placeholder i {
  color: var(--hub-primary-light);
  opacity: 0.4;
}

/* Now-playing bar */
#ah-nowbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid var(--hub-border);
  min-height: 50px;
}

#ah-now-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 4px;
}

/* Setup screen */
#ah-setup {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem;
  min-height: 0;
}

#ah-setup-inner {
  max-width: 740px;
  margin: 0 auto;
}

.m3u-setup-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.m3u-setup-header .tool-page-icon {
  margin: 0 auto 1rem;
}

.m3u-setup-header .tool-page-title {
  font-size: 1.75rem;
}

.m3u-setup-header .tool-page-desc {
  margin-inline: auto;
}

.ah-pl-btn {
  font-size: 0.78rem;
  padding: 4px 8px;
  white-space: nowrap;
}

.ah-pl-btn:hover {
  background: rgba(99, 102, 241, 0.12);
}

.tool-page .nav-tabs .nav-link {
  color: var(--hub-muted);
  border-color: transparent;
}

.tool-page .nav-tabs .nav-link.active {
  color: var(--hub-primary-light);
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--hub-border);
  border-bottom-color: transparent;
}

.m3u-catalog-item {
  background: rgba(15, 23, 42, 0.35);
  border-color: var(--hub-border) !important;
}

.m3u-setup-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hub-border);
  text-align: center;
}

/* Mobile */
@media (max-width: 767px) {
  body.tool-app {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  #ah-app {
    overflow: visible;
    min-height: calc(100vh - 60px);
  }

  #ah-layout {
    flex-direction: column;
    overflow: visible;
  }

  #ah-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 1px solid var(--hub-border);
  }

  #ah-player-area {
    min-height: 56vw;
  }

  #ah-channel-list {
    max-height: 55vh;
  }

  .tool-nav-player {
    order: 3;
    width: 100%;
    margin: 0;
    justify-content: flex-end;
  }

  .tool-nav-app .tool-nav-link {
    margin-left: auto;
  }
}

@media (max-width: 576px) {
  .tool-nav-brand span {
    display: none;
  }
}
