.email-app{
  max-width:1450px;
  margin:28px auto;
  padding:0 20px
}

.email-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:24px;
  margin-bottom:24px
}

.email-kicker{
  color:#6c4cff;
  font-weight:900;
  letter-spacing:1px;
  direction:ltr;
  text-align:right
}

.email-header h1{
  margin:7px 0
}

.email-header p{
  color:#64748b
}

.email-header-actions{
  display:flex;
  gap:10px
}

.email-link-button,
.email-primary,
.email-danger{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:auto;
  padding:11px 16px;
  border-radius:10px;
  text-decoration:none;
  font-weight:800
}

.email-primary{
  background:#6c4cff!important;
  color:#fff!important;
  border-color:#6c4cff!important
}

.email-danger{
  background:#dc2626!important;
  color:#fff!important;
  border-color:#dc2626!important
}

.email-link-button{
  background:#fff;
  border:1px solid #dce3ee;
  color:#172033
}

.email-stats{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:20px
}

.email-stat{
  background:#fff;
  padding:20px;
  border:1px solid #dce3ee;
  border-radius:15px;
  box-shadow:0 6px 20px rgba(20,35,60,.05)
}

.email-stat strong{
  display:block;
  font-size:28px;
  margin-top:6px
}

.email-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:15px
}

.email-tabs button{
  width:auto;
  border:1px solid #dce3ee;
  background:#fff
}

.email-tabs button.active{
  color:#fff;
  background:#172033;
  border-color:#172033
}

.email-panel{
  background:#fff;
  border:1px solid #dce3ee;
  border-radius:16px;
  padding:22px;
  box-shadow:0 8px 24px rgba(20,35,60,.06)
}

.email-panel-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:18px
}

.email-panel-title h2{
  margin:0
}

.email-panel-title select,
.email-panel-title button{
  width:auto
}

.email-row{
  display:flex;
  gap:10px;
  margin-bottom:14px
}

.email-row input{
  flex:1
}

.email-row button{
  width:auto
}

.template-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px
}

.template-card{
  border:1px solid #e2e8f0;
  border-radius:14px;
  overflow:hidden;
  background:#fff
}

.template-preview{
  height:190px;
  overflow:hidden;
  border-bottom:1px solid #e2e8f0;
  background:#f8fafc
}

.template-preview iframe{
  width:200%;
  height:380px;
  transform:scale(.5);
  transform-origin:top right;
  border:0
}

.template-info{
  padding:14px
}

.template-info h3{
  margin:0 0 6px
}

.template-info button{
  margin-top:10px
}

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

.email-table th,
.email-table td{
  padding:11px;
  border-bottom:1px solid #eef2f6;
  text-align:right
}

.editor-top-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
  margin-bottom:14px
}

.editor-top-grid label{
  margin:0
}

.word-toolbar{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:6px;
  padding:10px;
  border:1px solid #dce3ee;
  border-radius:12px 12px 0 0;
  background:#f8fafc
}

.word-toolbar button,
.word-toolbar select,
.word-toolbar input{
  width:auto;
  min-width:42px
}

.word-toolbar input[type=color]{
  padding:3px;
  height:39px
}

.editor-layout{
  display:grid;
  grid-template-columns:1fr 520px;
  gap:18px
}

.email-editor{
  direction:rtl;
  min-height:600px;
  padding:34px;
  outline:none;
  border:1px solid #dce3ee;
  border-top:0;
  background:#fff;
  line-height:1.9
}

.preview-column{
  border:1px solid #dce3ee;
  border-radius:12px;
  padding:12px;
  background:#f3f6fb
}

.preview-switch{
  display:flex;
  gap:8px;
  margin-bottom:10px
}

.preview-switch button{
  width:auto
}

.preview-switch button.active{
  background:#172033;
  color:#fff
}

#emailPreview{
  display:block;
  width:100%;
  min-height:610px;
  margin:auto;
  border:0;
  background:#fff;
  border-radius:10px
}

#emailPreview.mobile{
  width:390px
}

.editor-actions{
  margin-top:15px;
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px
}

.editor-actions input,
.editor-actions button{
  width:auto
}

#emailMessage{
  margin-top:12px;
  font-weight:800
}

.campaign-card,
.list-card{
  padding:14px;
  margin-top:10px;
  border:1px solid #e2e8f0;
  border-radius:12px
}

