/* CCW Core Styles - /includes/ccw-core.css */
/* Blue theme - distinct from production green */

:root {
  --bg: #0a1628;
  --sidebar-bg: #050d1a;
  --card: #0f1d32;
  --border: #1e3a5f;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --accent-glow: rgba(59, 130, 246, 0.4);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow: hidden; height: 100%; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: 220px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar-header { padding: 1.25rem 1rem; border-bottom: 1px solid var(--border); }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: white;
  box-shadow: 0 0 20px var(--accent-glow);
}

.logo-text { display: flex; flex-direction: column; }
.logo-title { font-size: 0.9rem; font-weight: 600; }
.logo-subtitle { font-size: 0.65rem; color: var(--accent); }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow: hidden; }
.nav-section { margin-bottom: 1.5rem; }

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 500;
}

.nav-icon { width: 18px; text-align: center; font-size: 0.9rem; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

/* ========== MAIN WRAPPER ========== */
.main-wrapper {
  flex: 1;
  margin-left: 220px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== COMPANY BAR (Row 1: 100% width) ========== */
.company-bar {
  background: #020617;
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.company-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.company-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.demo-badge {
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.demo-notice {
  font-size: 0.7rem;
  color: white;
  font-weight: 400;
}

/* ========== MAIN HEADER (Row 2: Product - Page Title) ========== */
.main-header {
  padding: 0.6rem 1.5rem;
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
}

.product-name {
  color: var(--accent);
  font-weight: 600;
}

.title-sep {
  color: var(--muted);
  font-weight: 300;
}

.page-name {
  color: var(--text);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.25rem;
}

.demo-btn {
  background: var(--accent);
  border: none;
  color: white;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.demo-btn:hover {
  background: var(--accent-light);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========== DEMO BANNER (Row 2) ========== */
.demo-banner {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.demo-badge {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

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

/* ========== CONTENT HEADER (Row 3) ========== */
.content-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.content-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-name {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.content-divider {
  color: var(--muted);
}

.content-title {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mode-badge {
  font-size: 0.75rem;
  color: var(--muted);
}

/* ========== MAIN CONTENT ========== */
.main-content {
  flex: 1;
  overflow-y: auto;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 1.5rem;
}

.main-content::-webkit-scrollbar { display: none; }

/* Content container for consistent max-width */
.content-container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ========== MODALS ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

.modal.active { display: flex; align-items: center; justify-content: center; }

.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-content.modal-sm { max-width: 450px; }

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

.modal-header h2 { font-size: 1rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Modal content styling */
.modal-body h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem 0;
}

.modal-body h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.5rem 0 0.75rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-body h2:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.modal-body h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 1rem 0 0.5rem 0;
}

.modal-body p {
  margin: 0 0 0.75rem 0;
  color: var(--muted);
}

.modal-body ul {
  margin: 0.5rem 0 1rem 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.modal-body li {
  margin-bottom: 0.4rem;
}

.modal-body strong {
  color: var(--text);
}

.modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}

.modal-body td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.modal-body td:first-child {
  color: var(--text);
  width: 120px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ========== BUTTONS ========== */
.btn {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

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

/* ========== DEMO OVERLAY ========== */
.demo-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 500;
  pointer-events: none;
}

.demo-overlay.active {
  display: block;
  pointer-events: auto;
}

.demo-popup {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--card);
  border: 2px solid var(--accent);
  border-radius: 12px;
  width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px var(--accent-glow);
  pointer-events: auto;
}

.demo-popup-header {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
}

.demo-step-badge { font-size: 0.75rem; color: var(--accent); font-weight: 600; }

.demo-running-badge {
  font-size: 0.7rem;
  color: var(--danger);
  font-weight: 600;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.demo-popup-body { padding: 1rem; font-size: 0.9rem; line-height: 1.5; }

.demo-popup-footer {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

/* ========== TOOLTIPS ========== */
[data-tooltip] { position: relative; }

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 8px;
}

/* ========== DEMO LIST ========== */
.demo-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.demo-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.demo-item:hover, .demo-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.demo-item input[type="radio"] { display: none; }

.demo-item-radio {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-item.selected .demo-item-radio { border-color: var(--accent); }

.demo-item.selected .demo-item-radio::after {
  content: "";
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

.demo-item-info { flex: 1; }
.demo-item-name { font-weight: 500; font-size: 0.9rem; }
.demo-item-desc { font-size: 0.75rem; color: var(--muted); }

.demo-options { padding-top: 1rem; border-top: 1px solid var(--border); }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ========== DEMO HIGHLIGHT ========== */
.demo-highlight {
  outline: 3px solid var(--accent) !important;
  outline-offset: 4px;
  animation: highlight-pulse 1s infinite;
}

@keyframes highlight-pulse {
  0%, 100% { outline-color: var(--accent); }
  50% { outline-color: var(--accent-light); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .logo-text, .nav-section-title, .sidebar-footer { display: none; }
  .nav-link { justify-content: center; padding: 0.75rem; }
  .nav-link span:not(.nav-icon) { display: none; }
  .main-wrapper { margin-left: 60px; }
  .demo-overlay { left: 60px; }
  .demo-popup { width: calc(100% - 2rem); right: 1rem; }
}
