/* Mankiwave Pro Modern UI Enhancement Suite */
:root {
  --mw-primary: #00a884;
  --mw-primary-dark: #008069;
  --mw-primary-light: #25d366;
  --mw-bg-glass: rgba(255, 255, 255, 0.92);
  --mw-bg-glass-dark: rgba(22, 27, 34, 0.95);
  --mw-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --mw-accent-gold: #f59e0b;
  --mw-danger: #ef4444;
  --mw-success: #10b981;
}

/* Floating Status Widget (Disabled in favor of native sidebar menu) */
#mw-floating-widget {
  display: none !important;
}

/* Built-in Full-Page Native CRM View */
#mw-native-app-root {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  padding: 24px 28px;
  margin-bottom: 24px;
  min-height: calc(100vh - 180px);
  width: 100%;
  box-sizing: border-box;
  font-family: Inter, -apple-system, sans-serif;
  animation: mw-fade-in 0.25s ease-out;
}

@keyframes mw-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.mw-native-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  margin-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
}

.mw-native-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mw-native-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 4px 0 0;
}

.mw-native-nav-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-bottom: 24px;
}

.mw-native-nav-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.mw-native-nav-btn:hover:not(.active) {
  background: #e2e8f0;
  color: #0f172a;
}

.mw-native-nav-btn.active {
  background: var(--mw-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.25);
}

.mw-native-content-body {
  width: 100%;
}

.mw-status-pulse {
  width: 10px;
  height: 10px;
  background-color: var(--mw-success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: mw-pulse 2s infinite;
}

@keyframes mw-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.mw-badge-counter {
  background: #fef3c7;
  color: #b45309;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

/* Modal Overlay & Container */
.mw-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  font-family: Inter, -apple-system, sans-serif;
}

.mw-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mw-modal-card {
  background: #ffffff;
  width: 92%;
  max-width: 850px;
  max-height: 88vh;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.mw-modal-overlay.active .mw-modal-card {
  transform: scale(1);
}

/* Modal Header */
.mw-modal-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, #008069 0%, #00a884 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mw-modal-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mw-modal-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.mw-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* Tabs Navigation */
.mw-tabs-bar {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 16px;
  overflow-x: auto;
}

.mw-tab-btn {
  padding: 14px 18px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.mw-tab-btn.active {
  color: var(--mw-primary-dark);
  border-bottom-color: var(--mw-primary);
  background: rgba(0, 168, 132, 0.04);
}

/* Modal Body */
.mw-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  color: #1e293b;
}

/* Health Score Panel */
.mw-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.mw-stat-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.mw-stat-box h4 {
  margin: 0 0 6px 0;
  font-size: 12px;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
}

.mw-stat-box .mw-stat-val {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

/* Variable Chips */
.mw-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.mw-chip-btn {
  background: #e6f7f2;
  color: #008069;
  border: 1px solid #a7f3d0;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.mw-chip-btn:hover {
  background: #00a884;
  color: #ffffff;
}

/* Live WhatsApp Preview Bubble */
.mw-wa-preview-card {
  background: #efeae2;
  background-image: radial-gradient(#d1d7db 1px, transparent 1px);
  background-size: 16px 16px;
  border-radius: 14px;
  padding: 18px;
  margin-top: 14px;
  border: 1px solid #d1d7db;
}

.mw-wa-bubble {
  background: #d9fdd3;
  color: #111b21;
  padding: 10px 14px;
  border-radius: 8px 8px 0px 8px;
  max-width: 82%;
  margin-left: auto;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
  position: relative;
  word-break: break-word;
}

.mw-wa-time {
  float: right;
  font-size: 11px;
  color: #667781;
  margin-left: 8px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* Form Controls */
.mw-form-group {
  margin-bottom: 18px;
}

.mw-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.mw-input, .mw-textarea, .mw-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.mw-input:focus, .mw-textarea:focus, .mw-select:focus {
  outline: none;
  border-color: var(--mw-primary);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.15);
}

.mw-btn-primary {
  background: var(--mw-primary);
  color: #ffffff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mw-btn-primary:hover {
  background: var(--mw-primary-dark);
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.35);
}

.mw-btn-outline {
  background: transparent;
  color: var(--mw-primary-dark);
  border: 1.5px solid var(--mw-primary);
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mw-btn-outline:hover {
  background: rgba(0, 168, 132, 0.08);
}

/* Toggle Switch */
.mw-switch-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 14px;
}

.mw-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.mw-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mw-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.mw-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .mw-slider {
  background-color: var(--mw-primary);
}

input:checked + .mw-slider:before {
  transform: translateX(20px);
}

/* Command Palette (Ctrl+K) */
.mw-command-palette {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 580px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  z-index: 100001;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.mw-cmd-input {
  width: 100%;
  padding: 16px 20px;
  border: none;
  border-bottom: 1px solid #e2e8f0;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

.mw-cmd-list {
  max-height: 320px;
  overflow-y: auto;
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.mw-cmd-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.mw-cmd-item:hover {
  background: #f1f5f9;
  color: var(--mw-primary-dark);
}

/* Template Library & Sheet Lead Studio Styles */
.mw-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.mw-tpl-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.mw-tpl-card:hover {
  transform: translateY(-2px);
  border-color: var(--mw-primary);
  box-shadow: 0 8px 18px rgba(0, 168, 132, 0.12);
}

.mw-tpl-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.mw-cat-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: #e6f4ea;
  color: #137333;
  white-space: nowrap;
}

.mw-tpl-preview {
  font-size: 12px;
  color: #334155;
  background: #f8fafc;
  padding: 10px;
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 110px;
  overflow-y: auto;
  border: 1px solid #edf2f7;
  line-height: 1.45;
  margin: 10px 0;
}

.mw-cat-pills-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.mw-cat-pill {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.mw-cat-pill:hover, .mw-cat-pill.active {
  background: var(--mw-primary);
  color: #ffffff;
}

.mw-code-box {
  background: #0f172a;
  color: #38bdf8;
  padding: 14px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-x: auto;
  position: relative;
  max-height: 220px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.mw-copy-code-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.mw-copy-code-btn:hover {
  background: rgba(255,255,255,0.35);
}

.mw-lead-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-top: 12px;
}

.mw-lead-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid #e2e8f0;
}

.mw-lead-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
}

