/* === GLOBAL RESET === */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
  overflow: hidden;
}
body {
  font-family: Segoe UI, sans-serif;
  background: #2b2b2b;
  color: #eee;
}

/* === CSS VARIABLES === */
:root {
  --ribbon-height:     36px;
  --toolbar-height:    40px;
  --topbar-height:     200px;
  --players-height:    200px;
  --vertical-width:    60px;
  --player-wave-hei:   60px;
  --player-icon-size:  2em;
}

/* === SCREEN UTILITIES === */
.screen  { position: absolute; width:100%; height:100%; }
.visible { display: block; }
.hidden  { display: none;  }

/* === LOGIN SCREEN === */
.login-box {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #1f1f1f;
  padding: 2em;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,0,0,0.7);
  width: 320px;
}
.login-box h1 {
  text-align: center;
  color: #fff;
  margin-bottom: 1em;
}
.login-box input {
  width: 100%;
  padding: .75em;
  margin: .5em 0;
  background: #333;
  border: 1px solid #444;
  border-radius: 4px;
  color: #eee;
}
.login-box button {
  width: 100%;
  padding: .75em;
  background: #0078d7;
  border: none;
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
}
.login-box button:hover {
  background: #005a9e;
}
.error-msg {
  color: #f33;
  text-align: center;
  margin-top: .5em;
}

/* === RIBBON MENU === */
.ribbon {
  display: flex;
  align-items: center;
  height: var(--ribbon-height);
  background: #1a1a1a;
  border-bottom: 1px solid #444;
  padding: 0 1em;
}
.ribbon .menu {
  list-style: none;
  display: flex;
  gap: 1em;
  color: #ccc;
  font-size: .9em;
}
.ribbon .menu li {
  line-height: var(--ribbon-height);
  padding: 0 .5em;
  cursor: pointer;
  user-select: none;
}
.ribbon .menu li:hover {
  background: #333;
}
.user-panel {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.user-panel span {
  color: #ccc;
  font-size: .9em;
  margin-right: 1em;
}
.user-panel button {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1em;
  cursor: pointer;
  line-height: var(--ribbon-height);
}
.user-panel button:hover {
  color: #fff;
}

/* === TOP TOOLBAR === */
.toolbar {
  display: flex;
  gap: .5em;
  padding: .2em 1em;
  height: var(--toolbar-height);
  background: #252525;
  border-bottom: 1px solid #444;
}
.toolbar button {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2em;
  padding: .3em;
  cursor: pointer;
  line-height: 1;
}
.toolbar button:hover {
  color: #fff;
}

/* === TOP BAR === */
.top-bar {
  position: absolute;
  top: calc(var(--ribbon-height) + var(--toolbar-height));
  left: 0; right: 0;
  height: var(--topbar-height);
  display: flex;
}
.top-bar-left {
  flex: 1;
  background: #1f1f1f;
  border-bottom: 1px solid #444;
}
.top-bar-right {
  flex: 1;
  background: #1e1e1e;
  border-left: 1px solid #444;
  border-bottom: 1px solid #444;
}

/* === MAIN CONTENT === */
.content {
  position: absolute;
  top: calc(
    var(--ribbon-height)
    + var(--toolbar-height)
    + var(--topbar-height)
  );
  left: 0; right: 0;
  bottom: var(--players-height);
  display: flex;
}

/* === SIDEBAR: Media Wall === */
.sidebar {
  flex: 0 0 50%;
  max-width: 50%;
  background: #1f1f1f;
  border-right: 1px solid #444;
  display: flex;
  flex-direction: column;
}
.tabs {
  display: flex;
}
.tab {
  flex: 1;
  padding: .5em;
  text-align: center;
  background: #333;
  color: #ccc;
  cursor: pointer;
  font-size: .9em;
}
.tab.active {
  background: #0078d7;
  color: #fff;
}
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.tab-content:not(.visible) {
  display: none;
}

/* === CART GRID (4×6) === */
.cart-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 12px;
  overflow: hidden;
}
.cart-item {
  background: #049a04;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 4px;
  padding: .5em;
  position: relative;
  cursor: grab;
}
.cart-item.empty {
  background: #333;
  color: #777;
}
.cart-item .cart-title,
.cart-item .cart-album,
.cart-item .cart-artist,
.cart-item .cart-blank,
.cart-item .cart-category {
  font-size: .8em;
  line-height: 1.2em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cart-item .cart-title {
  font-weight: bold;
}
.cart-item .cart-album {
  font-style: italic;
  opacity: .9;
}
.cart-item .cart-artist {
  opacity: .8;
}
.cart-item .cart-blank {
  /* spacer */
}
.cart-item .cart-category {
  text-transform: uppercase;
  font-size: .75em;
}
.cart-item .cart-footer {
  display: flex;
  justify-content: space-between;
  font-size: .7em;
  color: #ccc;
  border-top: 0px none;
  padding-top: .3em;
  margin-top: .3em;
  background: transparent;
}

/* === CART PAGINATION === */
.cart-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5em;
  background: #252525;
  border-top: 1px solid #444;
}
.cart-footer button {
  background: #0078d7;
  border: none;
  color: #fff;
  padding: .3em .6em;
  cursor: pointer;
  border-radius: 4px;
}
.cart-footer button:hover {
  background: #005a9e;
}
.cart-footer input {
  width: 4em;
  padding: .3em;
  border-radius: 4px;
  border: 1px solid #444;
  background: #333;
  color: #eee;
}

