.email-addon-container {
  display: flex;
  gap: 20px;
  height: calc(100vh - 200px);
  flex-wrap: nowrap;
  overflow: hidden;
}

.email-addon-sidebar {
  width: 220px;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  align-self: flex-start;
}

.email-addon-sidebar button {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
}

.email-addon-sidebar button.active,
.email-addon-sidebar button:hover {
  background: rgba(74, 85, 104, 0.1);
  color: #1a202c;
}

.email-addon-content {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 7px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  min-width: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}

.email-addon-tab {
  display: none;
}

.email-addon-tab.active {
  display: block;
}

.email-addon-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.email-addon-header .email-account-selector {
  display: flex;
  gap: 8px;
  align-items: center;
}

.email-addon-header select {
  min-width: 240px;
}

.email-account-select {
  min-width: 240px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  background: #fff;
  color: #1f2937;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.email-account-select:focus {
  border-color: #3182ce;
  box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.15);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal .modal-content {
  background: #fff;
  border-radius: 12px;
  width: 92%;
  max-width: 1145px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.modal .modal-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.modal .modal-body {
  padding: 16px;
}

.modal .modal-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
  position: sticky;
  bottom: 0;
  background: #fff;
}

.modal .modal-footer .btn {
  position: relative;
  margin: 0;
  min-width: 110px;
}

.template-modal {
  width: 91vw;
  max-width: none;
  height: 91vh;
}

.template-modal .modal-body {
  padding: 0;
}

/* New Template Modal Styles */
.template-modal-new {
  width: 95vw;
  max-width: none;
  height: 95vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.modal-header-new {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  gap: 16px;
}

.template-name-input {
  flex: 1;
  max-width: 400px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
  background: #f8fafc;
}

.template-name-input:focus {
  outline: none;
  border-color: #3182ce;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body-new {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  flex: 1;
  overflow: hidden;
  background: #f8fafc;
}

.template-modal-new.blocks-collapsed .modal-body-new {
  grid-template-columns: 0 1fr 320px;
}

.template-modal-new.blocks-collapsed .email-template-blocks-new {
  width: 0;
  padding: 0;
  overflow: hidden;
}

/* Botão flutuante para reabrir o painel */
.reopen-blocks-btn {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 21px;
  height: 35px;
  background: #d3d3d3;
  color: rgb(0, 0, 0);
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 2px 0 12px rgba(49, 130, 206, 0.3);
  transition: all 0.2s ease;
}

.reopen-blocks-btn:hover {
  background: #2c5aa0;
  width: 45px;
  box-shadow: 2px 0 16px rgba(49, 130, 206, 0.5);
}

.template-modal-new {
  position: relative;
}

.template-modal-new.blocks-collapsed .reopen-blocks-btn {
  display: flex;
}

.template-modal-new.blocks-collapsed .email-blocks-collapse {
  display: none;
}

.email-template-blocks-new {
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: all 0.3s ease;
}

.email-blocks-header {
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.email-blocks-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.email-blocks-collapse {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.email-blocks-collapse:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

.template-modal-new.blocks-collapsed .email-blocks-collapse i {
  transform: rotate(180deg);
}

.email-blocks-title strong {
  font-size: 16px;
  color: #1a202c;
  display: block;
  margin-bottom: 4px;
}

.email-blocks-title p {
  font-size: 12px;
  color: #718096;
  margin: 0;
}

.email-template-canvas-new {
  background: #f8fafc;
  overflow: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.email-template-properties {
  background: #ffffff;
  border-left: 1px solid #e2e8f0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.template-properties-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 15px;
  font-weight: 700;
  color: #1a202c;
  background: #ffffff;
  position: sticky;
  top: 0;
  z-index: 2;
}

.template-properties-body {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.template-properties-empty {
  text-align: center;
  color: #a0aec0;
  font-size: 13px;
  padding: 30px 10px;
  border: 1px dashed #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.template-properties-info {
  padding: 12px 16px;
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  border-radius: 8px;
  color: #2c5282;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.template-properties-info i {
  color: #3182ce;
  font-size: 16px;
}

.template-properties-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-properties-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.template-properties-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.template-properties-field label {
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
}

.template-properties-input,
.template-properties-select,
.template-properties-textarea {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #1a202c;
  background: #f8fafc;
  transition: all 0.2s ease;
}

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

.template-properties-input:focus,
.template-properties-select:focus,
.template-properties-textarea:focus {
  outline: none;
  border-color: #3182ce;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.template-properties-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.template-properties-action {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-properties-button {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #1a202c;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.template-properties-button:hover {
  border-color: #cbd5e0;
  background: #edf2f7;
}

.template-properties-hint {
  font-size: 12px;
  color: #a0aec0;
}

.canvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.canvas-title strong {
  font-size: 16px;
  color: #1a202c;
  font-weight: 600;
}

.canvas-actions {
  display: flex;
  gap: 8px;
}

.canvas-device-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #718096;
  font-size: 16px;
  transition: all 0.2s ease;
}

.canvas-device-btn:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
  color: #4a5568;
}

.canvas-device-btn.active {
  background: #3182ce;
  border-color: #3182ce;
  color: #ffffff;
}

.email-template-canvas-new .gjs-cv-canvas {
  background: #f8fafc;
  padding: 40px 20px;
  flex: 1;
}

.email-template-canvas-new .gjs-frame {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  background: #ffffff;
  margin: 0 auto;
  max-width: 720px;
  transition: max-width 0.3s ease;
}

.canvas-empty-placeholder {
  text-align: center;
  padding: 80px 20px;
  color: #a0aec0;
  font-size: 14px;
  font-weight: 500;
}

/* Block Items Styling */
.gjs-block-category {
  padding: 16px 20px 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #718096 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  background: transparent !important;
  border: 0 !important;
}

.gjs-block {
  padding: 0 20px 12px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  width: 100% !important;
  min-height: auto !important;
}

.email-block-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  width: 100% !important;
}

.email-block-item:hover {
  background: #edf2f7 !important;
  border-color: #cbd5e0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  transform: translateY(-1px) !important;
}

.email-block-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #3182ce !important;
  font-size: 16px !important;
  flex-shrink: 0 !important;
}

.email-block-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  flex: 1 !important;
  min-width: 0 !important;
}

