/* VenueSync Components (Modals, QR Cards, AI Chat Reports, Integration Guides) */

/* Modal Dialogs */
.modal-overlay,
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.active,
.modal.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-float);
  transform: translateY(20px);
  transition: transform 0.25s;
}
.modal-overlay.active .modal-dialog,
.modal.active .modal-dialog {
  transform: translateY(0);
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body {
  padding: 24px;
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* QR Code Cards */
.qr-card {
  background: #fff;
  border-radius: var(--border-radius);
  padding: 24px;
  color: #12100E;
  text-align: center;
  max-width: 320px;
  margin: 0 auto 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.qr-code-svg-wrap {
  width: 220px;
  height: 220px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qr-code-svg-wrap svg {
  width: 100%;
  height: 100%;
}
.qr-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #161412;
  margin-bottom: 4px;
}
.qr-token-label {
  font-family: monospace;
  font-size: 0.85rem;
  background: #f0ede8;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  margin-top: 8px;
}

/* Transparent Live Bill Panel */
.live-bill-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
}
.bill-line {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.bill-credit {
  color: var(--accent-success);
  font-weight: 700;
}
.bill-total {
  font-size: 1.25rem;
  font-weight: 800;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 12px;
}

/* Integration Setup Guides (Paymob & 4 Social Platforms) */
.guide-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  overflow: hidden;
}
.guide-header {
  padding: 18px 24px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.guide-body {
  padding: 24px;
}
.guide-step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #12100E;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-content {
  flex: 1;
}
.step-title {
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #12100E;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  margin-top: 8px;
  font-family: monospace;
  font-size: 0.85rem;
}
.copy-box input {
  background: transparent;
  border: none;
  color: var(--accent-primary);
  flex: 1;
  outline: none;
}
.copy-box button {
  flex-shrink: 0;
  cursor: pointer;
}
.social-guide-card {
  margin-bottom: 20px;
}

/* Conversational AI Reports Widget */
.ai-chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
}
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-msg {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: var(--border-radius);
  font-size: 0.95rem;
  line-height: 1.5;
}
.chat-msg-user {
  align-self: flex-end;
  background: var(--accent-primary);
  color: #12100E;
  font-weight: 600;
  border-bottom-right-radius: 4px;
}
.chat-msg-ai {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.ai-chat-input-bar {
  padding: 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
}

/* Dynamic SVG Charts */
.chart-container {
  width: 100%;
  padding: 16px 0;
}
.chart-svg {
  width: 100%;
  height: 260px;
}
.chart-bar {
  fill: var(--accent-primary);
  transition: opacity 0.2s, height 0.4s ease-out;
}
.chart-bar:hover {
  filter: brightness(1.2);
}
.chart-text {
  fill: var(--text-muted);
  font-size: 11px;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.data-table th, .data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}
.data-table th {
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
}
.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Quick Social Login Component */
.social-login-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}
@media (max-width: 480px) {
  .social-login-grid {
    grid-template-columns: 1fr;
  }
}
.btn-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  width: 100%;
}
.btn-social:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}
.btn-social.social-google:hover { border-color: #EA4335; color: #fff; }
.btn-social.social-apple:hover { border-color: #A2AAAD; color: #fff; }
.btn-social.social-tiktok:hover { border-color: #00F2FE; color: #00F2FE; }
.btn-social.social-instagram:hover { border-color: #E1306C; color: #E1306C; }
.btn-social.social-facebook:hover { border-color: #1877F2; color: #1877F2; }
.btn-social.social-whatsapp:hover { border-color: #25D366; color: #25D366; }
.auth-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}
.auth-divider span {
  padding: 0 12px;
}

/* Guest CRM & Purchase Ledger Styles */
.btn-purchases {
  border: 1px solid #4BB543;
  color: #4BB543;
  background: rgba(75, 181, 67, 0.08);
  font-weight: 700;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-purchases:hover {
  background: rgba(75, 181, 67, 0.2);
  transform: translateY(-1px);
}
.crm-check-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 14px;
}

/* ==========================================================================
   Page Builder & Freeform Canvas System
   ========================================================================== */
.vs-page-canvas {
  display: grid;
  grid-template-columns: repeat(var(--canvas-cols, 12), minmax(0, 1fr));
  grid-auto-rows: minmax(var(--canvas-row-h, 65px), auto);
  gap: var(--canvas-gap, 16px);
  width: 100%;
  position: relative;
  transition: all 0.25s ease;
}

.vs-canvas-block {
  grid-column: var(--col-start, 1) / span var(--col-span, 12);
  grid-row: var(--row-start, 1) / span var(--row-span, 4);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  margin-bottom: 0 !important;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.vs-block-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Smart Mobile View: Collapses into 1 column & sorts by mobile order */
@media (max-width: 768px) {
  .vs-page-canvas {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  .vs-canvas-block {
    order: var(--mobile-order, 1) !important;
    grid-column: auto !important;
    grid-row: auto !important;
    width: 100% !important;
  }
}

.vs-canvas-mobile-mode {
  display: flex !important;
  flex-direction: column !important;
  max-width: 420px !important;
  margin: 0 auto !important;
  border: 2px solid var(--border-color) !important;
  border-radius: 24px !important;
  padding: 18px !important;
  background: var(--bg-primary) !important;
  box-shadow: 0 16px 40px rgba(0,0,0,0.4) !important;
}

.vs-canvas-mobile-mode .vs-canvas-block {
  order: var(--mobile-order, 1) !important;
  grid-column: auto !important;
  grid-row: auto !important;
  width: 100% !important;
}

/* Page Builder Workspace Layout */
.vs-builder-layout {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 1200px) {
  .vs-builder-layout {
    grid-template-columns: 240px 1fr;
  }
  .vs-builder-inspector {
    grid-column: span 2;
  }
}

.vs-palette-panel, .vs-builder-inspector {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 16px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.vs-palette-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: grab;
  user-select: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.vs-palette-item span {
  pointer-events: none;
}

.vs-palette-item:active {
  cursor: grabbing;
}

.vs-palette-item:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card);
  transform: translateX(3px);
}

/* Canvas Drop Target Highlight */
.vs-page-canvas.vs-drop-active,
.vs-canvas-container.vs-drop-active,
#builder-canvas-mount.vs-drop-active {
  outline: 3px dashed var(--accent-primary) !important;
  outline-offset: 4px;
  background-color: rgba(250, 180, 0, 0.08) !important;
  cursor: copy !important;
}

/* Drag Ghost for Smooth Drag & Drop */
.vs-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: var(--bg-card);
  border: 2px solid var(--accent-primary);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-primary);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

/* Newly dropped block highlight pulse */
@keyframes vs-drop-pulse {
  0% { transform: scale(0.98); box-shadow: 0 0 0 0 rgba(250, 180, 0, 0.6); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(250, 180, 0, 0); }
  100% { transform: scale(1); box-shadow: none; }
}

.vs-just-dropped {
  animation: vs-drop-pulse 0.7s ease-out;
  outline: 2px solid var(--accent-primary) !important;
}

/* Canvas Active Selection in Builder */
.vs-builder-block {
  cursor: pointer;
  position: relative;
}

.vs-builder-block:hover {
  outline: 2px dashed rgba(250, 180, 0, 0.4);
}

.vs-builder-block.vs-selected-block {
  outline: 2px solid var(--accent-primary) !important;
  box-shadow: 0 0 16px rgba(250, 180, 0, 0.25);
}

.vs-block-builder-toolbar {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(23, 21, 35, 0.88);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 6px;
}

.vs-block-type-pill {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.vs-coord-pill {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: monospace;
}

.btn-builder-tool {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
}

.btn-builder-tool:hover {
  background: var(--bg-surface);
}

.btn-builder-tool.btn-danger:hover {
  background: rgba(255, 68, 68, 0.2);
}

/* Edge & Corner Resize Handles (WordPress / Slide Style) */
.vs-resize-handle {
  position: absolute;
  z-index: 20;
  box-sizing: border-box;
}

/* Corner Handles */
.vs-resize-handle.vs-resize-se {
  bottom: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  cursor: se-resize;
  background: var(--accent-primary);
  border: 2px solid #fff;
  border-radius: 3px;
}

.vs-resize-handle.vs-resize-sw {
  bottom: -4px;
  left: -4px;
  width: 14px;
  height: 14px;
  cursor: sw-resize;
  background: var(--accent-primary);
  border: 2px solid #fff;
  border-radius: 3px;
}

.vs-resize-handle.vs-resize-ne {
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  cursor: ne-resize;
  background: var(--accent-primary);
  border: 2px solid #fff;
  border-radius: 3px;
}

.vs-resize-handle.vs-resize-nw {
  top: -4px;
  left: -4px;
  width: 14px;
  height: 14px;
  cursor: nw-resize;
  background: var(--accent-primary);
  border: 2px solid #fff;
  border-radius: 3px;
}

/* Edge Handles */
.vs-resize-handle.vs-resize-e {
  top: 10px;
  bottom: 10px;
  right: -5px;
  width: 10px;
  cursor: e-resize;
  background: rgba(229, 154, 60, 0.3);
  border-radius: 4px;
  transition: background 0.15s ease;
}
.vs-resize-handle.vs-resize-e:hover {
  background: var(--accent-primary);
}

.vs-resize-handle.vs-resize-w {
  top: 10px;
  bottom: 10px;
  left: -5px;
  width: 10px;
  cursor: w-resize;
  background: rgba(229, 154, 60, 0.3);
  border-radius: 4px;
  transition: background 0.15s ease;
}
.vs-resize-handle.vs-resize-w:hover {
  background: var(--accent-primary);
}

.vs-resize-handle.vs-resize-s {
  left: 10px;
  right: 10px;
  bottom: -5px;
  height: 10px;
  cursor: s-resize;
  background: rgba(229, 154, 60, 0.3);
  border-radius: 4px;
  transition: background 0.15s ease;
}
.vs-resize-handle.vs-resize-s:hover {
  background: var(--accent-primary);
}

.vs-resize-handle.vs-resize-n {
  left: 10px;
  right: 10px;
  top: -5px;
  height: 10px;
  cursor: n-resize;
  background: rgba(229, 154, 60, 0.3);
  border-radius: 4px;
  transition: background 0.15s ease;
}
.vs-resize-handle.vs-resize-n:hover {
  background: var(--accent-primary);
}

/* Drag Ghost & Guide Grid */
.vs-page-canvas.vs-is-dragging {
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: calc(100% / var(--canvas-cols, 12)) var(--canvas-row-h, 65px);
}

