:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.5);
  --accent: #10b981;
  --accent-glow: rgba(16, 185, 129, 0.5);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #059669;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
}

/* --- ADMIN PANEL STYLE --- */
.admin-container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}
.header-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 25px;
  color: var(--text-main);
}
.card {
  background: var(--bg-card);
  border: 1px solid #334155;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}
.card h3 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-muted);
}
input,
select {
  width: 100%;
  padding: 12px 16px;
  background: #0f172a;
  border: 1px solid #475569;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  transition: all 0.3s;
}
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}
.btn-success {
  background: var(--accent);
  color: white;
  margin-top: 10px;
}
.btn-success:hover {
  background: var(--success);
  transform: translateY(-1px);
}
.btn-success-outline {
  background: transparent;
  border: 1px solid var(--success);
  color: var(--success);
}
.btn-success-outline:hover {
  background: var(--success);
  color: white;
}
.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger);
  color: white;
}

.admin-display-box {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #0f172a;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px dashed #475569;
}
.counter-box {
  text-align: center;
}
.counter-box span {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.counter-box strong {
  font-size: 2.5rem;
  color: var(--primary);
}

/* --- DISPLAY MONITOR STYLE --- */
.wrapper {
  display: grid;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}
.queue-section {
  background: radial-gradient(circle at top left, #1e293b, #0f172a);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  position: relative;
}
.badge {
  background: var(--primary-glow);
  color: #93c5fd;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 15px;
  border: 1px solid var(--primary);
}
.queue-number {
  font-size: 11rem;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 40px var(--primary-glow);
  margin: 10px 0;
}
.counter-call {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow);
  margin-bottom: 30px;
}
.display-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  width: 100%;
  max-width: 500px;
}
.info-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 15px;
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(5px);
}
.info-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
}
.info-card div {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 5px;
}

.ad-section {
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.ad-section img,
.ad-section video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* LAYOUT VARIATIONS */
.layout-full {
  grid-template-columns: 1fr;
}
.layout-full .ad-section {
  display: none;
}

.layout-side {
  grid-template-columns: 45% 55%;
}
.layout-side .queue-number {
  font-size: 8rem;
}

.layout-overlay {
  grid-template-columns: 1fr;
  position: relative;
}
.layout-overlay .ad-section {
  width: 100%;
  height: 100vh;
}
.layout-overlay .queue-section {
  position: absolute;
  bottom: 40px;
  right: 40px;
  width: 420px;
  height: auto;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 30px;
}
.layout-overlay .queue-number {
  font-size: 5rem;
}
.layout-overlay .counter-call {
  font-size: 1.8rem;
  margin-bottom: 15px;
}

.hidden {
  display: none !important;
}

.layout-grid .standard-layout {
  display: none;
}

.grid-layout {
  position: relative;
  display: grid;
  width: 100%;
  height: 100vh;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
}

.grid-shared-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.grid-shared-background img,
.grid-shared-background video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-queue-background {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  background: rgba(15, 23, 42, 1);
  padding: 20px;
  box-sizing: border-box;
}

.grid-queue-background .queue-cell-inner {
  width: 100%;
  height: 100%;
  padding: 0;
  box-sizing: border-box;
}

.grid-cell {
  background: rgba(15, 23, 42, 0.98);
  border: none;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.grid-cell.queue {
  background: linear-gradient(
    180deg,
    rgba(15, 23, 42, 0.97),
    rgba(15, 23, 42, 0.9)
  );
}

.grid-cell.queue.merged {
  background: transparent;
}

.grid-cell.ad {
  background: #000;
}

.grid-cell.ad.shared {
  background: transparent;
}

.grid-cell img,
.grid-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  gap: 16px;
}

.queue-cell-inner .queue-number {
  font-size: 5rem;
  margin: 0;
}

.queue-cell-inner .counter-call {
  font-size: 2rem;
  margin-bottom: 0;
}

.grid-layout #cell-0 {
  border-radius: 18px 0 0 0;
}

.grid-layout #cell-1 {
  border-radius: 0 18px 0 0;
}

.grid-layout #cell-2 {
  border-radius: 0 0 0 18px;
}

.grid-layout #cell-3 {
  border-radius: 0 0 18px 0;
}

.grid-cell .ad-placeholder {
  color: var(--text-muted);
  font-size: 1.1rem;
  text-align: center;
  padding: 24px;
}

.display-info-grid.small {
  max-width: 100%;
  width: 100%;
  grid-template-columns: 1fr 1fr;
}

.grid-placement {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid-box {
  min-height: 100px;
  padding: 16px;
  border-radius: 14px;
  background: #111827;
  border: 1px solid #475569;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.grid-box.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.grid-box.queue {
  background: rgba(16, 185, 129, 0.12);
}

.grid-box.ad {
  background: rgba(59, 130, 246, 0.12);
}

.grid-box strong {
  font-size: 1.3rem;
}

.grid-box span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.grid-box small {
  color: var(--text-muted);
}
