/* -------------------------------------------------------------
 * SUPERX MAIL MARKETING PLATFORM - STYLESHEET
 * Premium, Glassmorphic, Modern SaaS Aesthetic (Zinc & Orange)
 * ------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  --bg-primary: #09090b;
  --bg-secondary: #121214;
  --bg-card: #1c1c1f;
  --border-muted: #2e2e33;
  --border-active: #3e3e46;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent-color: #ea580c;
  --accent-hover: #f97316;
  --accent-glow: rgba(234, 88, 12, 0.15);
  --success-color: #10b981;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-title: 'Outfit', sans-serif;
  --font-mono: 'Fira Code', monospace;
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-active);
}

/* Header bar */
header {
  height: 64px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-title);
  box-shadow: 0 0 15px var(--accent-glow);
}

.logo-text {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 0.7rem;
  background-color: var(--border-muted);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-active);
  font-weight: 500;
}

.actions-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  font-family: var(--font-sans);
}

.btn-primary {
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: 0 1px 2px var(--accent-glow);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-muted);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-active);
  transform: translateY(-1px);
}

.btn-icon-only {
  padding: 8px;
  border-radius: 6px;
  aspect-ratio: 1;
}

/* Layout Main Workspace */
.workspace-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar Editor Panel */
.sidebar {
  width: 420px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-muted);
  background-color: rgba(9, 9, 11, 0.3);
  padding: 0 12px;
}

.sidebar-tab {
  padding: 14px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-tab:hover {
  color: var(--text-primary);
}

.sidebar-tab.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}

.editor-section-title {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.form-label span.optional {
  color: var(--text-muted);
  font-weight: 400;
}

.form-input, .form-textarea, .form-select {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

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

/* Color Picker Container */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-primary);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-muted);
}

.color-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.color-input::-webkit-color-swatch {
  border-radius: 6px;
  border: 1px solid var(--border-active);
}

.color-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-primary);
  text-transform: uppercase;
}

/* Preview Area */
.preview-container {
  flex: 1;
  background-color: #0f0f11;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.preview-toolbar {
  height: 52px;
  border-bottom: 1px solid var(--border-muted);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.preview-title {
  font-family: var(--font-title);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.viewport-selectors {
  display: flex;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-muted);
  padding: 3px;
  border-radius: 8px;
}

.viewport-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewport-btn:hover {
  color: var(--text-primary);
}

.viewport-btn.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-muted);
  box-shadow: var(--shadow-sm);
}

/* Canvas Area */
.canvas-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background-image: radial-gradient(var(--border-muted) 1px, transparent 1px);
  background-size: 24px 24px;
}

.preview-canvas {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 680px; /* Default desktop */
  height: 800px;
  transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
}

.preview-canvas.mobile-view {
  max-width: 375px;
  height: 667px;
}

.browser-mock-header {
  background-color: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 20px;
  font-size: 0.75rem;
  color: #4b5563;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.mock-label {
  font-weight: 600;
  width: 50px;
  color: #9ca3af;
}

.mock-value {
  color: #1f2937;
  font-weight: 500;
}

/* Interactive Preview IFrame */
.preview-iframe {
  width: 100%;
  flex: 1;
  border: none;
  background-color: #ffffff;
}

/* Collapsible HTML Inspector Panel */
.code-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 320px;
  background-color: #0b0b0d;
  border-top: 1px solid var(--border-muted);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 15;
}

.code-panel.open {
  transform: translateY(0);
}

.code-panel-header {
  height: 48px;
  border-bottom: 1px solid var(--border-muted);
  background-color: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.code-panel-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-editor-container {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
}

.code-editor-textarea {
  width: 100%;
  height: 100%;
  background-color: #09090b;
  color: #34d399; /* Green coding font color */
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 16px;
  border: none;
  resize: none;
  outline: none;
  line-height: 1.5;
  overflow-y: auto;
}

/* Terminal Modal Overlay */
.terminal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.terminal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.terminal-box {
  width: 550px;
  background-color: #0b0b0d;
  border: 1px solid var(--border-active);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.terminal-overlay.active .terminal-box {
  transform: scale(1);
}

.terminal-header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-muted);
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.terminal-controls {
  display: flex;
  gap: 8px;
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background-color: #ef4444; cursor: pointer; }
.dot-yellow { background-color: #eab308; }
.dot-green { background-color: #22c55e; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.terminal-body {
  padding: 24px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8; /* light blue console look */
  min-height: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 350px;
  overflow-y: auto;
}

.terminal-line {
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.terminal-prompt {
  color: var(--accent-color);
  font-weight: 600;
  user-select: none;
}

.terminal-text {
  color: var(--text-primary);
}

.terminal-text.success {
  color: var(--success-color);
}

.terminal-text.info {
  color: #38bdf8;
}

.terminal-text.warning {
  color: #fbbf24;
}

.terminal-loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Feature grid items on settings panel */
.cards-editor-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background-color: var(--bg-card);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border-muted);
}

.card-editor-item {
  border-bottom: 1px solid var(--border-muted);
  padding-bottom: 14px;
}

.card-editor-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.card-editor-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-editor-title span {
  font-size: 0.75rem;
  color: var(--accent-color);
}

/* Responsive Styles for the Dashboard Editor itself */
@media (max-width: 1024px) {
  .workspace-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: 400px;
    border-right: none;
    border-bottom: 1px solid var(--border-muted);
  }
  .canvas-wrapper {
    padding: 20px;
  }
}