.email-block-text strong {
  font-size: 14px !important;
  color: #1a202c !important;
  font-weight: 600 !important;
}

.email-block-text span {
  font-size: 12px !important;
  color: #718096 !important;
}

/* Canvas Toolbar Styling */
.gjs-toolbar {
  background: #1a202c;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gjs-toolbar-item {
  background: transparent;
  border: 0;
  color: #ffffff;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gjs-toolbar-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Template List Grid */
.email-template-list {
  border: 0;
  border-radius: 0;
  padding: 20px;
  background: #f8fafc;
  overflow-y: auto;
  min-height: 400px;
}

.email-template-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #718096;
}

.email-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Template List (Templates Tab) */
.email-template-list .email-template-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-template-list .email-template-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.email-template-list .email-template-card.active {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.email-template-list .email-template-preview {
  width: 100%;
  height: 160px;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.email-template-list .email-template-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.email-template-info {
  flex: 1;
}

.email-template-title {
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
  margin-bottom: 4px;
}

.email-template-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.email-template-edit,
.email-template-delete {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#emailTemplateEditorCanvas {
  height: 100%;
  width: 100%;
}

/* GrapesJS Custom Styling */
.gjs-one-bg,
#emailTemplateEditorCanvas .gjs-one-bg {
  background: #ffffff !important;
}

.gjs-two-color,
#emailTemplateEditorCanvas .gjs-two-color {
  color: #1a202c !important;
}

.gjs-three-bg,
#emailTemplateEditorCanvas .gjs-three-bg {
  background: #f8fafc !important;
}

.gjs-four-color,
#emailTemplateEditorCanvas .gjs-four-color {
  color: #3182ce !important;
}

