/* MyAwesomeNovelz AI — Components: Editor, Cards, Forms, Modals, Canvas, Tour */

/* Story Editor Views */
.story-editor-container {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  height: calc(100vh - 130px);
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  transition: var(--theme-transition);
}

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.panel-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
}

/* Scene Tree / Graph List */
.scene-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.scene-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.scene-item:hover {
  border-color: var(--border-accent);
  background: rgba(139, 92, 246, 0.06);
}

.scene-item.active {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.14);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.2);
}

.scene-title {
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scene-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
}

/* Timeline / Dialogue Cards */
.timeline-flow {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialogue-node-card {
  background: rgba(20, 24, 38, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  position: relative;
  transition: all 0.2s ease;
}

.dialogue-node-card:hover {
  border-color: var(--border-accent);
}

.dialogue-node-card.dragging {
  opacity: 0.45;
  border: 2px dashed var(--primary-light) !important;
  transform: scale(0.98);
}

.dialogue-node-card.drag-over-above {
  border-top: 3px solid var(--accent-cyan) !important;
  box-shadow: 0 -4px 12px rgba(6, 182, 212, 0.4);
}

.dialogue-node-card.drag-over-below {
  border-bottom: 3px solid var(--accent-cyan) !important;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.dlg-drag-handle:hover {
  color: var(--primary-light) !important;
}

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.speaker-select {
  background: rgba(14, 17, 27, 0.9);
  border: 1px solid var(--border-color);
  color: var(--primary-light);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

.dialogue-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  resize: vertical;
  min-height: 60px;
}

.dialogue-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.choice-options {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.choice-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.choice-input {
  flex: 1;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
}

/* Ren'Py Script Code Preview */
.code-preview-box {
  background: #06070c;
  color: #a78bfa;
  font-family: var(--font-code);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 14px;
  border-radius: var(--radius-md);
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--border-color);
}

/* AI Studio Views Grid */
.studio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.asset-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-lg);
}

.asset-preview {
  height: 160px;
  background: rgba(10, 12, 20, 0.8);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-preview .character-img {
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

.asset-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 17, 26, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
}

.asset-details {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.asset-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.98rem;
}

.asset-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.expression-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* AI Generation Form Controls */
.ai-form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  transition: var(--theme-transition);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.form-label {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 0.86rem;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Live Simulator Frame */
.simulator-container {
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vn-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-accent);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(139, 92, 246, 0.2);
}

.vn-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: background-image 0.5s ease-in-out;
}

.vn-sprites {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 100px;
  pointer-events: none;
}

.vn-sprite {
  height: 85%;
  max-width: 45%;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.8));
  transition: all 0.3s ease;
}

.vn-textbox {
  position: absolute;
  bottom: 16px;
  left: 24px;
  right: 24px;
  background: rgba(10, 12, 22, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  cursor: pointer;
}

.vn-speaker {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--primary-light);
  text-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

.vn-text {
  font-size: 0.98rem;
  line-height: 1.5;
  color: #fff;
  min-height: 44px;
}

.vn-choices {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
  width: 60%;
}

.vn-choice-btn {
  background: rgba(18, 22, 38, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-accent);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.vn-choice-btn:hover {
  background: var(--grad-primary);
  border-color: transparent;
  transform: scale(1.02);
  box-shadow: var(--shadow-glow);
}

.sim-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.pricing-card.featured {
  border-color: var(--primary);
  background: rgba(22, 26, 44, 0.9);
  box-shadow: var(--shadow-glow);
}

.plan-badge {
  position: absolute;
  top: -10px;
  right: 16px;
  background: var(--grad-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

/* 🔥 Animated Shimmering "СКОРО / COMING SOON" Badge & Pulse Effects */
@keyframes soonGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes soonPulseGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.6), 0 0 16px rgba(236, 72, 153, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.9), 0 0 28px rgba(139, 92, 246, 0.8);
    transform: scale(1.04);
  }
}

@keyframes soonIconBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-2px) rotate(-10deg); }
  75% { transform: translateY(1px) rotate(10deg); }
}

.badge-soon, .badge-soon-glow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f59e0b, #ec4899, #8b5cf6, #f59e0b);
  background-size: 250% 250%;
  animation: soonGradientShift 3s ease infinite, soonPulseGlow 2s ease-in-out infinite;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 0.76rem !important;
  padding: 3px 10px !important;
  border-radius: 20px !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.4);
  letter-spacing: 0.4px;
}

