/* =========================================================
   AI SKI — Interactive Demo Window (AI SKI Live Playground)
   TheMadHacker LLC
   A fully-featured, click-through mock of the real platform.
   ========================================================= */

/* ---------- Demo Section Layout ---------- */
.demo-section { padding: 120px 24px; position: relative; }
.demo-head { max-width: 760px; margin: 0 auto 40px; text-align: center; }
.demo-head h2 { font-size: clamp(2rem, 5vw, 3.2rem); }
.demo-head p { color: var(--text-dim); font-size: 1.15rem; margin-top: 14px; }
.demo-lead { color: var(--text-dim); font-size: 1.05rem; max-width: 640px; margin: 0 auto 44px; text-align: center; }

.demo-shell {
  max-width: 1180px; margin: 0 auto;
  border-radius: 22px; overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), 0 0 0 1px rgba(129,140,248,0.08), var(--shadow-glow);
  background: var(--bg-2);
  position: relative;
}
.demo-shell::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(900px 400px at 20% -10%, rgba(56,189,248,0.10), transparent 60%);
}

/* Toolbar (browser chrome) */
.demo-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.demo-dots { display: flex; gap: 7px; }
.demo-dots span { width: 12px; height: 12px; border-radius: 50%; }
.demo-dots span:nth-child(1) { background: #ff5f57; }
.demo-dots span:nth-child(2) { background: #febc2e; }
.demo-dots span:nth-child(3) { background: #28c840; }
.demo-url {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.25); border-radius: 9px; padding: 6px 14px;
  font-size: 0.82rem; color: var(--text-dim); max-width: 520px; margin: 0 auto;
}
.demo-url .lock { color: var(--emerald); }
.demo-url b { color: var(--text); font-weight: 600; }

/* App body */
.demo-app { display: grid; grid-template-columns: 232px 1fr; min-height: 560px; }

/* Sidebar */
.demo-side {
  background: rgba(0,0,0,0.22); border-right: 1px solid var(--border);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
}
.demo-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.demo-brand .db-logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--grad); font-family: 'Sora'; font-weight: 800; color: #06121f; font-size: 1rem;
}
.demo-brand .db-name { font-family: 'Sora'; font-weight: 700; font-size: 1rem; }
.demo-brand .db-sub { font-size: 0.62rem; color: var(--text-faint); letter-spacing: 0.12em; text-transform: uppercase; }

.demo-resort {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 12px; border: 1px solid var(--border); margin-bottom: 16px;
  background: rgba(255,255,255,0.02);
}
.demo-resort .dr-thumb {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, #38bdf8, #818cf8); display: grid; place-items: center;
}
.demo-resort .dr-name { font-size: 0.82rem; font-weight: 600; }
.demo-resort .dr-tag { font-size: 0.68rem; color: var(--emerald); }

.demo-nav-label { font-size: 0.66rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.14em; padding: 10px 12px 6px; }
.demo-nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 10px; font-size: 0.88rem; color: var(--text-dim); cursor: pointer;
  transition: 0.25s; border: 1px solid transparent; position: relative;
}
.demo-nav-item .nav-ico { font-size: 1.05rem; width: 20px; text-align: center; }
.demo-nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.demo-nav-item.active {
  background: rgba(129,140,248,0.12); color: #fff; border-color: rgba(129,140,248,0.3);
}
.demo-nav-item.active::before {
  content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 22px; border-radius: 3px; background: var(--grad);
}
.demo-nav-item .nav-badge {
  margin-left: auto; font-size: 0.62rem; padding: 2px 7px; border-radius: 999px;
  background: rgba(232,121,249,0.18); color: var(--pink); font-weight: 600;
}
.demo-side-foot { margin-top: auto; padding: 14px 8px; border-top: 1px solid var(--border); }
.demo-user { display: flex; align-items: center; gap: 10px; }
.demo-user .au {
  width: 32px; height: 32px; border-radius: 50%; background: var(--grad);
  display: grid; place-items: center; color: #06121f; font-weight: 700; font-size: 0.85rem;
}
.demo-user .au-name { font-size: 0.82rem; font-weight: 600; }
.demo-user .au-role { font-size: 0.66rem; color: var(--text-faint); }