/* === SCHEDULER SECTION === */
.schedule-section {
  flex: 0 0 calc(50% - var(--vertical-width));
  background: #1e1e1e;
  display: flex;
  flex-direction: column;
}
.live-controls {
  display: flex;
  align-items: center;
  padding: .5em 1em;
  background: #252525;
  border-bottom: 1px solid #444;
}
.live-controls button {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2em;
  margin-right: .5em;
  cursor: pointer;
}
.live-controls button:hover {
  color: #fff;
}
.live-clock {
  margin-left: auto;
  color: #0f0;
  font-size: 1.1em;
}
.schedule-header {
  padding: .5em 1em;
  color: #ccc;
  border-bottom: 1px solid #444;
  font-size: 1em;
}
.schedule-toolbar {
  display: flex;
  background: #252525;
  padding: .2em 1em;
  border-bottom: 1px solid #444;
}
.schedule-toolbar button {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1em;
  padding: .3em;
  cursor: pointer;
}
.schedule-toolbar button:hover {
  color: #fff;
}
.schedule-info {
  padding: .3em 1em;
  color: #0f0;
  border-bottom: 1px solid #444;
  font-size: .9em;
}
.schedule-grid {
  flex: 1;
  overflow-y: auto;
  background: #1e1e1e;
}
.schedule-row {
  display: flex;
  align-items: center;
  padding: .4em 1em;
  border-bottom: 1px solid #333;
  background: #2a2a2a;
  font-size: .9em;
}
.schedule-row:nth-child(even) {
  background: #252525;
}
.schedule-row .time {
  width: 70px;
  color: #ccc;
}
.schedule-row .title {
  flex: 1;
  color: #eee;
  padding-left: .5em;
}
.schedule-row .delete {
  width: 30px;
  text-align: center;
}
.schedule-row .delete i {
  color: #f33;
  cursor: pointer;
}

/* === CONTEXT MENU === */
.context-menu {
  position: absolute;
  background: #333;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  z-index: 1000;
  width: 150px;
}
.context-menu div {
  padding: .5em;
  cursor: pointer;
}
.context-menu div:hover {
  background: #444;
}

/* === VERTICAL TOOLBAR === */
.vertical-toolbar {
  flex: 0 0 var(--vertical-width);
  background: #1f1f1f;
  border-left: 1px solid #444;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .5em 0;
}
.vertical-toolbar .clock {
  font-size: 1.2em;
  color: #0f0;
  margin-bottom: 1em;
}
.vertical-toolbar button {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2em;
  margin: .5em 0;
  cursor: pointer;
}
.vertical-toolbar button:hover {
  color: #fff;
}

/* === PLAYERS DOCK === */
.players-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: var(--players-height);
  background: #1a1a1a;
  border-top: 1px solid #444;
}
.player-dock {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  height: 100%;
}
.player-slot {
  flex: 1;
  background: #2a2a2a;
  color: #ccc;
  display: flex;
  flex-direction: column;
  margin: 0 .25em;
  position: relative;
}

/* Track info fixed two lines */
.player-label .track-info {
  min-height: 2.4em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 .5em;
}
.player-label .track-title {
  font-weight: bold;
  color: #fff;
}
.player-label .track-artist {
  font-style: italic;
  color: #ccc;
  opacity: 0.8;
}

/* Time info row */
.time-info {
  display: flex;
  justify-content: space-between;
  padding: 0 .5em;
  font-size: .8em;
  color: #ccc;
}

/* Waveform & loader */
.waveform {
  flex: 0 0 var(--player-wave-hei);
  background: #222;
  position: relative;
}
.waveform-loading {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: var(--player-wave-hei);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ccc;
  background: rgba(0,0,0,0.6);
  font-size: .8em;
  pointer-events: none;
  transition: opacity .3s, visibility .3s;
}
.waveform-loading.hidden {
  opacity: 0;
  visibility: hidden;
}

/* Player controls */
.player-controls {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: 1em;
  padding: .5em;
}
.player-controls button {
  background: none;
  border: none;
  color: #fff;
  font-size: var(--player-icon-size);
  cursor: pointer;
}
.player-controls button:hover {
  color: #49c249;
}

/* === RESPONSIVE ADJUSTMENTS === */
@media (max-width: 1280px) {
  .sidebar { flex: 0 0 45%; }
  .schedule-section { flex: 0 0 calc(55% - var(--vertical-width)); }
}
@media (max-width: 768px) {
  .content { flex-direction: column; }
  .sidebar, .schedule-section, .vertical-toolbar {
    width: 100%;
  }
  .vertical-toolbar {
    flex-direction: row;
    justify-content: space-around;
  }
}
