@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');
@import url('./tokens.css');

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ========================================================
   MAIN APPLICATION LAYOUT & RESPONSIVE STRUCTURE
   ======================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Sidebar (Desktop & Mobile) */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 85;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

.brand-wrapper {
  height: var(--header-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: radial-gradient(circle at center, rgba(66, 122, 161, 0.22) 0%, rgba(15, 23, 42, 0.75) 100%);
  border: 1px solid rgba(105, 193, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(66, 122, 161, 0.25);
  flex-shrink: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.brand-wrapper:hover .brand-icon {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(105, 193, 255, 0.4);
}

.brand-title {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #ffffff;
  line-height: 1.2;
}

.brand-role-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.badge-root-role {
  background: var(--primary-light);
  color: #a5b4fc;
  border: 1px solid var(--primary-border);
}

.badge-cust-role {
  background: var(--emerald-light);
  color: #6ee7b7;
  border: 1px solid var(--emerald-border);
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  padding: 10px 10px 4px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.15s ease;
}

.nav-link svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
}

.nav-link:hover svg {
  color: #ffffff;
}

.nav-link.active {
  background: var(--primary-light);
  color: #ffffff;
  font-weight: 600;
  border: 1px solid var(--primary-border);
}

.nav-link.active svg {
  color: #a5b4fc;
}

.nav-badge {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  margin-left: auto;
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #ffffff;
  flex-shrink: 0;
}

.user-details {
  min-width: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status-text {
  font-size: 10.5px;
  color: var(--emerald);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Main Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  transition: margin-left 0.28s ease;
}

/* Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 40;
}

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

.mobile-menu-btn {
  display: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.breadcrumb-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-trail .active {
  color: var(--text-primary);
  font-weight: 600;
}

.page-body {
  padding: 24px;
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ========================================================
   CARDS & GRIDS
   ======================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.2px;
}

.card-title svg {
  color: var(--primary);
}

/* Grid System */
.grid {
  display: grid;
  gap: 16px;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-8 { grid-column: span 8 / span 8; }
.col-span-9 { grid-column: span 9 / span 9; }
.col-span-12 { grid-column: span 12 / span 12; }

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), transparent);
  opacity: 0.6;
}

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

.stat-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: #818cf8;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
  line-height: 1.1;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ========================================================
   FORMS & INPUTS
   ======================================================== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 13.5px;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.15s ease;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-dim);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: #0f141f;
  color: #ffffff;
}

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

.code-editor {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.6;
}

/* Custom File Upload Input */
.custom-file-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.custom-file-wrapper:hover {
  border-color: var(--border-hover);
}

.custom-file-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.custom-file-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  margin-right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.custom-file-text {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================================
   BUTTONS
   ======================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8.5px 15px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  outline: none;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-default);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
  color: #ffffff;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.12);
  border-color: var(--rose-border);
  color: #fb7185;
}

.btn-danger:hover:not(:disabled) {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}

.btn-success {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--emerald-border);
  color: #34d399;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-lg {
  padding: 11px 20px;
  font-size: 14px;
}

/* ========================================================
   WYSIWYG EMAIL STUDIO & TOOLBAR
   ======================================================== */
.wysiwyg-container {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.wysiwyg-toolbar {
  background: #111726;
  border-bottom: 1px solid var(--border-default);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.toolbar-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 5px 8px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s ease;
  line-height: 1;
}

.toolbar-btn svg {
  width: 14px;
  height: 14px;
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-default);
  color: #ffffff;
}

.toolbar-btn:active, .toolbar-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: #a5b4fc;
}

.toolbar-divider {
  width: 1px;
  height: 18px;
  background: var(--border-default);
  margin: 0 4px;
}

.editor-tab-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.editor-tab-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: #a5b4fc;
}

.tag-badge {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.tag-badge:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
  color: #ffffff;
}

/* Preset Cards */
.preset-card {
  padding: 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
}

.preset-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