/* Main content */
.demo-main { display: flex; flex-direction: column; overflow: hidden; }
.demo-topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 26px;
  border-bottom: 1px solid var(--border);
}
.demo-topbar .dt-title { font-family: 'Sora'; font-size: 1.1rem; font-weight: 700; }
.demo-topbar .dt-sub { font-size: 0.76rem; color: var(--text-faint); }
.demo-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 999px;
  padding: 8px 16px; font-size: 0.82rem; color: var(--text-dim); min-width: 220px;
}
.demo-search .ai-pill {
  margin-left: auto; font-size: 0.7rem; padding: 3px 10px; border-radius: 999px;
  background: var(--grad); color: #06121f; font-weight: 700;
}
.demo-notif { position: relative; cursor: pointer; font-size: 1.1rem; }
.demo-notif .nb {
  position: absolute; top: -3px; right: -4px; width: 9px; height: 9px; border-radius: 50%;
  background: #ff5f57; border: 2px solid var(--bg-2);
}

/* Demo content pane */
.demo-pane { padding: 26px; overflow-y: auto; flex: 1; }
.demo-pane::-webkit-scrollbar { width: 8px; }
.demo-pane::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; }

.demo-grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.ds-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 18px;
  transition: transform 0.3s, border-color 0.3s;
}
.ds-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.ds-label { font-size: 0.72rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.ds-num { font-family: 'Sora'; font-size: 1.9rem; font-weight: 800; margin: 6px 0 4px; }
.ds-delta { font-size: 0.78rem; font-weight: 600; }
.ds-delta.up { color: var(--emerald); }
.ds-delta.down { color: #ff7b7b; }
.ds-spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin-top: 12px; }
.ds-spark i { flex: 1; background: var(--grad); border-radius: 3px 3px 0 0; opacity: 0.8; }

.demo-panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px; margin-bottom: 18px;
}
.demo-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.demo-panel-head h3 { font-size: 1rem; }
.demo-panel-head .dp-hint { font-size: 0.76rem; color: var(--text-faint); }

