/* ====== Base ====== */
:root{
  --primary:#2563eb;
  --primary-dark:#1d4ed8;
  --muted:#6b7280;
  --border:#e5e7eb;
  --bg:#f7f9fa;
  --card:#ffffff;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background:var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Helvetica Neue", sans-serif;
  color:#0f172a;
}

/* ====== Layout ====== */
.container{
  background:var(--card);
  width:100%;
  max-width:760px;
  margin:56px auto;
  padding:28px 32px;
  border-radius:16px;
  box-shadow:0 10px 30px rgba(0,0,0,.05);
}

h1{
  margin:0 0 8px;
  color:var(--primary);
  font-size:2.1rem;
  letter-spacing:.2px;
}

label{ font-weight:700; display:block; margin:14px 0 6px; }
input[type="file"]{ margin:8px 0 12px; }

/* ====== Editor ====== */
#editor{
  min-height:220px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#fff;
  line-height:1.5;
  outline:none;
}
#editor:focus{ box-shadow:0 0 0 3px rgba(37,99,235,.12); }

/* Live preview */
#email_preview{
  border:1px solid var(--border);
  background:#f6f8fa;
  padding:12px 14px;
  border-radius:10px;
}

/* ====== Toolbar ====== */
.toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0 10px;
}

/* IMPORTANT: force dark text on light bg so labels visible */
.toolbar button{
  background:#f9fafb;
  color:#111 !important;
  border:1px solid #d1d5db;
  padding:7px 10px;
  border-radius:8px;
  cursor:pointer;
  font-size:.95rem;
}
.toolbar button:hover{ background:#eef2ff; border-color:#c7d2fe; }

/* Chips ({{ name }}, {{ category }}) */
.chip{
  background:#eef2ff;
  border:1px solid #e0e7ff;
  padding:2px 6px;
  border-radius:6px;
  font-weight:600;
}

/* ====== Buttons ====== */
/* Do NOT style all <button> globally, use .btn for primary */
.btn{
  background:var(--primary);
  color:#fff;
  border:none;
  border-radius:10px;
  padding:10px 18px;
  cursor:pointer;
  font-size:1rem;
  font-weight:600;
}
.btn:hover{ background:var(--primary-dark); }

/* If your Send button is plain <button>, add class="btn" in HTML for this style */

/* ====== Alerts ====== */
.alert{
  padding:10px 12px;
  border-radius:10px;
  margin:14px 0;
  font-weight:600;
}
.alert.success{ background:#d1fae5; color:#065f46; }
.alert.danger{  background:#fee2e2; color:#991b1b; }

/* ====== Progress ====== */
.progress-outer{ margin:20px 0 16px; }
.progress-label{ margin-bottom:8px; color:#374151; }
.progressbar{
  width:100%;
  height:26px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden;
}
.progressbar-inner{
  height:100%;
  background:var(--primary);
  color:#fff;
  font-weight:700;
  text-align:center;
  line-height:26px;
  transition:width .45s ease;
}

/* ====== Hint box ====== */
.hint{
  margin-top:20px;
  font-size:.95rem;
  color:#374151;
  background:#eef3fc;
  padding:12px 14px;
  border-radius:12px;
}

/* ====== Attachments list ====== */
.attach-list{ margin-top:6px; font-size:.92rem; color:#374151; }

/* ====== Responsive ====== */
@media (max-width:640px){
  .container{ padding:22px 18px; margin:28px auto; }
  h1{ font-size:1.8rem; }
}
/* ---------- Layout: form rows ---------- */
.field-row{
  display:grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap:14px 24px;
  align-items:end;
  margin:8px 0 18px;
}
.field-row .field{ width:100%; }

/* ---------- Labels & inputs ---------- */
label{
  display:block;
  font-weight:800;
  color:#0f172a;
  margin:8px 0 6px;
}

input[type="text"],
input[type="number"],
input[type="email"],
select{
  width:100%;
  height:42px;
  padding:8px 12px;
  border:1px solid #e5e7eb;
  border-radius:10px;
  outline:none;
  font-size:15px;
  background:#fff;
}
input:focus, select:focus{
  border-color:#c7d2fe;
  box-shadow:0 0 0 3px rgba(99,102,241,.16);
}

/* File input spacing */
input[type="file"]{ margin-top:4px; }

/* ---------- Editor + toolbar ---------- */
#editor{
  min-height:220px;
  padding:14px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#fff;
}

.toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0 10px;
}
.toolbar button{
  background:#f9fafb;
  color:#0f172a;
  border:1px solid #d1d5db;
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  font-weight:700;
  min-width:70px;
}
.toolbar button:hover{
  background:#eef2ff;
  border-color:#c7d2fe;
}

/* “Insert Image” + file chooser aligned neatly */
.toolbar input[type="file"].hidden{ display:none; }
.toolbar .inline-file{ display:flex; gap:8px; align-items:center; }

/* ---------- Tip chips ({{ name }} / {{ category }}) ---------- */
.chip{
  display:inline-block;
  padding:2px 8px;
  border-radius:8px;
  background:#eef2ff;
  border:1px solid #dbe3ff;
  color:#1e293b;
  font-weight:700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ---------- Buttons ---------- */
.btn{
  background:#2563eb;
  color:#fff;
  border:none;
  border-radius:12px;
  padding:10px 16px;
  font-weight:700;
  cursor:pointer;
}
.btn:hover{ background:#1d4ed8; }

.btn.secondary{
  background:#f3f4f6;
  color:#111827;
  border:1px solid #d1d5db;
}
.btn.secondary:hover{ background:#e5e7eb; }

/* ---------- Progress ---------- */
.progress-outer{ margin:18px 0 14px; }
.progress-label{ margin-bottom:6px; color:#374151; }
.progressbar{
  width:100%;
  height:26px;
  background:#e5e7eb;
  border-radius:999px;
  overflow:hidden;
}
.progressbar-inner{
  height:100%;
  background:#2563eb;
  color:#fff;
  font-weight:800;
  text-align:center;
  line-height:26px;
  transition:width .4s ease;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px){
  .field-row{ grid-template-columns: 1fr; gap:12px; }
}
/* ====== HOME PAGE POLISH ====== */
.container {
  max-width: 980px;              /* thoda narrow for clean look */
  padding: 28px 30px;
}

h1 {
  font-size: 2.1rem;
  margin: 0 0 18px;
}

/* Cards row */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.03);
}
.card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: #0f172a;
}
.card p { margin: 0 0 12px; color: #475569; }
.card .actions { display: flex; gap: 10px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px;
  background: #2563eb; color: #fff;
  border: 0; border-radius: 10px; font-weight: 700;
  text-decoration: none; cursor: pointer;
  transition: transform .02s ease, background .2s ease;
}
.btn:hover { background: #1d4ed8; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #f3f4f6; color:#111827; border:1px solid #e5e7eb; }
.btn.secondary:hover { background:#eaeef2; }

/* SMTP Manager block */
.card:has(#smtp-list) { padding-top: 16px; }
.row {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr .6fr 1.4fr 1.2fr auto auto;
  gap: 10px;
}
.row input[type="text"],
.row input[type="password"],
.row input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  outline: none;
}
.row input:focus { border-color:#93c5fd; box-shadow: 0 0 0 3px rgba(147,197,253,.35); }

.row label { display:flex; align-items:center; gap:6px; color:#111827; font-weight:600; }
.row .btn { height: 40px; }

/* Table */
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { padding: 10px 12px; border: 1px solid #e5e7eb; }
th { background: #f8fafc; color:#0f172a; font-weight:700; }
td { background:#fff; vertical-align: middle; }
td .btn { padding: 8px 12px; border-radius: 8px; }

/* Small helper text */
.muted { color:#6b7280; font-size:.95rem; margin-top: 8px; }

/* Responsive tweaks */
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .container { padding: 22px 16px; }
  .row { grid-template-columns: 1fr; }
  .btn, .row .btn { width: 100%; }
}
