/* ============================================================
   base.css
   Esqueleto ESTRUTURAL do Player98 - layout, tamanhos, posições.
   NÃO contém cor, borda decorativa, sombra ou gradiente.
   Isso é responsabilidade exclusiva de cada theme-*.css.
   ============================================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

/* ---------- Janela ---------- */
.player-window {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ---------- Barra de título ---------- */
.title-bar {
    height: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px;
}

.title-content {
    display: flex;
    align-items: center;
    gap: 4px;
}

.title-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.title-text {
    font-size: 11px;
}

/* ---------- Barra de menu ---------- */
.menu-bar {
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.menu-item {
    position: relative;
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 190px;
    z-index: 1000;
}

.dropdown-submenu {
    position: absolute;
    top: -2px;
    left: 100%;
    min-width: 130px;
    z-index: 1001;
}

.menu-option {
    padding: 4px 10px 4px 24px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}

.menu-option.disabled {
    cursor: default;
}

.menu-separator {
    height: 1px;
    margin: 3px 2px;
}

.submenu-arrow {
    position: absolute;
    right: 8px;
    font-size: 8px;
}

/* ---------- Corpo principal ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
    min-height: 0;
}

.player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    min-height: 0;
}

/* Painel de playlist */
.playlist-panel {
    display: none;
    flex-direction: column;
    width: 220px;
    flex-shrink: 0;
    min-height: 0;
}

body.show-playlist .playlist-panel {
    display: flex;
}

.playlist-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 4px 6px;
    font-size: 10px;
}

.playlist-items {
    flex: 1;
    overflow-y: auto;
    list-style: none;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    font-size: 11px;
    cursor: pointer;
}

.playlist-item-index {
    flex-shrink: 0;
    min-width: 16px;
}

.playlist-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-item-duration {
    flex-shrink: 0;
    font-size: 10px;
}

.playlist-item-remove {
    flex-shrink: 0;
    padding: 0 3px;
    cursor: pointer;
}

.playlist-item.listened {
    opacity: 0.55;
}

.playlist-item.listened.active {
    opacity: 1;
}

/* Tela principal (área de vídeo/visualização) */
.screen-area {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.screen-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

body.is-video .screen-video {
    display: block;
}

body.is-video .visualizer-canvas {
    display: none;
}

.visualizer-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.screen-artwork {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

body.has-artwork .screen-artwork {
    display: block;
}

body.has-artwork .visualizer-canvas,
body.has-artwork .screen-idle {
    display: none;
}

.screen-idle {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
}

.screen-idle-logo {
    display: block;
}

.screen-idle-text {
    font-size: 13px;
    letter-spacing: 1px;
}

body.has-track .screen-idle {
    display: none;
}

.screen-track-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Barra de progresso com tempos nas pontas */
.seek-row {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-label {
    font-size: 10px;
    flex-shrink: 0;
    min-width: 32px;
}

#totalTime {
    text-align: right;
}

.seek-bar {
    flex: 1;
    display: block;
}

/* Linha de formato (bitrate/extensão) */
.format-row {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
}

.format-row span {
    font-size: 10px;
}

/* ---------- Elementos sem UI própria ---------- */
.hidden-media {
    display: none;
}

/* ---------- Alternância Play/Pause conforme estado ---------- */
#pauseBtn {
    display: none;
}

body.is-playing #playBtn {
    display: none;
}

body.is-playing #pauseBtn {
    display: flex;
}

/* ---------- Botões desabilitados (funções de fases futuras) ---------- */
.transport-btn:disabled {
    cursor: default;
}

/* Controles de transporte */
.transport-row {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.transport-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.transport-btn {
    width: 32px;
    height: 28px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.volume-group {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 120px;
    flex-shrink: 0;
}

.view-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-left: 14px;
    position: relative;
}

.view-controls::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
}

.icon {
    display: inline-block;
    position: relative;
    flex-shrink: 0;
}

.icon-volume {
    width: 14px;
    height: 12px;
    flex-shrink: 0;
}

.icon-fullscreen {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.volume-bar {
    width: 100%;
    display: block;
}

/* ---------- Barra de status ---------- */
.status-bar {
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 4px;
}

.status-section {
    display: flex;
    align-items: center;
    padding: 0 8px;
    height: 100%;
}

.status-item {
    font-size: 10px;
    white-space: nowrap;
}

/* ============================================================
   Modo Teatro
   Esconde title-bar/menu-bar/status-bar e transforma seek/
   transporte/volume/playlist em overlays flutuantes revelados
   por proximidade do mouse com a borda correspondente.
   ============================================================ */

body.theater-mode .main-content {
    padding: 0;
    gap: 0;
}

body.theater-mode .player-main {
    gap: 0;
}

body.theater-mode .status-bar {
    display: none;
}

/* Topo: title-bar + menu-bar */
body.theater-mode .title-bar,
body.theater-mode .menu-bar {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.theater-mode .title-bar {
    top: 0;
}

body.theater-mode .menu-bar {
    top: 18px;
}

body.theater-mode.show-top-overlay .title-bar,
body.theater-mode.show-top-overlay .menu-bar {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Embaixo: seek + transporte + formato + botão de teatro */
body.theater-mode .seek-row,
body.theater-mode .transport-row,
body.theater-mode .format-row {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 900;
    padding-left: 10px;
    padding-right: 10px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.theater-mode .format-row {
    bottom: 4px;
}

body.theater-mode .transport-row {
    bottom: 20px;
}

body.theater-mode .seek-row {
    bottom: 58px;
}

body.theater-mode.show-bottom-overlay .seek-row,
body.theater-mode.show-bottom-overlay .transport-row,
body.theater-mode.show-bottom-overlay .format-row {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.theater-bottom-scrim {
    display: none;
}

body.theater-mode .theater-bottom-scrim {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 110px;
    z-index: 899;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

body.theater-mode.show-bottom-overlay .theater-bottom-scrim {
    opacity: 1;
}

/* Direita: painel de playlist (sempre acessível por hover no modo teatro,
   independente do toggle "Mostrar lista" do modo normal) */
body.theater-mode .playlist-panel {
    display: flex;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 220px;
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.theater-mode.show-right-overlay .playlist-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}
