@font-face {
  font-family: 'Evogria';
  src: url('font/Evogria.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Evogria';
  src: url('font/Evogria Italic.otf') format('opentype');
  font-weight: normal;
  font-style: italic;
}

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@700&display=swap');

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

:root {
  --bg-dots: #f5f1e8;
  --bg-white: #ffffff;
  --text-dark: #000000;
  --text-gray: #666666;
  --border-color: #000000;
  --accent-gold: #d4af37;
}

body {
  font-family: 'Evogria', 'Inter', sans-serif;
  background: var(--bg-white);
  color: var(--text-dark);
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* ===== LOGIN PANEL ===== */
.login-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.login-container {
  background: #ffffff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-logo {
  height: 60px;
  width: auto;
  margin-bottom: 24px;
  filter: invert(1);
}

.login-container h1 {
  font-size: 24px;
  margin-bottom: 32px;
  color: #1a1a1a;
}

.login-field {
  margin-bottom: 20px;
  text-align: left;
}

.login-field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333333;
}

.login-field input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Evogria', sans-serif;
  transition: border-color 0.2s;
}

.login-field input:focus {
  outline: none;
  border-color: #1a1a1a;
}

.login-error {
  color: #e53935;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Evogria', sans-serif;
}

.login-btn:hover {
  background: #2d2d2d;
}

.login-btn:active {
  transform: scale(0.98);
}