.badge-soon i, .badge-soon .soon-icon {
  display: inline-block;
  animation: soonIconBounce 1.5s ease-in-out infinite;
}

.nav-item-soon {
  position: relative;
  overflow: hidden;
}

.nav-item-soon::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.25), transparent);
  animation: soonShimmer 2.5s infinite;
}

@keyframes soonShimmer {
  100% { left: 100%; }
}

.plan-price {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
}

.plan-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-muted);
}

.plan-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.plan-features li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-features li svg {
  color: var(--accent-emerald);
}

/* Node Map Visual Story Canvas Styling (Unreal Engine Blueprints Style) */
.node-canvas-viewport {
  width: 100%;
  height: calc(100vh - 130px);
  background-color: #0b0d16;
  background-image: 
    radial-gradient(rgba(139, 92, 246, 0.2) 1px, transparent 0),
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 0);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
  user-select: none;
  cursor: grab;
}

.canvas-transform-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

.node-svg-layer {
  position: absolute;
  inset: 0;
  width: 10000px !important;
  height: 10000px !important;
  overflow: visible !important;
  pointer-events: none;
  z-index: 2;
}

.connection-line {
  fill: none;
  stroke: var(--primary-light);
  stroke-width: 2.5px;
  stroke-dasharray: 6;
  animation: dash-flow 20s linear infinite;
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.6));
}

.active-wire-drag {
  stroke: var(--accent-cyan) !important;
  stroke-width: 3.5px !important;
  stroke-dasharray: 4 !important;
  filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.9)) !important;
}

@keyframes dash-flow {
  to {
    stroke-dashoffset: -100;
  }
}

.node-cards-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.node-card {
  position: absolute;
  width: 260px;
  background: rgba(20, 24, 38, 0.92);
  backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  z-index: 10;
}

.node-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.node-card.dragging {
  cursor: grabbing;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 25px rgba(6, 182, 212, 0.5);
}

.node-card-header {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
}

.node-card-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.node-card-body {
  padding: 12px;
}

.node-card-ports {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(10, 12, 20, 0.7);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 700;
}

.port {
  padding: 4px 10px;
  border-radius: 12px;
  cursor: crosshair;
  transition: all 0.2s ease;
  user-select: none;
}

.port-input {
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary-light);
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.port-input:hover {
  background: rgba(139, 92, 246, 0.4);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.6);
}

.port-output {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.4);
}

.port-output:hover {
  background: rgba(6, 182, 212, 0.4);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

/* Crystal Clear Transparent Tour Backdrop Overlay & Tooltip */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: transparent !important;
  backdrop-filter: none !important;
  z-index: 2000;
  display: none;
  pointer-events: none;
}

.tour-overlay.active {
  display: block;
}

.tour-tooltip-box {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 520px;
  background: rgba(15, 18, 30, 0.88) !important;
  backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(139, 92, 246, 0.7);
  border-radius: var(--radius-xl);
  padding: 18px 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 25px rgba(139, 92, 246, 0.4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  animation: float-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes float-up {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

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

.tour-step-badge {
  background: var(--grad-primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.tour-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
}

.tour-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tour-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* Collapsible Sidebar Styles */
.sidebar.collapsed {
  width: 68px !important;
  min-width: 68px !important;
  padding: 12px 6px !important;
}

.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .project-selector label,
.sidebar.collapsed .project-select-btn span,
.sidebar.collapsed .sidebar-menu li span:not(.sidebar-icon) {
  display: none !important;
}

.sidebar.collapsed .sidebar-menu li {
  justify-content: center !important;
  padding: 10px 0 !important;
  text-align: center !important;
  font-size: 1.1rem !important;
}

/* Nav Quick Pins */
.quick-pin-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-pin-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--border-accent);
}

/* Master Hub Sub-Tab Bar Styles */
.hub-subtabs-container {
  background: rgba(15, 17, 26, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 20px;
}

.hub-subtabs-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
}

.hub-title-badge {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary-light);
  white-space: nowrap;
  padding: 4px 10px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
}

.hub-pills-list {
  display: flex;
  gap: 6px;
  align-items: center;
}

.hub-pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.hub-pill-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #fff;
  border-color: var(--border-accent);
}

.hub-pill-btn.active {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
}