/* Bar chart */
.chart-wrap { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart-bar .bar-fill {
  width: 100%; border-radius: 6px 6px 0 0; background: var(--grad); position: relative;
  transition: height 0.8s var(--ease); min-height: 4px;
}
.chart-bar .bar-fill::after {
  content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
  border-radius: 6px 6px 0 0; opacity: 0; transition: opacity 0.3s;
}
.chart-bar .bar-fill:hover::after { opacity: 1; }
.chart-bar .bar-label { font-size: 0.66rem; color: var(--text-faint); }
.chart-bar .bar-val { font-size: 0.68rem; color: var(--text-dim); font-weight: 600; }

/* Lift chair grid */
.lift-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.lift-chair {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer;
  transition: 0.3s; background: rgba(0,0,0,0.15);
}
.lift-chair:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.lift-chair .lc-name { font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.lift-chair .lc-status { font-size: 0.66rem; padding: 2px 8px; border-radius: 999px; }
.lift-chair .lc-status.open { background: rgba(52,211,153,0.15); color: var(--emerald); }
.lift-chair .lc-status.closed { background: rgba(255,95,87,0.15); color: #ff7b7b; }
.lift-chair .lc-status.maint { background: rgba(251,191,36,0.15); color: #febc2e; }
.lift-chair .lc-wait { font-size: 1.3rem; font-weight: 800; margin: 10px 0 4px; }
.lift-chair .lc-label { font-size: 0.68rem; color: var(--text-faint); }
.lift-chair.hot { border-color: rgba(232,121,249,0.4); }

/* Staffing table */
.staff-table { width: 100%; border-collapse: collapse; }
.staff-table th { font-size: 0.68rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.staff-table td { padding: 11px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.85rem; }
.staff-table tr:hover td { background: rgba(255,255,255,0.02); }
.staff-table .role-tag { font-size: 0.72rem; padding: 3px 9px; border-radius: 999px; background: rgba(129,140,248,0.12); color: var(--indigo); }
.staff-table .coverage { font-weight: 600; }
.staff-table .coverage.good { color: var(--emerald); }
.staff-table .coverage.warn { color: #febc2e; }
.staff-table .coverage.bad { color: #ff7b7b; }
.toggle {
  position: relative; width: 42px; height: 22px; border-radius: 999px; background: rgba(255,255,255,0.12);
  cursor: pointer; transition: background 0.3s; flex-shrink: 0;
}
.toggle.on { background: var(--grad); }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.3s;
}
.toggle.on::after { transform: translateX(20px); }

/* Event cards */
.event-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.ev-card {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer;
  transition: 0.3s; background: rgba(0,0,0,0.15);
}
.ev-card:hover { transform: translateY(-5px); border-color: var(--border-strong); box-shadow: var(--shadow-glow); }
.ev-thumb { height: 90px; position: relative; }
.ev-thumb .ev-date {
  position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  padding: 4px 9px; border-radius: 8px; font-size: 0.68rem; font-weight: 700;
}
.ev-body { padding: 14px; }
.ev-body h4 { font-size: 0.95rem; margin-bottom: 6px; }
.ev-body .ev-meta { font-size: 0.74rem; color: var(--text-faint); display: flex; gap: 12px; }
.ev-body .ev-revenue { font-size: 0.74rem; color: var(--emerald); margin-top: 8px; font-weight: 600; }

/* Ad engine */
.ad-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.ad-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: rgba(0,0,0,0.15); }
.ad-card .ad-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }
.ad-metric-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.8rem; border-bottom: 1px solid rgba(255,255,255,0.04); }
.ad-metric-row:last-child { border-bottom: none; }
.ad-metric-row .am-val { font-weight: 700; }
.progress-mini { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 8px; }
.progress-mini i { display: block; height: 100%; background: var(--grad); border-radius: 4px; }

/* Booking / pricing calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-cell {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-size: 0.72rem; position: relative; border: 1px solid transparent;
}
.cal-cell .cday { font-weight: 600; font-size: 0.8rem; }
.cal-cell .cprice { font-size: 0.62rem; color: var(--text-dim); }
.cal-cell.peak { background: rgba(232,121,249,0.15); border-color: rgba(232,121,249,0.3); }
.cal-cell.normal { background: rgba(56,189,248,0.08); }
.cal-cell.off { background: rgba(255,255,255,0.03); color: var(--text-faint); }
.cal-cell.today { border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(129,140,248,0.2); }
.cal-legend { display: flex; gap: 18px; margin-top: 14px; font-size: 0.72rem; color: var(--text-faint); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Facilities monitor */
.fac-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.fac-cell { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: rgba(0,0,0,0.15); }
.fac-cell .fc-icon { font-size: 1.6rem; margin-bottom: 8px; }
.fac-cell .fc-label { font-size: 0.72rem; color: var(--text-faint); }
.fac-cell .fc-val { font-family: 'Sora'; font-size: 1.5rem; font-weight: 700; }
.fac-cell .fc-bar { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 10px; }
.fac-cell .fc-bar i { display: block; height: 100%; background: var(--grad); }
.fac-cell .fc-bar.warn i { background: #febc2e; }
.fac-cell .fc-bar.good i { background: var(--emerald); }

/* AI assistant panel */
.ai-panel {
  position: fixed; right: -420px; top: 0; bottom: 0; width: 400px; max-width: 92vw;
  background: var(--bg-2); border-left: 1px solid var(--border-strong);
  display: flex; flex-direction: column; z-index: 2000; transition: right 0.45s var(--ease);
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.ai-panel.open { right: 0; }
.ai-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1999; opacity: 0; pointer-events: none; transition: opacity 0.4s; }
.ai-backdrop.show { opacity: 1; pointer-events: auto; }
.ai-head { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.ai-head .ai-avatar {
  width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center;
  font-size: 1.2rem; position: relative;
}
.ai-head .ai-avatar .ai-pulse { position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--emerald); border: 2px solid var(--bg-2); }
.ai-head .ai-title { font-family: 'Sora'; font-weight: 700; }
.ai-head .ai-sub { font-size: 0.72rem; color: var(--emerald); }
.ai-close { margin-left: auto; background: none; border: none; color: var(--text-dim); font-size: 1.4rem; cursor: pointer; }
.ai-close:hover { color: #fff; }

.ai-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ai-msg { display: flex; gap: 10px; max-width: 92%; }
.ai-msg.ai { align-self: flex-start; }
.ai-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.ai-msg .msg-ava { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; font-size: 0.85rem; }
.ai-msg.ai .msg-ava { background: var(--grad); }
.ai-msg.user .msg-ava { background: rgba(255,255,255,0.1); }
.ai-msg .msg-bubble { padding: 12px 14px; border-radius: 14px; font-size: 0.88rem; line-height: 1.5; }
.ai-msg.ai .msg-bubble { background: var(--panel); border: 1px solid var(--border); border-top-left-radius: 4px; }
.ai-msg.user .msg-bubble { background: rgba(129,140,248,0.15); border: 1px solid rgba(129,140,248,0.3); border-top-right-radius: 4px; }
.ai-msg .msg-bubble .typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--indigo); margin-right: 3px; animation: aiType 1.2s infinite; }
.ai-msg .msg-bubble .typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-msg .msg-bubble .typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiType { 0%,100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

.ai-sugg { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }
.ai-sugg button {
  font-size: 0.76rem; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-dim); cursor: pointer; transition: 0.25s;
}
.ai-sugg button:hover { background: rgba(129,140,248,0.12); color: #fff; border-color: var(--indigo); }

.ai-input { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.ai-input input {
  flex: 1; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 999px;
  padding: 11px 18px; color: var(--text); font-size: 0.88rem; font-family: inherit;
}
.ai-input input:focus { outline: none; border-color: var(--indigo); }
.ai-input button {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--grad);
  color: #06121f; font-size: 1.1rem; cursor: pointer; flex-shrink: 0; transition: transform 0.3s;
}
.ai-input button:hover { transform: scale(1.08); }

/* Floating AI FAB */
.ai-fab {
  position: fixed; right: 28px; bottom: 28px; width: 58px; height: 58px; border-radius: 50%;
  background: var(--grad); display: grid; place-items: center; cursor: pointer; z-index: 1900;
  box-shadow: 0 8px 30px rgba(129,140,248,0.5); transition: transform 0.3s; border: none;
}
.ai-fab:hover { transform: scale(1.1) rotate(6deg); }
.ai-fab .fab-ico { font-size: 1.5rem; }
.ai-fab .fab-ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid rgba(129,140,248,0.4); animation: fabRing 2s infinite; }
@keyframes fabRing { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }

/* Demo CTA */
.demo-cta { max-width: 820px; margin: 56px auto 0; text-align: center; }
.demo-cta h3 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 14px; }
.demo-cta p { color: var(--text-dim); margin-bottom: 26px; font-size: 1.1rem; }

/* Responsive */
@media (max-width: 1024px) {
  .demo-app { grid-template-columns: 1fr; }
  .demo-side { display: none; }
  .demo-grid-stats { grid-template-columns: repeat(2, 1fr); }
  .lift-grid, .fac-grid { grid-template-columns: repeat(2, 1fr); }
  .event-cards { grid-template-columns: 1fr; }
  .ad-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .demo-section { padding: 70px 14px; }
  .demo-grid-stats { grid-template-columns: 1fr; }
  .demo-toolbar { padding: 10px 12px; }
  .demo-search { display: none; }
  .demo-pane { padding: 16px; }
  .lift-grid, .fac-grid { grid-template-columns: 1fr; }
}

/* Reveal for demo children */
.demo-children [data-demo-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.demo-children [data-demo-reveal].in { opacity: 1; transform: none; }