@media(max-width:1100px){
  .template-grid{
    grid-template-columns:repeat(2,1fr)
  }

  .editor-layout{
    grid-template-columns:1fr
  }

  .editor-top-grid{
    grid-template-columns:repeat(2,1fr)
  }
}

@media(max-width:700px){
  .email-header{
    flex-direction:column
  }

  .email-stats{
    grid-template-columns:repeat(2,1fr)
  }

  .template-grid{
    grid-template-columns:1fr
  }

  .editor-top-grid{
    grid-template-columns:1fr
  }

  .email-row{
    flex-direction:column
  }

  .email-row button{
    width:100%
  }
}

/* =========================================================
   DUBORA EMAIL MARKETING — PREMIUM THEME
   Yellow / Blue / Red / White
   ========================================================= */

:root{
  --dubora-blue:#155EEF;
  --dubora-blue-dark:#0B3FB3;
  --dubora-yellow:#FFD400;
  --dubora-red:#E5243B;
  --dubora-white:#FFFFFF;
  --dubora-bg:#F5F8FF;
  --dubora-text:#172033;
  --dubora-muted:#667085;
  --dubora-border:#D8E2F0;
  --dubora-shadow:0 10px 30px rgba(18,54,110,.10);
}

html,
body,
button,
input,
textarea,
select,
table,
th,
td,
a,
div,
span,
p,
label,
h1,
h2,
h3,
h4 {
  font-family: "Vazirmatn","Vazir","Tahoma","Arial",sans-serif !important;
}

body{
  margin:0;
  background:
    radial-gradient(circle at 8% 5%, rgba(255,212,0,.18), transparent 25%),
    radial-gradient(circle at 95% 0%, rgba(21,94,239,.12), transparent 28%),
    var(--dubora-bg) !important;
  color:var(--dubora-text) !important;
}

/* Main page container */
.wrap,
.container,
main{
  max-width:1450px !important;
  margin:0 auto !important;
}

/* Page title */
h1{
  color:var(--dubora-blue-dark) !important;
  font-weight:900 !important;
  letter-spacing:-.4px;
}

h2,h3{
  color:var(--dubora-blue-dark) !important;
  font-weight:800 !important;
}

/* Panels / cards */
.card,
.panel,
section,
.stat-card,
.form-card{
  background:var(--dubora-white) !important;
  border:1px solid var(--dubora-border) !important;
  border-radius:18px !important;
  box-shadow:var(--dubora-shadow) !important;
}

/* Yellow emphasis bar */
.card::before,
.panel::before{
  border-radius:18px 18px 0 0;
}

/* Inputs */
input,
textarea,
select{
  background:#fff !important;
  color:var(--dubora-text) !important;
  border:1.5px solid #C9D5E7 !important;
  border-radius:10px !important;
  padding:11px 13px !important;
  outline:none !important;
  transition:.18s ease !important;
}

input:focus,
textarea:focus,
select:focus{
  border-color:var(--dubora-blue) !important;
  box-shadow:0 0 0 4px rgba(21,94,239,.10) !important;
}

/* Primary buttons */
button,
.button,
.btn,
a.button{
  font-weight:800 !important;
  border-radius:10px !important;
  transition:.18s ease !important;
}

button:not(.danger):not(.secondary),
.btn-primary{
  background:linear-gradient(135deg,var(--dubora-blue),var(--dubora-blue-dark)) !important;
  color:#fff !important;
  border:0 !important;
  box-shadow:0 6px 14px rgba(21,94,239,.20) !important;
}

button:hover,
.button:hover,
.btn:hover{
  transform:translateY(-1px);
}

/* Secondary / yellow */
.secondary,
.btn-secondary{
  background:var(--dubora-yellow) !important;
  color:#172033 !important;
  border:1px solid #E8BE00 !important;
}

/* Danger */
.danger,
.btn-danger{
  background:var(--dubora-red) !important;
  color:#fff !important;
  border:0 !important;
}

/* Tables */
table{
  width:100%;
  background:#fff;
  border-collapse:separate !important;
  border-spacing:0 !important;
  overflow:hidden;
  border-radius:14px;
}

thead th{
  background:var(--dubora-blue) !important;
  color:#fff !important;
  font-weight:800 !important;
  padding:13px !important;
}