.gjs-pn-panels,
.gjs-pn-panel,
.gjs-pn-views-container,
.gjs-pn-commands,
.gjs-pn-options,
.gjs-pn-views {
  display: none !important;
}

.gjs-cv-canvas {
  background: #f8fafc !important;
  top: 0 !important;
}

.gjs-field {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
}

.gjs-field:focus {
  border-color: #3182ce !important;
  outline: none !important;
}

/* Force hide all GrapesJS default panels */
.gjs-pn-panel {
  display: none !important;
}

.gjs-pn-views-container {
  display: none !important;
}

/* Ensure blocks container is visible */
#emailTemplateBlocks .gjs-blocks-c {
  display: block !important;
  background: transparent !important;
  padding: 0 !important;
}

/* Hide default block labels, we use custom ones */
#emailTemplateBlocks .gjs-block-label {
  display: none !important;
}

.email-addon-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.email-addon-table th,
.email-addon-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  word-break: break-word;
}

.email-inbox-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  height: calc(100vh - 280px);
  overflow: hidden;
}

.email-inbox-layout:not(.is-reading) {
  grid-template-columns: 1fr;
}

.email-inbox-layout:not(.is-reading) .email-inbox-message {
  display: none;
}

.email-inbox-layout.is-reading .email-inbox-list {
  display: none;
}

.email-inbox-layout.is-reading .email-inbox-message {
  grid-column: 1 / -1;
}

.email-inbox-list {
  border: 1px solid #edf2f7;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

#emailInboxList {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.email-inbox-message {
  overflow-y: auto;
  overflow-x: hidden;
}

.email-inbox-table .email-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.email-inbox-table .email-row:hover,
.email-inbox-table .email-row.active {
  background: rgba(74, 85, 104, 0.1);
}

.email-inbox-message {
  min-height: 520px;
  width: 100%;
}

.email-inbox-empty {
  border: 1px dashed #cbd5f0;
  border-radius: 12px;
  text-align: center;
  background: #f8fafc;
}

.email-inbox-empty-title {
  font-weight: 600;
  margin-bottom: 8px;
  color: #1a202c;
}

.email-message-card {
  border: 1px solid #edf2f7;
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
  width: 100%;
}

