/* ============================================
   Base Styles — Venue OS
   ============================================ */

body {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
  touch-action: manipulation;
  overscroll-behavior: none;
}

#app {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

#screen-container {
  overflow: hidden;
  position: relative;
  grid-row: 2;
}

#manager-bar {
  flex-shrink: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  width: 100%;
}

#manager-bar .mbar-row {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#manager-bar .mbar-row::-webkit-scrollbar { display: none; }

#manager-bar .mbar-btn {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--color-text-dim);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 0 var(--space-4);
  min-height: var(--tap-min);
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

#manager-bar .mbar-btn--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 700;
}

#manager-bar .mbar-logout {
  flex-shrink: 0;
  border: none;
  border-left: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-dim);
  font-size: var(--text-sm);
  padding: 0 var(--space-4);
  min-height: var(--tap-min);
  cursor: pointer;
  white-space: nowrap;
  opacity: 0.7;
  margin-left: var(--space-2);
}

/* ---- Typography ---- */

h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

h3 {
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.4;
}

/* Monospace for numbers and prices */
.mono {
  font-family: var(--font-mono);
}

.text-dim {
  color: var(--color-text-dim);
}

.text-primary {
  color: var(--color-primary);
}

.text-success {
  color: var(--color-success);
}

.text-danger {
  color: var(--color-danger);
}

.text-warning {
  color: var(--color-warning);
}

/* ---- Layout Utilities ---- */

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

/* ---- Scrollable regions ---- */

.scroll-y {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.scroll-x {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

/* ---- Connection Status Header Badge ---- */

.connection-badge {
  position: fixed;
  top: var(--space-2);
  right: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 700;
  pointer-events: none;
}

.connection-badge--online {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: var(--radius-full);
  background-color: var(--color-success);
}

.connection-badge--offline {
  background-color: var(--color-warning);
  color: var(--color-bg);
  animation: pulse 1s infinite;
}

.connection-badge--syncing {
  background-color: var(--color-primary);
  color: var(--color-bg);
  animation: pulse 1s infinite;
}

.connection-badge--conflicts {
  background-color: var(--color-danger);
  color: var(--color-text);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---- Screen containers ---- */

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  min-height: var(--tap-min);
  flex-shrink: 0;
}

.screen__body {
  flex: 1;
  overflow: hidden;
  display: flex;
}

/* ---- Two-panel layout ---- */

.split-panel {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.split-panel__left {
  flex: 7;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--color-border);
}

.split-panel__right {
  flex: 3;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ---- Responsive overrides ---- */

@media (min-width: 768px) and (max-width: 1023px) {
  .split-panel__right {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 320px;
    background-color: var(--color-bg);
    z-index: var(--z-sidebar);
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    border-left: 1px solid var(--color-border);
  }

  .split-panel__right--open {
    transform: translateX(0);
  }

  .split-panel__left {
    flex: 1;
    border-right: none;
  }
}

@media (max-width: 767px) {
  .split-panel {
    flex-direction: column;
  }

  .split-panel__left {
    flex: 1;
    border-right: none;
  }

  .split-panel__right {
    position: fixed;
    inset: 0;
    z-index: var(--z-sidebar);
    background-color: var(--color-bg);
    transform: translateY(100%);
    transition: transform var(--transition-normal);
  }

  .split-panel__right--open {
    transform: translateY(0);
  }
}
