/* ══════════════════════════════════════════════════════════════════
   EMAIL MARKETING TAB STYLES
   ══════════════════════════════════════════════════════════════════ */

#tab-email { flex-direction:column; padding:20px; max-width:1100px; margin:0 auto; width:100%; }

.email-nav { display:flex; gap:6px; margin-bottom:20px; flex-wrap:wrap; }
.email-nav-btn { background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1); color:#aaa; padding:8px 16px; border-radius:8px; cursor:pointer; font-size:13px; transition:all .2s; }
.email-nav-btn:hover { background:rgba(255,255,255,0.1); color:#fff; }
.email-nav-btn.active { background:#FF2D55; color:#fff; border-color:#FF2D55; }

.email-stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:12px; margin-bottom:20px; }

.email-actions { display:flex; gap:10px; margin-bottom:24px; flex-wrap:wrap; }
.btn-email-action { background:#FF2D55; color:#fff; border:none; padding:10px 20px; border-radius:8px; cursor:pointer; font-weight:600; font-size:13px; transition:all .2s; }
.btn-email-action:hover { background:#e0264b; transform:translateY(-1px); }
.btn-email-action.secondary { background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15); }
.btn-email-action.secondary:hover { background:rgba(255,255,255,0.15); }
.btn-sm { background:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15); color:#ccc; padding:6px 14px; border-radius:6px; cursor:pointer; font-size:12px; }
.btn-sm:hover { background:rgba(255,255,255,0.15); }

/* Tags */
.tag-badge { display:inline-block; padding:2px 10px; border-radius:12px; font-size:11px; font-weight:600; color:#fff; margin:2px; }

/* Subscriber table */
.email-table-wrap { overflow-x:auto; }
.email-table { width:100%; border-collapse:collapse; font-size:13px; }
.email-table th { text-align:left; padding:10px 12px; color:rgba(255,255,255,0.5); font-size:11px; text-transform:uppercase; letter-spacing:.5px; border-bottom:1px solid rgba(255,255,255,0.1); }
.email-table td { padding:10px 12px; border-bottom:1px solid rgba(255,255,255,0.05); color:#ddd; }
.email-table tr:hover td { background:rgba(255,255,255,0.03); }
.email-table .cb { width:30px; }
.email-table .clickable { cursor:pointer; color:#FF2D55; }
.email-table .clickable:hover { text-decoration:underline; }

.email-search { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; align-items:center; }
.email-search input, .email-search select { background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); color:#fff; padding:8px 14px; border-radius:8px; font-size:13px; }
.email-search input { flex:1; min-width:200px; }
.email-search select { min-width:120px; }

.email-pagination { display:flex; justify-content:center; gap:8px; margin-top:16px; align-items:center; }
.email-pagination button { background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.1); color:#ccc; padding:6px 12px; border-radius:6px; cursor:pointer; font-size:12px; }
.email-pagination button:disabled { opacity:.3; cursor:default; }
.email-pagination span { color:#888; font-size:12px; }

/* Campaigns */
.campaign-card { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); border-radius:12px; padding:16px 20px; margin-bottom:10px; display:flex; justify-content:space-between; align-items:center; cursor:pointer; transition:all .15s; }
.campaign-card:hover { border-color:rgba(255,255,255,0.2); background:rgba(255,255,255,0.06); }
.campaign-info h4 { margin:0 0 4px; color:#fff; font-size:14px; }
.campaign-info p { margin:0; color:#888; font-size:12px; }
.campaign-stats { display:flex; gap:16px; font-size:12px; color:#888; }
.campaign-stats span { display:flex; flex-direction:column; align-items:center; }
.campaign-stats .val { font-size:16px; font-weight:600; color:#ddd; }
.status-badge { display:inline-block; padding:3px 10px; border-radius:10px; font-size:11px; font-weight:600; text-transform:uppercase; }
.status-draft { background:rgba(255,255,255,0.1); color:#aaa; }
.status-sending { background:rgba(255,165,0,0.2); color:#ffa500; }
.status-sent { background:rgba(48,209,88,0.2); color:#30D158; }
.status-failed { background:rgba(255,45,85,0.2); color:#FF2D55; }

/* Composer */
.composer { background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.1); border-radius:12px; padding:24px; }
.composer .form-group { margin-bottom:16px; }
.composer label { display:block; color:rgba(255,255,255,0.6); font-size:12px; margin-bottom:6px; text-transform:uppercase; letter-spacing:.5px; }
.composer input[type=text], .composer textarea, .composer select { width:100%; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.12); color:#fff; padding:10px 14px; border-radius:8px; font-size:14px; font-family:inherit; box-sizing:border-box; }
.composer textarea { min-height:200px; font-family:monospace; font-size:13px; resize:vertical; }
.composer-actions { display:flex; gap:10px; margin-top:20px; flex-wrap:wrap; }

/* Tags manager */
.tags-grid { display:flex; flex-wrap:wrap; gap:10px; }
.tag-card { background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.1); border-radius:10px; padding:12px 16px; display:flex; align-items:center; gap:10px; min-width:180px; }
.tag-card .tag-color { width:14px; height:14px; border-radius:50%; flex-shrink:0; }
.tag-card .tag-name { font-weight:600; color:#fff; font-size:13px; }
.tag-card .tag-count { color:#888; font-size:12px; margin-left:auto; }
.tag-card .tag-del { color:#666; cursor:pointer; font-size:14px; margin-left:4px; }
.tag-card .tag-del:hover { color:#FF2D55; }

/* Bulk actions bar */
.bulk-bar { background:rgba(255,45,85,0.1); border:1px solid rgba(255,45,85,0.3); border-radius:10px; padding:10px 16px; margin-bottom:12px; display:flex; align-items:center; gap:12px; }
.bulk-bar span { color:#FF2D55; font-weight:600; font-size:13px; }
.bulk-bar select, .bulk-bar button { font-size:12px; }

/* Modal */
.email-modal { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.7); display:flex; align-items:center; justify-content:center; z-index:1000; padding:20px; }
.email-modal-content { background:#1a1a1a; border:1px solid #333; border-radius:16px; max-width:700px; width:100%; max-height:90vh; overflow-y:auto; padding:30px; position:relative; }
.email-modal-close { position:absolute; top:14px; right:18px; color:#666; cursor:pointer; font-size:24px; line-height:1; }
.email-modal-close:hover { color:#fff; }

/* Profile */
.profile-header { display:flex; align-items:center; gap:16px; margin-bottom:20px; }
.profile-avatar { width:60px; height:60px; border-radius:50%; background:#FF2D55; display:flex; align-items:center; justify-content:center; font-size:24px; font-weight:700; color:#fff; }
.profile-info h3 { margin:0; color:#fff; }
.profile-info p { margin:4px 0 0; color:#888; font-size:13px; }
.profile-section { margin-top:20px; }
.profile-section h4 { color:rgba(255,255,255,0.5); font-size:12px; text-transform:uppercase; letter-spacing:.5px; margin-bottom:10px; }
.order-item { background:rgba(255,255,255,0.04); border-radius:8px; padding:10px 14px; margin-bottom:6px; font-size:13px; }
.order-item .order-total { color:#30D158; font-weight:600; }

/* Tag picker in multi-select style */
.tag-picker { display:flex; flex-wrap:wrap; gap:6px; }
.tag-picker label { display:flex; align-items:center; gap:4px; padding:4px 10px; border-radius:8px; font-size:12px; cursor:pointer; background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.1); color:#ccc; transition:all .15s; }
.tag-picker label:has(input:checked) { border-color:#FF2D55; background:rgba(255,45,85,0.15); color:#fff; }
.tag-picker input { display:none; }

/* Preview iframe */
.preview-frame { width:100%; height:400px; border:1px solid rgba(255,255,255,0.1); border-radius:8px; background:#fff; }

/* Tag stats in overview */
.tag-stats { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }

/* ══════════════════════════════════════════════════════════════════
   GRAPEJS EDITOR & TEMPLATE GALLERY
   ══════════════════════════════════════════════════════════════════ */

/* Full-screen overlay */
#gjsOverlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  background: #0d0d0d;
  display: flex;
  flex-direction: column;
}

.gjs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  background: #111;
  border-bottom: 1px solid #333;
  padding: 0 16px;
  flex-shrink: 0;
}

.gjs-topbar-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.gjs-topbar-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.gjs-topbar-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #ccc;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.gjs-topbar-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

.gjs-save-btn {
  background: #c0392b !important;
  border-color: #c0392b !important;
  color: #fff !important;
  font-weight: 600;
}
.gjs-save-btn:hover { background: #e74c3c !important; }

/* GrapeJS Dark Theme Overrides */
.gjs-one-bg { background-color: #1a1a1a !important; }
.gjs-two-color { color: #ddd !important; }
.gjs-three-bg { background-color: #0d0d0d !important; }
.gjs-four-color, .gjs-four-color-h:hover { color: #c0392b !important; }

.gjs-pn-panel { background: #1a1a1a !important; border-color: #333 !important; }
.gjs-pn-views, .gjs-pn-views-container { background: #1a1a1a !important; }
.gjs-pn-options { background: #1a1a1a !important; }
.gjs-pn-commands { background: #1a1a1a !important; }

.gjs-cv-canvas { background: #2a2a2a !important; }
.gjs-block { color: #ccc !important; background: rgba(255,255,255,0.04) !important; border: 1px solid rgba(255,255,255,0.1) !important; border-radius: 6px !important; }
.gjs-block:hover { background: rgba(255,255,255,0.08) !important; border-color: #c0392b !important; }
.gjs-block__media { color: #c0392b !important; }

.gjs-layer, .gjs-layers { background: #1a1a1a !important; color: #ccc !important; }
.gjs-layer:hover { background: rgba(255,255,255,0.06) !important; }

.gjs-clm-tags, .gjs-clm-tag { background: #1a1a1a !important; color: #ccc !important; }
.gjs-sm-sector { background: #1a1a1a !important; }
.gjs-sm-sector-title { background: #111 !important; color: #aaa !important; border-color: #333 !important; }
.gjs-sm-property { color: #ccc !important; }

.gjs-field, .gjs-field input, .gjs-field select, .gjs-field textarea {
  background: #0d0d0d !important;
  color: #ccc !important;
  border-color: #333 !important;
}

.gjs-trt-trait { color: #ccc !important; }
.gjs-trt-trait .gjs-label { color: #888 !important; }

.gjs-am-file-uploader, .gjs-am-assets-cont { background: #1a1a1a !important; color: #ccc !important; }
.gjs-mdl-dialog { background: #1a1a1a !important; border: 1px solid #333 !important; color: #ccc !important; }
.gjs-mdl-header { background: #111 !important; border-color: #333 !important; color: #fff !important; }

.gjs-rte-toolbar { background: #111 !important; border-color: #333 !important; }
.gjs-rte-actionbar { background: #111 !important; }
.gjs-rte-action { color: #ccc !important; }

.gjs-nv-item { background: #1a1a1a !important; color: #ccc !important; }
.gjs-category-title { background: #111 !important; color: #aaa !important; }

.gjs-pn-btn { color: #ccc !important; }
.gjs-pn-btn:hover { color: #fff !important; }
.gjs-pn-btn.gjs-pn-active { color: #c0392b !important; }

/* Template Gallery */
.template-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.template-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
}
.template-card:hover {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
}

.template-thumb {
  height: 160px;
  background: #0d0d0d;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.template-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.template-thumb-placeholder {
  font-size: 48px;
  font-weight: 900;
  color: #c0392b;
  opacity: 0.5;
}

.template-card-body {
  padding: 16px;
}
.template-card-body h4 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 14px;
}
.template-card-body p {
  margin: 0 0 12px;
  color: #888;
  font-size: 12px;
  line-height: 1.4;
}
.template-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Campaign delete button */
.campaign-delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.4;
  transition: opacity 0.2s;
  z-index: 2;
}
.campaign-delete-btn:hover {
  opacity: 1;
}
/* ═══════════════════════════════
   SEGMENTS STYLES
   ═══════════════════════════════ */

.segments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.segments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.segment-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  transition: background-color 0.2s;
}

.segment-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.segment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.segment-header h4 {
  margin: 0;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
}

.preset-badge {
  background: rgba(0, 122, 255, 0.2);
  color: #007AFF;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
}

.segment-count {
  font-size: 24px;
  font-weight: bold;
  color: #30D158;
}

.segment-description {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  margin: 8px 0;
  line-height: 1.4;
}

.segment-rules {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin: 8px 0;
  font-family: monospace;
}

.segment-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.segment-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.segment-actions button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.segment-composer {
  max-width: 600px;
  margin: 0 auto;
}

.segment-composer h3 {
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 20px;
}

.rule-builder {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

.rule-builder select,
.rule-builder input[type="text"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.rule-builder select:focus,
.rule-builder input[type="text"]:focus {
  outline: none;
  border-color: #007AFF;
}

#segmentPreview {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: 4px;
  margin-top: 8px;
}

#previewCount {
  font-weight: bold;
  color: #30D158;
}

.btn-sm {
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.2);
}

#compSegment {
  margin-top: 6px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.9);
  width: 100%;
}

#segmentCount {
  display: block;
  margin-top: 4px;
  font-style: italic;
}
/* Scheduled status */
.status-scheduled {
  background: rgba(88, 86, 214, 0.15);
  color: #8B89E0;
}