tbody td{
  padding:12px !important;
  border-bottom:1px solid #E8EEF7 !important;
}

tbody tr:nth-child(even){
  background:#F8FAFF !important;
}

tbody tr:hover{
  background:#FFF9D9 !important;
}

/* Tabs / navigation */
.tabs,
.nav-tabs{
  background:#fff;
  border-radius:14px;
  padding:6px;
  box-shadow:0 4px 18px rgba(18,54,110,.08);
}

.tab,
.nav-tab{
  border-radius:9px !important;
  font-weight:800 !important;
}

.tab.active,
.nav-tab.active{
  background:var(--dubora-blue) !important;
  color:#fff !important;
}

/* Status pills */
.badge,
.status,
.pill{
  border-radius:999px !important;
  font-weight:800 !important;
  padding:5px 10px !important;
}

/* Success */
.success,
.status-success{
  background:#E8F8EF !important;
  color:#147A42 !important;
}

/* Warning */
.warning,
.status-warning{
  background:#FFF5BF !important;
  color:#6D5700 !important;
}

/* Error */
.error,
.status-error{
  background:#FFE8EC !important;
  color:var(--dubora-red) !important;
}

/* Template cards */
.template-card{
  background:#fff !important;
  border:1px solid var(--dubora-border) !important;
  border-radius:16px !important;
  box-shadow:0 7px 20px rgba(18,54,110,.08) !important;
  transition:.18s ease !important;
}

.template-card:hover{
  border-color:var(--dubora-blue) !important;
  box-shadow:0 12px 30px rgba(21,94,239,.13) !important;
  transform:translateY(-2px);
}

/* Email composer */
textarea{
  min-height:140px;
  line-height:1.85 !important;
}

/* Persian / RTL content */
[dir="rtl"],
.rtl{
  direction:rtl !important;
  text-align:right !important;
}

/* Header accents */
header{
  border-bottom:4px solid var(--dubora-yellow) !important;
}

/* Links */
a{
  color:var(--dubora-blue);
}

a:hover{
  color:var(--dubora-red);
}

/* Scrollbar */
::-webkit-scrollbar{
  width:10px;
  height:10px;
}

::-webkit-scrollbar-thumb{
  background:#B8C7DF;
  border-radius:20px;
}

::-webkit-scrollbar-thumb:hover{
  background:var(--dubora-blue);
}

/* Responsive */
@media(max-width:800px){
  .wrap,
  .container,
  main{
    padding:12px !important;
  }

  .card,
  .panel,
  section{
    border-radius:13px !important;
  }
}


/* ==================================================
   Dubora Template RTL — Desktop & Mobile
   ================================================== */

#emailEditor,
.template-preview,
.email-preview,
.desktop-preview,
.mobile-preview {
  direction: rtl !important;
  text-align: right !important;
}

#emailEditor {
  font-family:
    "Vazirmatn",
    "Vazir",
    Tahoma,
    Arial,
    sans-serif !important;
}

.templateFrame {
  direction: rtl !important;
}

.templateFrame,
.email-preview iframe,
.desktop-preview iframe,
.mobile-preview iframe {
  direction: rtl !important;
}


/* ===============================
   TEMPLATE GRID NORMALIZATION
   =============================== */

.template-grid{
  align-items:stretch !important;
}

.template-card{
  display:flex !important;
  flex-direction:column !important;
  height:100% !important;
  overflow:hidden !important;
}

.template-preview{
  height:390px !important;
  min-height:390px !important;
  max-height:390px !important;
  overflow:hidden !important;
  background:#ffffff !important;
}

.template-preview iframe,
.templateFrame{
  display:block !important;
  width:100% !important;
  height:390px !important;
  min-height:390px !important;
  border:0 !important;
  direction:rtl !important;
}

.template-info{
  display:flex !important;
  flex-direction:column !important;
  flex:1 !important;
}

.template-info .useTemplate{
  margin-top:auto !important;
}


/* =====================================================
   DUBORA TEMPLATE PAGE — FIXED PREVIEW
   ===================================================== */

.template-grid{
  display:grid !important;
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(360px,1fr)
    ) !important;
  gap:22px !important;
  align-items:start !important;
}


.template-card{
  display:flex !important;
  flex-direction:column !important;
  width:100% !important;
  min-width:0 !important;
  height:auto !important;
  overflow:hidden !important;
  background:#ffffff !important;
  border-radius:18px !important;
}


