/**
 * Te Preparo - Content Studio Stylesheet
 * High-End Dark Glassmorphic Design System for Content Editor
 */

:root {
  --bg-main: #060912;
  --bg-surface: #0b1120;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-input: rgba(7, 12, 23, 0.85);
  --bg-hover: rgba(30, 41, 59, 0.6);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(6, 182, 212, 0.5);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --cyan: #06b6d4;
  --cyan-hover: #0891b2;
  --emerald: #10b981;
  --amber: #f59e0b;
  --purple: #8b5cf6;
  --danger: #ef4444;
  --danger-hover: #dc2626;

  --sidebar-width: 520px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.25);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.editor-body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   1. TOP HEADER BAR
   ========================================================================== */
.editor-header {
  height: var(--header-height);
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.header-logo .logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}

.logo-title-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text .highlight {
  color: var(--cyan);
}

.badge-studio {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.header-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.editor-location-tag {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-location-tag i {
  color: var(--cyan);
}

/* Center device controls */
.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-switcher {
  display: flex;
  background: rgba(7, 12, 23, 0.9);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

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

.device-btn:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.device-btn.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-action-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.icon-action-btn:hover {
  color: var(--text-main);
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.1);
}

/* Header Right Actions */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  transition: all 0.3s ease;
}

.status-dot.dirty {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}

.btn-group-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn {
  font-family: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 0.95rem;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.7);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
  color: var(--text-main);
  border-color: var(--border-medium);
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--cyan);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-publish {
  position: relative;
  overflow: hidden;
}

.btn-publish.saving {
  pointer-events: none;
  opacity: 0.85;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.user-avatar-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  font-size: 0.82rem;
  transition: color 0.2s;
}

.btn-logout:hover {
  color: var(--danger);
}

/* ==========================================================================
   2. MAIN WORKSPACE LAYOUT
   ========================================================================== */
.editor-workspace {
  flex: 1;
  display: flex;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
  position: relative;
}

/* LEFT SIDEBAR */
.editor-sidebar {
  width: var(--sidebar-width);
  min-width: 440px;
  max-width: 650px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  flex-shrink: 0;
  z-index: 10;
}

/* Navigation Tabs */
.sidebar-tabs {
  display: flex;
  background: rgba(7, 12, 23, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  padding: 6px 8px;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  flex-shrink: 0;
}

.sidebar-tabs::-webkit-scrollbar {
  height: 4px;
}

.sidebar-tabs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.tab-item {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.tab-item:hover {
  color: var(--text-main);
  background: var(--bg-hover);
}

.tab-item.active {
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.25);
}

/* Scrollable Form Area */
.sidebar-forms {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar-forms::-webkit-scrollbar {
  width: 6px;
}

.sidebar-forms::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-header {
  margin-bottom: 20px;
}

.panel-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Form Cards */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.card-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.card-section-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -8px;
  margin-bottom: 14px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text-main);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
  background: rgba(11, 19, 36, 0.95);
}

textarea.form-control {
  resize: vertical;
  min-height: 70px;
  line-height: 1.45;
}

.highlight-input {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.05);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.field-hint {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.field-counter {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 4px;
}

.input-with-upload {
  display: flex;
  gap: 8px;
}

.btn-upload {
  flex-shrink: 0;
  padding: 8px 14px;
  font-size: 0.82rem;
}

.metric-editor-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-editor-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.metric-editor-row .form-group {
  margin-bottom: 0;
}

/* Info Callout Card */
.info-card-callout {
  display: flex;
  gap: 14px;
  background: rgba(6, 182, 212, 0.06);
  border-color: rgba(6, 182, 212, 0.25);
}

.callout-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-body strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.callout-body p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.mt-2 { margin-top: 8px; }
.w-100 { width: 100%; }
.d-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

/* Accordions for FAQs and Courses */
.faq-item-card, .course-item-card {
  background: rgba(7, 12, 23, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.faq-item-card:hover, .course-item-card:hover {
  border-color: var(--border-medium);
}

.faq-card-header, .course-card-header {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.86rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.4);
}

.faq-card-header:hover, .course-card-header:hover {
  background: rgba(30, 41, 59, 0.5);
}

.faq-card-body, .course-card-body {
  padding: 14px;
  border-top: 1px solid var(--border-subtle);
  display: none;
}

.faq-item-card.open .faq-card-body,
.course-item-card.open .course-card-body {
  display: block;
}

.btn-remove-item {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.82rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-remove-item:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   3. RIGHT PANEL: INTERACTIVE LIVE PREVIEW
   ========================================================================== */
.editor-preview-pane {
  flex: 1;
  background: #03050a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.preview-toolbar {
  height: 40px;
  background: rgba(11, 17, 32, 0.7);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 0.75rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.preview-address-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.url-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan);
  letter-spacing: 0.5px;
}

.preview-viewport-wrapper {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.6) 0%, #03050a 100%);
}

.preview-device-frame {
  width: 100%;
  height: 100%;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--border-subtle);
  position: relative;
}

.preview-device-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Device Viewports */
.preview-device-frame.desktop {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
}

.preview-device-frame.tablet {
  width: 768px;
  height: 96%;
  border-radius: 24px;
  border: 12px solid #1e293b;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.preview-device-frame.mobile {
  width: 390px;
  height: 96%;
  border-radius: 36px;
  border: 12px solid #1e293b;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   4. MODALS & AUTH OVERLAYS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog-box {
  width: 100%;
  max-width: 440px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.auth-header {
  margin-bottom: 24px;
}

.auth-logo {
  width: 52px;
  height: 52px;
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px rgba(6, 182, 212, 0.4));
}

.auth-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.auth-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.auth-form {
  text-align: left;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap i {
  position: absolute;
  left: 12px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.input-wrap .form-control {
  padding-left: 36px;
}

.auth-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.modal-icon-alert {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.modal-dialog-box h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.modal-dialog-box p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions-group {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ==========================================================================
   5. TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.toast {
  min-width: 280px;
  max-width: 400px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-main);
  font-size: 0.86rem;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
}

.toast.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
}
.toast.toast-success i {
  color: var(--emerald);
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
}
.toast.toast-error i {
  color: var(--danger);
}

.toast.toast-info {
  border-color: rgba(6, 182, 212, 0.4);
}
.toast.toast-info i {
  color: var(--cyan);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   6. RESPONSIVENESS
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 420px;
  }
}

@media (max-width: 768px) {
  .editor-workspace {
    flex-direction: column;
  }
  .editor-sidebar {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    height: 50vh;
  }
  .editor-preview-pane {
    height: 50vh;
  }
}