.email-message-toolbar {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.email-message-meta {
  display: grid;
  gap: 6px;
  color: #1f2937;
}

.email-message-title {
  font-weight: 700;
  font-size: 18px;
  color: #1f2937;
  margin-bottom: 12px;
}

.email-message-card .email-body {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #edf2f7;
  max-height: 420px;
  overflow: auto;
  text-align: left;
}

.email-message-card .email-body-content {
  margin-top: 12px;
  width: 100%;
}

.email-body-iframe {
  width: 100%;
  border: 0;
  display: block;
  min-height: 320px;
}

.email-body-text {
  white-space: pre-wrap;
  color: #1f2937;
}

.email-message-footer {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.email-reply-composer {
  margin-top: 16px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.email-reply-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.email-reply-title {
  font-weight: 600;
  color: #1f2937;
}

.email-reply-hint {
  font-size: 12px;
  color: #718096;
}

.email-reply-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.email-reply-toolbar-bottom {
  justify-content: flex-end;
}

.email-reply-toolbar-divider {
  width: 1px;
  height: 24px;
  background: #e2e8f0;
}

.email-reply-editor {
  min-height: 180px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
  outline: none;
}

.email-reply-attach-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.email-reply-editor:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
}

.email-reply-attachments {
  display: grid;
  gap: 8px;
}

.email-attachment-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.email-attachment-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.email-attachment-info img {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.email-attachment-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.email-attachment-name {
  font-weight: 600;
  color: #1f2937;
}

.email-attachment-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.email-addon-message {
  border: 1px solid #edf2f7;
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  background: #f8fafc;
}

.email-addon-message .email-body {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #edf2f7;
  max-height: 420px;
  overflow: auto;
}

.email-addon-reply {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.email-addon-split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 600px;
}

.email-editor-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.email-marketing-form {
  display: grid;
  gap: 12px;
  max-width: 720px;
}

.email-marketing-form textarea {
  min-height: 120px;
}

.email-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.email-settings-card {
  padding: 12px;
  border: 1px solid #edf2f7;
  border-radius: 10px;
}

.email-account-list {
  display: grid;
  gap: 10px;
}

.email-account-card {
  padding: 12px;
  border: 1px solid #edf2f7;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.email-small {
  font-size: 12px;
  color: #718096;
}

.email-addon-pagination {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.email-pagination-tabs {
  justify-content: flex-start;
  margin-top: 0;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.email-addon-pagination button {
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.email-pagination-tabs button {
  border-radius: 8px 8px 0 0;
  border-bottom-width: 2px;
}

.email-addon-pagination button.active {
  background: #2b6cb0;
  color: #fff;
  border-color: #2b6cb0;
}

.email-pagination-tabs button.active {
  background: #ebf4ff;
  color: #2b6cb0;
}

@media (max-width: 1200px) {
  .email-addon-container {
    flex-direction: column;
  }

  .email-addon-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .email-addon-split {
    grid-template-columns: 1fr;
  }

  .email-inbox-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .email-addon-header {
    align-items: flex-start;
  }

  .email-addon-header .email-account-selector {
    flex-direction: column;
    align-items: flex-start;
  }

  .email-addon-header select {
    width: 100%;
  }

  .email-addon-table th,
  .email-addon-table td {
    padding: 8px;
  }

  .email-inbox-list {
    padding: 8px;
  }

  .email-reply-editor {
    min-height: 140px;
  }
}


/* Simple Blocks Styling */
.blocks-category {
  padding: 16px 20px 8px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  color: #718096 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
}

.block-item {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
  margin: 0 20px 12px !important;
  cursor: grab !important;
  transition: all 0.2s ease !important;
}

.block-item:active {
  cursor: grabbing !important;
}

.block-item.dragging {
  opacity: 0.5 !important;
  transform: scale(0.95) !important;
}

.block-item:hover {
  background: #edf2f7 !important;
  border-color: #cbd5e0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
  transform: translateY(-1px) !important;
}

.block-icon {
  width: 40px !important;
  height: 40px !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: #3182ce !important;
  font-size: 16px !important;
  flex-shrink: 0 !important;
}

.block-text {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  flex: 1 !important;
}

.block-text strong {
  font-size: 14px !important;
  color: #1a202c !important;
  font-weight: 600 !important;
}

.block-text span {
  font-size: 12px !important;
  color: #718096 !important;
}

/* Canvas Content Area */
.canvas-content-area {
  flex: 1;
  overflow: auto;
  background: #f8fafc;
  padding: 20px;
}


/* Campaign Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge.status-pending {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.status-sending {
  background-color: #dbeafe;
  color: #1e40af;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-badge.status-completed {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.status-failed {
  background-color: #fee2e2;
  color: #991b1b;
}

.status-badge.status-cancelled {
  background-color: #f3f4f6;
  color: #6b7280;
}

.status-badge.status-scheduled {
  background-color: #e0e7ff;
  color: #3730a3;
}

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


/* Campaign Details Styles */
.email-campaigns-table tbody tr {
  transition: background-color 0.2s;
}

.email-campaigns-table tbody tr:hover {
  background-color: #f7fafc;
}

.email-campaign-details {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.email-campaign-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #f7fafc;
  border-radius: 8px;
}

.email-campaign-info-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.email-campaign-info-row label {
  font-weight: 600;
  min-width: 140px;
  color: #4a5568;
}

.email-campaign-info-row span {
  flex: 1;
  color: #2d3748;
}

.email-campaign-recipients h4 {
  margin-bottom: 12px;
  color: #2d3748;
}

.email-recipients-table-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.email-recipients-table-container table {
  margin: 0;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.status-scheduled {
  background: #bee3f8;
  color: #2c5282;
}

.status-badge.status-sending {
  background: #feebc8;
  color: #7c2d12;
}

.status-badge.status-completed {
  background: #c6f6d5;
  color: #22543d;
}

.status-badge.status-failed {
  background: #fed7d7;
  color: #742a2a;
}

.status-badge.status-cancelled {
  background: #e2e8f0;
  color: #4a5568;
}

.status-badge.status-pending {
  background: #e6fffa;
  color: #234e52;
}

.status-badge.status-sent {
  background: #c6f6d5;
  color: #22543d;
}

/* Modal improvements */
.modal-content {
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f7fafc;
}


/* Marketing Campaign Modal Styles */
.email-campaign-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.email-campaign-modal-content {
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.email-campaign-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.email-campaign-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1a202c;
}

.email-campaign-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  gap: 8px;
  flex-wrap: wrap;
}

.email-campaign-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 80px;
}

.email-campaign-step .step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #718096;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.3s ease;
}

.email-campaign-step .step-label {
  font-size: 12px;
  color: #718096;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

.email-campaign-step.active .step-number {
  background: #3182ce;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.2);
}

.email-campaign-step.active .step-label {
  color: #3182ce;
  font-weight: 600;
}

.email-campaign-step.completed .step-number {
  background: #48bb78;
  color: #ffffff;
}

.email-campaign-step.completed .step-label {
  color: #48bb78;
}

.email-campaign-step-line {
  width: 40px;
  height: 2px;
  background: #e2e8f0;
  margin-top: -20px;
}

.email-campaign-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 300px;
  max-height: calc(90vh - 300px);
}

.email-campaign-step-content {
  display: none !important;
}

.email-campaign-step-content.active {
  display: block !important;
}

.email-campaign-step-content h4 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a202c;
}

.email-campaign-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 70px;
}

.email-recipient-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.email-recipient-group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.email-recipient-group-item:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

.email-recipient-group-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.email-recipient-group-item .group-count {
  margin-left: auto;
  font-size: 12px;
  color: #718096;
  font-weight: 500;
}

.email-recipient-summary {
  padding: 16px;
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.email-recipient-summary strong {
  color: #2c5282;
}

.email-recipient-summary span {
  color: #2c5282;
  font-weight: 600;
  font-size: 16px;
}

.email-template-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  max-height: 450px;
  overflow-y: auto;
  padding: 8px;
}

/* Template Selector (Campaign Modal) */
.email-template-selector .email-template-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  height: 240px;
}

.email-template-selector .email-template-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.email-template-selector .email-template-card.selected {
  border-color: #3182ce;
  box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.15);
}