.template-preview{
  position:relative !important;

  width:100% !important;

  height:460px !important;
  min-height:460px !important;
  max-height:460px !important;

  margin:0 !important;
  padding:0 !important;

  overflow:hidden !important;

  background:#ffffff !important;

  direction:rtl !important;
  text-align:right !important;

  border-bottom:
    1px solid #E5EAF2 !important;
}


.templateFrame{
  display:block !important;

  width:100% !important;
  height:460px !important;

  margin:0 !important;
  padding:0 !important;

  border:0 !important;

  overflow:hidden !important;

  background:#ffffff !important;

  direction:rtl !important;
}


.template-info{
  display:flex !important;
  flex-direction:column !important;

  padding:18px 20px !important;

  direction:rtl !important;
  text-align:right !important;

  min-height:180px !important;
}


.template-info h3{
  margin:
    0 0 8px 0 !important;

  direction:rtl !important;
  text-align:right !important;
}


.template-info .meta{
  direction:rtl !important;
  text-align:right !important;
}


.template-info .useTemplate{
  width:100% !important;
  margin-top:14px !important;

  white-space:nowrap !important;
}


/* Mobile */
@media(max-width:700px){

  .template-grid{
    grid-template-columns:
      1fr !important;
  }

  .template-preview{
    height:410px !important;
    min-height:410px !important;
    max-height:410px !important;
  }

  .templateFrame{
    height:410px !important;
  }

}


/* ==================================================
   DUBORA EMAIL EDITOR — RTL FINAL
   ================================================== */

#emailEditor {
  direction:rtl !important;
  text-align:right !important;
  unicode-bidi:plaintext;
}

#emailEditor p,
#emailEditor div,
#emailEditor h1,
#emailEditor h2,
#emailEditor h3,
#emailEditor h4,
#emailEditor li,
#emailEditor td {
  direction:rtl;
}

/* Banner */
.dubora-banner-slot,
.dubora-banner-slot img {
  width:100% !important;
  height:220px !important;
  min-height:220px !important;
  max-height:220px !important;
}

.dubora-banner-slot img {
  display:block !important;
  object-fit:cover !important;
  object-position:center !important;
}

/* Color picker */
#fontColor {
  width:42px !important;
  min-width:42px !important;
  height:34px !important;
  padding:3px !important;
  cursor:pointer !important;
}


/* =====================================================
   DUBORA TEMPLATE PREVIEW — FINAL SCALE FIX
   ===================================================== */

.template-preview iframe,
.templateFrame {
  display:block !important;

  width:100% !important;
  max-width:100% !important;

  height:460px !important;
  min-height:460px !important;

  margin:0 !important;
  padding:0 !important;

  border:0 !important;

  transform:none !important;
  transform-origin:initial !important;

  position:static !important;

  direction:rtl !important;

  background:#ffffff !important;
}

.template-preview {
  width:100% !important;

  height:460px !important;
  min-height:460px !important;
  max-height:460px !important;

  padding:0 !important;
  margin:0 !important;

  overflow:hidden !important;

  background:#ffffff !important;
}

@media(max-width:700px) {

  .template-preview,
  .template-preview iframe,
  .templateFrame {
    height:410px !important;
    min-height:410px !important;
    max-height:410px !important;
  }

}


/* =====================================================
   DUBORA TEMPLATE DESIGNER
   ===================================================== */

.template-designer-box {
  margin-bottom:18px;
  padding:18px;
  background:#f8fafc;
  border:1px solid #dbe4f0;
  border-radius:16px;
}

.template-designer-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:15px;
  margin-bottom:15px;
}

.template-designer-fields {
  display:grid;
  grid-template-columns:
    repeat(
      auto-fit,
      minmax(210px,1fr)
    );
  gap:12px;
}

.template-designer-fields label {
  display:flex;
  flex-direction:column;
  gap:6px;
  font-weight:700;
}

.template-designer-actions {
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}

.template-designer-actions button {
  width:auto;
}

#emailEditor img {
  cursor:pointer;
}

#emailEditor img[data-editor-selected="1"] {
  outline:3px solid #155EEF !important;
  outline-offset:3px;
}

#backgroundColor {
  width:42px;
  min-width:42px;
  height:34px;
  padding:3px;
  cursor:pointer;
}

