/* ==============================================
   INVITATION TOOL - Premium Dark UI
   ============================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-base: #b31e22;
  --bg-card: rgba(255, 255, 255, 0.18);
  --bg-card-hover: rgba(255, 255, 255, 0.26);
  --bg-input: rgba(255, 255, 255, 0.25);
  --border: rgba(255, 255, 255, 0.30);
  --border-active: rgba(255, 255, 255, 0.55);
  --gold: #b31e22;
  --gold-light: #e2c272;
  --gold-dark: #8B6914;
  --blue-accent: #4f8ef7;
  --green-accent: #059669;
  --red-accent: #c0392b;
  --text-primary: #1a1a2e;
  --text-secondary: #000;
  --text-muted: #000;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-glow: 0 0 40px rgba(255, 255, 255, 0.10);
  --transition: 0.2s ease;
}

html {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100%;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

.bg-particles {
  background-image: url('assets/background.webp');
  background-size: cover;
  background-position: center;
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.app-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
}

.app-header {
  padding: 20px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 32px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(201, 168, 76, 0.2), rgba(201, 168, 76, 0.05));
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: var(--radius-md);
}

.logo-title {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.75));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.logo-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}

.header-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.badge:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* === MAIN LAYOUT === */
.app-main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px 0;
  flex: 1;
  align-items: start;
}

/* === CONTROL PANEL — Liquid Glass === */
.control-panel {
  /* Liquid glass base */
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0.10) 40%,
      rgba(255, 255, 255, 0.05) 100%);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  /* Shimmer border */
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-lg);
  /* Inner highlight (top-left light catch) */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 1px 0 0 rgba(255, 255, 255, 0.25),
    0 8px 32px rgba(0, 0, 0, 0.18),
    0 2px 8px rgba(0, 0, 0, 0.10);
  padding: 16px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  /* Subtle liquid animation */
  animation: liquidShimmer 6s ease-in-out infinite alternate;
}

@keyframes liquidShimmer {
  0% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 1px 0 0 rgba(255, 255, 255, 0.25), 0 8px 32px rgba(0, 0, 0, 0.18);
  }

  50% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.70), inset 1px 0 0 rgba(255, 255, 255, 0.35), 0 12px 40px rgba(0, 0, 0, 0.22);
  }

  100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 1px 0 0 rgba(255, 255, 255, 0.25), 0 8px 32px rgba(0, 0, 0, 0.18);
  }
}

.control-panel::-webkit-scrollbar {
  width: 5px;
}

.control-panel::-webkit-scrollbar-track {
  background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.panel-section {
  margin-bottom: 2px;
}

.section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* === LABELS === */
.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.field-label-sm {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.label-icon {
  margin-right: 6px;
}

/* === SELECT === */
.select-wrapper {
  position: relative;
}

.styled-select {
  width: 100%;
  padding: 8px 36px 8px 12px;
  background: rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.styled-select:focus,
.styled-select:hover {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-secondary);
  font-size: 12px;
}

/* === INPUTS === */
.styled-input {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.30);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: var(--transition);
  font-family: inherit;
}

.styled-input::placeholder {
  color: var(--text-muted);
}

.styled-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.styled-select-sm {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
  font-family: inherit;
}

.styled-select-sm:focus {
  outline: none;
  border-color: var(--gold);
}

.styled-input-sm {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
}

.styled-input-sm:focus {
  outline: none;
  border-color: var(--gold);
}

.style-row {
  display: flex;
  gap: 10px;
}

.style-group {
  flex: 1;
  min-width: 0;
}

.color-picker {
  width: 100%;
  height: 34px;
  padding: 2px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.color-picker:focus {
  outline: none;
  border-color: var(--gold);
}

/* === BUTTONS === */
.btn {
  width: 100%;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  margin-bottom: 10px;
}

.btn:last-child {
  margin-bottom: 0;
}

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

.btn-primary {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 4px 20px rgba(201, 168, 76, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px rgba(201, 168, 76, 0.4);
  filter: brightness(1.08);
}

.btn-excel {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-excel:hover {
  border-color: var(--blue-accent);
  color: var(--blue-accent);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #34d399);
  color: #fff;
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.2);
}

.btn-success:hover {
  box-shadow: 0 6px 28px rgba(52, 211, 153, 0.35);
  filter: brightness(1.06);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}

/* === FILE DROP ZONE === */
.file-drop-zone {
  border: 2px dashed var(--border-active);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.01);
}

.file-drop-zone:hover,
.file-drop-zone.dragging {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.05);
}

.drop-icon {
  font-size: 26px;
  display: block;
  margin-bottom: 6px;
}

.drop-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.hint-text {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.6;
}

.hint-text code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--gold);
}

/* === BULK PREVIEW TABLE === */
.bulk-preview {
  margin-bottom: 12px;
}

.bulk-info {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(52, 211, 153, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: var(--radius-sm);
}

.bulk-list-wrap {
  max-height: 180px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.bulk-list-wrap::-webkit-scrollbar {
  width: 4px;
}

.bulk-list-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
}

.bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.bulk-table th {
  background: var(--bg-input);
  padding: 6px 8px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
}

.bulk-table td {
  padding: 5px 8px;
  border-top: 1px solid var(--border);
}

.bulk-table tr:hover td {
  background: var(--bg-input);
}

.bulk-table .preview-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gold);
  font-size: 11px;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.bulk-table .preview-btn:hover {
  background: rgba(201, 168, 76, 0.1);
}

/* === PROGRESS === */
.progress-wrap {
  margin-top: 12px;
}