.template-card-preview {
  width: 100%;
  height: 150px;
  background: #f8fafc;
  overflow: hidden;
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
}

.template-card-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  display: block;
  background: #ffffff;
}

.template-card-info {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.template-card-info h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1a202c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-info .btn {
  width: 100%;
  margin-top: auto;
  padding: 8px 16px;
  font-weight: 600;
}


.email-template-card:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.email-template-card.selected {
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.template-card-preview {
  height: 140px;
  overflow: hidden;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.template-card-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  display: block;
}

.template-card-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.template-card-info h5 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-info .btn {
  width: 100%;
  margin-top: auto;
}

/* Removed duplicate .email-template-preview styles - using the one in template card section */

.email-campaign-review {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 700px;
}

.review-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.review-item strong {
  color: #718096;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.review-item span {
  color: #1a202c;
  font-size: 15px;
  font-weight: 500;
}

/* Contacts Tab Styles */
.email-contacts-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 20px;
  min-height: 500px;
}

.email-contacts-sidebar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
}

.email-contacts-sidebar h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #1a202c;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.email-contact-groups-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.email-contact-group {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.email-contact-group:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
}

.email-contact-group.active {
  background: #ebf8ff;
  border-color: #3182ce;
  color: #2c5282;
}

.email-contact-group i {
  color: #718096;
  font-size: 14px;
}

.email-contact-group.active i {
  color: #3182ce;
}

.email-contact-group .group-count {
  margin-left: auto;
  font-size: 12px;
  color: #718096;
  background: #f8fafc;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.email-contact-group.active .group-count {
  background: #bee3f8;
  color: #2c5282;
}