.preset-card-title {
  font-weight: 700;
  color: #ffffff;
  font-size: 13px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.preset-card-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Device Preview Toggle */
.preview-device-btn {
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.preview-device-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* Drag & Drop File Area */
.file-dropzone {
  border: 2px dashed rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.03);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-dropzone:hover, .file-dropzone.drag-over {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

/* ========================================================
   TOAST NOTIFICATION ENGINE
   ======================================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: 100%;
}

.toast-item {
  pointer-events: auto;
  background: #0f1524;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.toast-item.toast-success { border-color: rgba(16, 185, 129, 0.35); }
.toast-item.toast-error { border-color: rgba(244, 63, 94, 0.35); }
.toast-item.toast-warning { border-color: rgba(245, 158, 11, 0.35); }
.toast-item.toast-info { border-color: rgba(99, 102, 241, 0.35); }

.toast-icon {
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  font-size: 13px;
  line-height: 1;
}

.toast-close:hover {
  color: #ffffff;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--primary);
  width: 100%;
  animation: toastProgress 4.5s linear forwards;
}

.toast-success .toast-progress { background: var(--emerald); }
.toast-error .toast-progress { background: var(--rose); }
.toast-warning .toast-progress { background: var(--amber); }

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

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

/* ========================================================
   TABLES & BADGES
   ======================================================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-default);
  letter-spacing: 0.6px;
}

.table td {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: var(--emerald-light); color: #34d399; border: 1px solid var(--emerald-border); }
.badge-danger { background: var(--rose-light); color: #fb7185; border: 1px solid var(--rose-border); }
.badge-warning { background: var(--amber-light); color: #fbbf24; border: 1px solid var(--amber-border); }
.badge-primary { background: var(--primary-light); color: #a5b4fc; border: 1px solid var(--primary-border); }

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  width: 0%;
  transition: width 0.25s ease;
  border-radius: var(--radius-full);
}

/* Terminal Output */
.terminal-output {
  background: #060911;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  color: #38bdf8;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.5;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-body {
  padding: 18px;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: var(--emerald-light);
  border: 1px solid var(--emerald-border);
  color: #34d399;
}

.alert-error {
  background: var(--rose-light);
  border: 1px solid var(--rose-border);
  color: #fb7185;
}

.alert-warning {
  background: var(--amber-light);
  border: 1px solid var(--amber-border);
  color: #fbbf24;
}

/* ========================================================
   MOBILE RESPONSIVE BREAKPOINTS (TABLET & SMARTPHONE)
   ======================================================== */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-cols-3 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .col-span-4, .col-span-8, .col-span-6, .col-span-9 {
    grid-column: span 12 / span 12;
  }
}

@media (max-width: 768px) {
  .page-body {
    padding: 14px;
  }

  .top-header {
    padding: 0 14px;
  }

  .card {
    padding: 16px;
  }

  .grid-cols-2 {
    grid-template-columns: 1fr;
  }

  .grid-cols-4 {
    grid-template-columns: 1fr;
  }

  .toast-container {
    left: 14px;
    right: 14px;
    top: 14px;
    max-width: none;
  }
}


/* ========================================================
   WORLD-CLASS DRAG & DROP EMAIL BUILDER STUDIO
   ======================================================== */
.builder-topbar {
  background: #0d1322;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.builder-container {
  display: grid;
  grid-template-columns: 290px 1fr 310px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1350px) {
  .builder-container {
    grid-template-columns: 270px 1fr;
  }
  .builder-sidebar-right {
    grid-column: span 2;
  }
}

@media (max-width: 960px) {
  .builder-container {
    grid-template-columns: 1fr;
  }
  .builder-sidebar-right {
    grid-column: span 1;
  }
}

/* Sidebar Panels */
.builder-panel {
  background: #0d1322;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.builder-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Builder Tabs (Left Sidebar: Bileşenler vs Hazır Şablonlar) */
.builder-tab-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.builder-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.builder-tab-btn.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

/* Scrollable Container for Left Sidebar Tabs */
.builder-sidebar-scroll {
  max-height: calc(100vh - 240px);
  min-height: 480px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain !important;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) rgba(0, 0, 0, 0.2);
}

.builder-sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}
.builder-sidebar-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}
.builder-sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 4px;
}
.builder-sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background: #6366f1;
}