.progress-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar-bg {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* === RIGHT: PREVIEW === */
.preview-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.preview-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.preview-size {
  font-size: 11px;
  color: var(--text-muted);
}

/* === CANVAS CONTAINER — Liquid Glass === */
.canvas-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  /* Liquid glass */
  background:
    linear-gradient(160deg,
      rgba(255, 255, 255, 0.20) 0%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(255, 255, 255, 0.14) 100%);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius-lg);
  /* Layered inner glow + outer depth */
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.60),
    inset 0 -1px 0 rgba(255, 255, 255, 0.12),
    inset 2px 0 0 rgba(255, 255, 255, 0.22),
    0 16px 48px rgba(0, 0, 0, 0.20),
    0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 24px;
  min-height: 400px;
  /* Liquid shimmer offset from panel */
  animation: liquidShimmer 6s ease-in-out 1s infinite alternate;
}

#inviteCanvas {
  max-width: 40%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  display: block;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(13, 15, 20, 0.7);
  border-radius: var(--radius-lg);
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  transition: opacity 0.3s;
}

.canvas-overlay.hidden {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* === FOOTER === */
.app-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding: 14px 0;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.5);
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: var(--green-accent);
  color: var(--green-accent);
}

.toast.error {
  border-color: var(--red-accent);
  color: var(--red-accent);
}

/* === POSITION EDITOR === */
.pos-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.btn-pos-toggle {
  background: rgba(255, 221, 68, 0.12);
  border: 1px solid rgba(255, 221, 68, 0.35);
  color: #ffdd44;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.btn-pos-toggle:hover {
  background: rgba(255, 221, 68, 0.22);
}

.btn-pos-toggle.active {
  background: rgba(255, 221, 68, 0.25);
  border-color: #ffdd44;
  box-shadow: 0 0 12px rgba(255, 221, 68, 0.2);
}

.pos-editor-panel {
  margin-top: 12px;
  background: rgba(255, 221, 68, 0.04);
  border: 1px solid rgba(255, 221, 68, 0.15);
  border-radius: var(--radius-md);
  padding: 14px;
}

.pos-line-chooser {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.pos-radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12.5px;
  transition: var(--transition);
}

.pos-radio-label:hover {
  border-color: rgba(255, 221, 68, 0.4);
  background: rgba(255, 255, 255, 0.02);
}

.pos-radio-label input[type="radio"] {
  accent-color: #ffdd44;
}

.pos-radio-label.active {
  border-color: #ffdd44;
  background: rgba(255, 221, 68, 0.06);
}

.pos-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pos-coords {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.pos-coords code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
  color: #ffdd44;
  font-size: 11px;
}

.btn-pos-done {
  width: 100%;
  padding: 9px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--green-accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.btn-pos-done:hover {
  background: rgba(52, 211, 153, 0.25);
}

/* Canvas crosshair cursor when position editor is active */
.canvas-editor-active #inviteCanvas {
  cursor: crosshair !important;
}

.canvas-editor-active {
  border-color: rgba(255, 221, 68, 0.4) !important;
  box-shadow: 0 0 0 2px rgba(255, 221, 68, 0.15);
}

/* Hint bar shown above canvas when editor is active */
.pos-canvas-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 16px;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 13px;
  color: #fff;
  border-top: 1px solid rgba(255, 221, 68, 0.3);
  pointer-events: none;
}

.pos-canvas-hint strong {
  color: #ffdd44;
}

/* === UTILITY === */
.hidden {
  display: none !important;
}

/* === RESPONSIVE DESKTOP SCALING (125%-150% Scale) === */
@media (max-height: 850px) and (min-width: 901px) {
  .app-header {
    padding: 10px 0 8px;
  }
  .app-main {
    padding: 10px 0;
    gap: 16px;
  }
  .control-panel {
    top: 10px;
    padding: 12px;
    max-height: calc(100vh - 70px);
    overflow-y: hidden; /* Ensure it never scrolls as requested */
  }
  .panel-section {
    margin-bottom: 0px;
  }
  .divider {
    margin: 8px 0;
  }
  .styled-input, .styled-select {
    padding: 6px 10px;
    font-size: 11.5px;
  }
  .btn {
    padding: 8px 12px;
    font-size: 12px;
    margin-bottom: 6px;
  }
  .section-title {
    margin-bottom: 6px;
    font-size: 10px;
  }
  .field-label {
    margin-bottom: 3px;
    font-size: 11.5px;
  }
  .file-drop-zone {
    padding: 8px;
    margin-bottom: 6px;
  }
  .logo-title {
    font-size: 16px;
  }
  .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
}

/* For Windows 125% Scale (approx 700px-780px viewport height) */
@media (max-height: 780px) and (min-width: 901px) {
  .control-panel {
    zoom: 0.85; /* Shrink the control panel down so it fits entirely without scrolling */
  }
}

/* For extreme scaling (150% Scale, approx <= 650px viewport height) */
@media (max-height: 650px) and (min-width: 901px) {
  .control-panel {
    zoom: 0.72;
  }
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .app-wrapper {
    padding: 0 14px;
  }

  .app-main {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    max-height: none;
  }

  .header-badges {
    display: none;
  }

  #inviteCanvas {
    max-width: 70%;
  }
}

@media (max-width: 480px) {
  .logo-title {
    font-size: 16px;
  }

  .canvas-container {
    padding: 12px;
    min-height: 300px;
  }

  #inviteCanvas {
    max-width: 100%;
  }
}