#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ===== EDITOR SIDEBAR ===== */
.editor-sidebar {
  width: 380px;
  background: #1a1a1a;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

.editor-header {
  padding: 20px;
  background: #111111;
  border-bottom: 1px solid #333333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-logo {
  height: 40px;
  width: auto;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
}

.mode-btn,
.logout-btn {
  background: #333333;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: 'Evogria', sans-serif;
}

.mode-btn:hover,
.logout-btn:hover {
  background: #444444;
}

.logout-btn {
  background: #d32f2f;
}

.logout-btn:hover {
  background: #b71c1c;
}

.editor-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.editor-footer {
  padding: 16px 20px;
  background: #111111;
  border-top: 1px solid #333333;
  text-align: center;
}

.editor-footer p {
  margin: 0;
  font-size: 9px;
  color: #555555;
  letter-spacing: 0.2px;
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.editor-section h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #aaaaaa;
}

/* TV Selector */
.tv-select {
  width: 100%;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.tv-select:focus {
  outline: none;
  border-color: #555555;
}

.tv-select option {
  background: #2a2a2a;
  color: #ffffff;
}

.tv-manager {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tv-manager .tv-select {
  flex: 1;
}

.tv-actions {
  display: flex;
  gap: 4px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  color: #aaaaaa;
  font-weight: 500;
}

.field input,
.field textarea {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: #555555;
}

.add-btn,
.primary-btn,
.secondary-btn {
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.add-btn {
  background: #2a2a2a;
  color: #ffffff;
  border: 1px dashed #444444;
}

.add-btn:hover {
  background: #333333;
  border-color: #666666;
}

.primary-btn {
  background: #4a90e2;
  color: #ffffff;
}

.primary-btn:hover {
  background: #3a7bc8;
}

.save-btn {
  font-size: 16px;
  padding: 14px 20px;
}

.save-btn.has-changes {
  background: #ff9800;
  animation: pulse 2s infinite;
}

.save-btn.has-changes:hover {
  background: #f57c00;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

.save-info {
  text-align: center;
  font-size: 13px;
  margin-top: 8px;
  font-weight: 500;
}

.secondary-btn {
  background: #2a2a2a;
  color: #ffffff;
}

.secondary-btn:hover {
  background: #333333;
}

.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.share-section input {
  font-size: 12px;
  padding: 8px 10px;
}

.info-text {
  font-size: 13px;
  color: #888888;
  margin-bottom: 16px;
  line-height: 1.5;
}

.tv-link-group {
  margin-bottom: 16px;
}

.tv-link-group:last-child {
  margin-bottom: 0;
}

.tv-link-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #cccccc;
  margin-bottom: 6px;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-input {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  color: #ffffff;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

.link-input:focus {
  outline: none;
  border-color: #555555;
}

/* Section card */
.section-card {
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-card-header input {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #444444;
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}

.section-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #888888;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: #ffffff;
}

.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: start;
}

.item-inputs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-inputs input {
  background: #1a1a1a;
  border: 1px solid #444444;
  color: #ffffff;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.item-inputs input.item-name {
  font-weight: 500;
}

.item-inputs input.item-desc {
  font-size: 11px;
  color: #aaaaaa;
}

.item-price-input {
  background: #1a1a1a;
  border: 1px solid #444444;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  width: 70px;
  text-align: center;
}

/* ===== PREVIEW AREA ===== */
.preview-area {
  flex: 1;
  background: #2a2a2a;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  user-select: none;
}

.preview-area .tv-screen {
  width: 1080px;
  height: 1920px;
  background: var(--bg-dots);
  background-image: url('pictures/back_tv1.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform-origin: center center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

/* Zoom controls */
.zoom-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 100;
}

.zoom-btn {
  background: #3a3a3a;
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.zoom-btn:hover {
  background: #4a4a4a;
}

.zoom-level {
  color: #ffffff;
  font-size: 13px;
  min-width: 50px;
  text-align: center;
  font-weight: 500;
}

.tv-screen .menu-container {
  width: 100%;
  height: 1920px;
  max-height: 1920px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  box-sizing: border-box;
  padding: 0;
}

#menu-preview {
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-in-out;
  width: 100%;
  padding-top: 60px;
  padding-bottom: 60px;
  box-sizing: border-box;
  align-items: center;
  opacity: 1;
}

/* Logo header */
.menu-header {
  text-align: center;
  margin-bottom: 40px;
  width: 100%;
  max-width: 920px;
  padding: 0 80px;
  box-sizing: border-box;
}

.menu-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

.menu-logo img {
  max-width: 500px;
  height: auto;
}

.menu-subtitle {
  font-size: 18px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--text-gray);
  font-weight: 400;
}

/* Menu section */
.menu-section {
  margin-bottom: 48px;
  width: 100%;
  max-width: 920px;
  padding: 0 80px;
  box-sizing: border-box;
}

.section-title {
  font-family: 'Evogria', 'Bebas Neue', sans-serif;
  font-size: 48px;
  letter-spacing: 1px;
  margin-bottom: 16px;
  color: var(--text-dark);
}

.section-box {
  border: 3px solid var(--border-color);
  border-radius: 16px;
  padding: 30px 40px;
  background: transparent;
  backdrop-filter: none;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  gap: 24px;
}

.menu-item:last-child {
  margin-bottom: 0;
}

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-family: 'Evogria', 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 0.5px;
  color: var(--text-dark);
  line-height: 1.2;
}

.item-description {
  font-size: 18px;
  color: var(--text-dark);
  margin-top: 4px;
  font-weight: 400;
}

.item-price {
  font-family: 'Evogria', 'Bebas Neue', sans-serif;
  font-size: 36px;
  color: var(--text-dark);
  white-space: nowrap;
  font-weight: 400;
  text-shadow: none;
  border: none;
}

.section-note {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #cccccc;
  font-size: 16px;
  color: var(--text-gray);
  font-style: italic;
}

/* Fullscreen mode */
.preview-area.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  padding: 0;
  background: var(--bg-dots);
}

.preview-area.fullscreen .tv-screen {
  width: 1080px;
  height: 1920px;
  max-width: 100vw;
  max-height: 100vh;
  transform: scale(1);
  border-radius: 0;
  box-shadow: none;
}

/* TV Display Mode - ukryj edytor */
body.tv-mode .editor-sidebar {
  display: none;
}

body.tv-mode .preview-area {
  width: 100vw;
  height: 100vh;
  padding: 0;
  background: var(--bg-dots);
}

body.tv-mode .preview-area .tv-screen {
  width: 1080px;
  height: 1920px;
  max-width: 100vw;
  max-height: 100vh;
  transform: scale(1);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
}

/* Responsive - zoom jest kontrolowany przez zoom-controls.js */
.preview-area .tv-screen {
  /* transform jest ustawiany dynamicznie przez JS */
  transform-origin: center center;
}

@media (max-width: 900px) {
  #app {
    flex-direction: column;
  }

  .editor-sidebar {
    width: 100%;
    max-height: 40vh;
  }

  .preview-area {
    padding: 10px;
  }

  .preview-area .tv-screen {
    transform: scale(0.25);
  }

  .section-title {
    font-size: 36px;
  }

  .item-name {
    font-size: 24px;
  }

  .item-price {
    font-size: 28px;
  }
}

/* ===== THEME: PIWNA (UWAGA PIWO) ===== */

/* Animacja dla przycisku Zapisz */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
  }
}