.email-contacts-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.email-contacts-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.email-contacts-header input {
  flex: 1;
}

.email-contacts-list {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .email-campaign-steps {
    overflow-x: auto;
    justify-content: flex-start;
  }
  
  .email-template-selector {
    grid-template-columns: 1fr;
  }
  
  .email-contacts-layout {
    grid-template-columns: 1fr;
  }
  
  .email-contacts-sidebar {
    max-height: 300px;
    overflow-y: auto;
  }
}


/* Recipients Tabs Styles */
.email-recipients-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}

.email-recipients-tab {
  padding: 12px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #718096;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.email-recipients-tab:hover {
  color: #4a5568;
  background: #f8fafc;
}

.email-recipients-tab.active {
  color: #3182ce;
  border-bottom-color: #3182ce;
  background: #ebf8ff;
}

.email-recipients-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.email-recipients-tab-content.active {
  display: block;
}

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

/* Contacts Selection List */
.email-contacts-search-box {
  margin-bottom: 16px;
}

.email-contacts-search-box input {
  width: 100%;
}

.email-contacts-selection-list,
.email-groups-selection-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.email-contacts-checkboxes,
.email-groups-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.email-contact-checkbox-item,
.email-group-checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.email-contact-checkbox-item:hover,
.email-group-checkbox-item:hover {
  background: #edf2f7;
  border-color: #cbd5e0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.email-contact-checkbox-item input[type="checkbox"],
.email-group-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.email-contact-checkbox-item input[type="checkbox"]:checked,
.email-group-checkbox-item input[type="checkbox"]:checked {
  accent-color: #3182ce;
}

.contact-info,
.group-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.contact-name,
.group-name {
  font-weight: 600;
  color: #1a202c;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-email {
  font-size: 13px;
  color: #718096;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  font-size: 12px;
  color: #718096;
  background: #f8fafc;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.group-name i {
  color: #3182ce;
  font-size: 14px;
}

/* Scrollbar styling for selection lists */
.email-contacts-selection-list::-webkit-scrollbar,
.email-groups-selection-list::-webkit-scrollbar {
  width: 8px;
}

.email-contacts-selection-list::-webkit-scrollbar-track,
.email-groups-selection-list::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.email-contacts-selection-list::-webkit-scrollbar-thumb,
.email-groups-selection-list::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.email-contacts-selection-list::-webkit-scrollbar-thumb:hover,
.email-groups-selection-list::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .email-recipients-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .email-recipients-tab {
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .email-contacts-selection-list,
  .email-groups-selection-list {
    max-height: 300px;
  }
  
  .contact-info,
  .group-info {
    font-size: 13px;
  }
}


/* Template Step Layout Improvements */
.email-campaign-step-content[data-step-content="4"] {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.email-campaign-step-content[data-step-content="4"] h4 {
  margin: 0 0 16px 0;
}

.email-campaign-step-content[data-step-content="4"] .email-template-selector {
  flex-shrink: 0;
}

/* Form Groups Styling */
.email-campaign-step-content .form-group {
  margin-bottom: 20px;
}

.email-campaign-step-content .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #1a202c;
  font-size: 14px;
}

.email-campaign-step-content .form-group input[type="radio"] {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.email-campaign-step-content .form-group label:has(input[type="radio"]) {
  display: flex;
  align-items: center;
  font-weight: 500;
  cursor: pointer;
  padding: 16px 20px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.email-campaign-step-content .form-group label:has(input[type="radio"]:checked) {
  background: #ebf8ff;
  border-color: #3182ce;
  color: #1a202c;
}

.email-campaign-step-content .form-group label:has(input[type="radio"]):hover {
  border-color: #3182ce;
  background: #f7fafc;
}

/* Scrollbar for template selector */
.email-template-selector::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.email-template-selector::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.email-template-selector::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.email-template-selector::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Loading state */
.email-template-selector p.email-small {
  text-align: center;
  padding: 40px 20px;
  color: #718096;
}