/* Draggable Block Cards in Sidebar */
.draggable-block-item {
  background: #151d30;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  user-select: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  color: #e2e8f0;
}

.draggable-block-item:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: #6366f1;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.draggable-block-item:active {
  cursor: grabbing;
  opacity: 0.7;
}

.draggable-block-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.draggable-block-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a5b4fc;
  flex-shrink: 0;
}

.draggable-block-item:hover .draggable-block-icon {
  background: #6366f1;
  color: #ffffff;
}

.draggable-block-title {
  font-size: 12.5px;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}

.draggable-block-desc {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.draggable-block-add-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.draggable-block-item:hover .draggable-block-add-btn {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

/* Preset Mini Cards in Sidebar */
.preset-mini-card {
  background: #151d30;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.preset-mini-card:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.preset-mini-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.preset-mini-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.35;
}

/* Main Canvas Stage */
.builder-stage {
  background: #080c14;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.builder-stage-header {
  background: #0f172a;
  border-bottom: 1px solid var(--border-default);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-stage-body {
  padding: 24px 16px;
  min-height: 560px;
  background: #070a12;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.builder-stage-viewport {
  width: 100%;
  max-width: 620px;
  background: #0b0f19;
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  min-height: 520px;
  padding: 0;
  overflow: hidden;
  transition: max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.builder-stage-viewport.mobile-view {
  max-width: 375px;
}

/* Canvas Drop Zones & Blocks */
.email-canvas {
  min-height: 520px;
  outline: none;
  color: #1e293b;
  font-family: Arial, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  padding: 0;
  background: transparent;
}

.email-block {
  position: relative;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
  border: none;
  margin: 0;
  padding: 0;
}

.email-block:hover {
  outline: 2px dashed #6366f1;
  outline-offset: -2px;
}

.email-block.selected {
  outline: 2px solid #4f46e5 !important;
  outline-offset: -2px;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}
  outline: 2px solid #4f46e5 !important;
  outline-offset: -2px;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.selected-canvas-el {
  outline: 2px solid #6366f1 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5) !important;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
}

/* Floating Actions Bar on Hover */
.block-actions-bar {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 6px;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  z-index: 20;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.email-block:hover > .block-actions-bar {
  display: flex;
}

.block-action-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.12s ease;
}

.block-action-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

.block-action-btn.delete-btn:hover {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.2);
}

/* Animated Drag Over Insertion Indicator */
.drop-zone-indicator {
  height: 4px;
  background: #38bdf8;
  border-radius: 2px;
  margin: 4px 0;
  display: none;
  box-shadow: 0 0 12px #38bdf8;
  animation: pulseDrop 0.8s infinite alternate;
}

.drop-zone-indicator.active {
  display: block;
}

@keyframes pulseDrop {
  from { opacity: 0.6; transform: scaleY(1); }
  to { opacity: 1; transform: scaleY(1.8); }
}

/* Right Property Inspector */
.inspector-card {
  background: #0d1322;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.inspector-empty-state {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-dim);
  font-size: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.color-swatch-list {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.color-swatch-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-swatch-btn:hover {
  transform: scale(1.2);
}

.color-swatch-btn.active {
  border-color: #ffffff;
  transform: scale(1.15);
}

/* Spam Health Meter & Checklist */
.spam-meter-card {
  background: #0d1322;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.spam-score-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.spam-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11.5px;
  margin-bottom: 8px;
  line-height: 1.4;
}

.spam-check-icon {
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: -1px;
}