/* Piwna theme - normalizacja czcionek w edytorze */
body[data-theme="piwna"] .editor-section h3,debar input,
body[data-theme="piwna"] .editor-sidebar textarea,
body[data-theme="piwna"] .editor-sidebar label,
body[data-theme="piwna"] .editor-sidebar button {
  font-size: 13px;
}

body[data-theme="piwna"] .editor-sidebar .section-card-header input {
  font-size: 14px;
}

body[data-theme="piwna"] .editor-sidebar .item-name {
  font-size: 13px;
}

body[data-theme="piwna"] .editor-sidebar .item-desc {
  font-size: 12px;
}

body[data-theme="piwna"] .editor-sidebar .item-price-input {
  font-size: 13px;
}

/* Podgląd TV */
body[data-theme="piwna"] .preview-area .tv-screen {
  background: #000000;
  background-image: none;
}

body[data-theme="piwna"] .menu-logo img {
  content: url('pictures/LogoPiwna.png');
  max-width: 501px;
  height: 130px;
}

body[data-theme="piwna"] .menu-subtitle {
  color: #ffffff;
  font-size: 18px;
  letter-spacing: 4px;
  margin-top: -10px;
}

body[data-theme="piwna"] #menu-preview {
  padding-top: 30px;
}

body[data-theme="piwna"] .menu-header {
  margin-bottom: 60px;
}

/* Tytuł główny "PRZEKĄSKI I JEDZENIE" */
body[data-theme="piwna"] .piwna-main-title {
  color: #fdb616;
  font-size: 55px;
  margin-bottom: 20px;
  text-transform: uppercase;
  text-align: left;
}

/* Tytuły pozycji (PIZZA, FRIES, etc.) */
body[data-theme="piwna"] .piwna-item-title {
  color: #ffffff;
  font-size: 60px;
  margin-bottom: 0;
  margin-top: 0;
  text-transform: uppercase;
  text-align: left;
}

/* Jeden duży biały box dla wszystkich sekcji */
body[data-theme="piwna"] .piwna-main-box {
  background: transparent;
  border: 2px solid #ffffff;
  border-radius: 12px;
  padding: 40px;
  margin-bottom: 20px;
}

body[data-theme="piwna"] .section-box {
  background: transparent;
  border: none;
  padding: 0;
  margin-bottom: 0;
}

body[data-theme="piwna"] .menu-item {
  border-bottom: none;
  padding: 20px 0;
  margin-bottom: 0;
}

body[data-theme="piwna"] .item-name {
  color: #ffffff;
  font-size: 60px;
  font-weight: normal;
  text-transform: uppercase;
}

body[data-theme="piwna"] .item-description {
  color: #ffffff;
  font-size: 24px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 4.8px;
  text-transform: uppercase;
  margin-top: 8px;
}

body[data-theme="piwna"] .item-price {
  color: #ffffff;
  font-size: 32px;
  border: none;
  background: transparent;
  padding: 0;
  min-width: auto;
  text-align: right;
}

body[data-theme="piwna"] .section-note {
  color: #ffffff;
  font-size: 24px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: 4.8px;
  text-transform: uppercase;
  margin-top: 16px;
  padding-top: 16px;
  border-top: none;
  background: transparent;
}

/* Specjalna sekcja na dole dla "OSTATNIE ZAMÓWIENIE" */
body[data-theme="piwna"] #menu-preview::after {
  content: 'OSTATNIE ZAMÓWIENIE\ALAST FOOD ORDERS 21:30';
  white-space: pre-line;
  text-align: center;
  color: #fdb616;
  font-size: 55px;
  font-family: 'Evogria', sans-serif;
  margin-top: auto;
  padding-top: 60px;
  padding-bottom: 40px;
  line-height: 1.3;
}
