/* ===== CMS THEME VARIABLES (Dreamweaver Safe - UTF-8 Only) ===== */
:root {
  --primary: #1EB6DE;
  --primary-dark: #1892B2;
  --light-bg: #F8FCFF;
  --border: #e1e5f1;
  --text: #1e293b;
  --text-light: #475569;
  --card-bg: #ffffff;
  --toast-bg: #2c3e50;
  --switch-bg: #cbd5e1;
  --switch-active: #1ba4c8;
  --danger: #e53e3e;
  --success: #2c7a4d;
  --warning: #ed8936;
  --info: #4299e1;
}
[data-theme="dark"] {
  --primary: #1EB6DE;
  --primary-dark: #1892B2;
  --light-bg: #292b32;
  --border: #4a4a5a;
  --text: #f1f5f9;
  --text-light: #cbd5e1;
  --card-bg: #1e1f28;
  --toast-bg: #111827;
  --switch-bg: #4b5563;
  --switch-active: #1ba4c8;
  --danger: #f56565;
  --success: #48bb78;
  --warning: #f6ad55;
  --info: #63b3ed;
}

/* ===== GLOBAL UTILITIES ===== */
.fa-sm { font-size: 0.875em; vertical-align: -0.1em; }
button i { display: inline-flex; align-items: center; justify-content: center; width: 1em; }
.panel-hidden { display: none !important; }
code { background: var(--light-bg); padding: 2px 6px; border-radius: 3px; font-size: 12px; color: var(--text); border: 1px solid var(--border); }
input[type="file"] { display: none; }

/* ===== BUTTONS (CMS Compatible - NO .btn CLASS) ===== */
button {
  font-family: inherit; font-size: 13px; font-weight: 600; border-radius: 3px; cursor: pointer;
  transition: all 0.2s; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; background: var(--light-bg); color: var(--text); border: 1px solid var(--border);
  min-height: 34px; white-space: nowrap; text-shadow: none; flex-shrink: 1;
}
button:hover { border-color: var(--primary) !important; color: var(--text); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
button.primary { background: var(--primary); border-color: var(--primary); color: white; }
button.primary:hover { background: var(--primary-dark); }
button.secondary { background: var(--light-bg); border: 1px solid var(--border); }
button.secondary:hover { border-color: var(--primary); background: rgba(30, 182, 222, 0.1); }
button.success-btn { background: rgba(44, 122, 77, 0.12); border-color: var(--success); color: var(--success); }
button.success-btn:hover { background: rgba(44, 122, 77, 0.2); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ===== CONTAINER & LAYOUT ===== */
.container-custom {
    max-width: 1600px; margin: 0 auto; border-radius: 5px; background: var(--card-bg);
    box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.1); transition: background 0.2s; overflow: hidden;
}
.tool-header { padding: 20px 24px 0 24px; border-bottom: 1px solid var(--border); }
.tool-header-content { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.tool-title { margin: 0; color: var(--primary); font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.tool-subtitle { margin: 4px 0 0 0; color: var(--text-light); font-size: 0.9rem; }

/* ===== SIDE-BY-SIDE EDITOR LAYOUT ===== */
.editor-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  /*padding: 20px 24px;*/
}
@media (min-width: 900px) {
  .editor-wrapper { grid-template-columns: 1fr 1fr; }
}

/* ===== EDITOR PANELS ===== */
.editor-panel {
  background: var(--light-bg);
  border: 1px solid var(--border);
  /*border-radius: 8px;*/
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 400px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(30, 182, 222, 0.08);
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== TEXTAREAS ===== */
textarea {
  width: 100%; flex: 1; border: none; background: var(--card-bg);
  resize: none; font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.9rem; line-height: 1.5; color: var(--text);
  padding: 14px; outline: none; box-sizing: border-box;
}
textarea:focus { outline: none; }
.output-panel textarea { background: var(--light-bg); }

/* ===== MINI STATS BAR ===== */
.mini-stats {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-size: 0.8rem; background: var(--card-bg); padding: 8px 14px;
  border-top: 1px solid var(--border); color: var(--text-light);
}
.mini-stats strong { color: var(--text); font-weight: 600; }

/* Push status badge to the right */
.status-badge {
  background: rgba(44,122,77,0.12);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  margin-left: auto;
  white-space: nowrap;
}

/* ===== OPTIONS PANEL ===== */
.options-panel { padding: 10px 20px 20px 20px; background: var(--card-bg); border-top: 1px solid var(--border); }
.options-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 12px; gap: 10px; }
.options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 8px; align-items: start; }

/* ===== COLLAPSIBLE OPTION CARDS ===== */
.option-card { background: var(--light-bg); border-radius: 8px; padding: 0; border: 1px solid var(--border); overflow: hidden; transition: all 0.2s ease; }
.option-card-header { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; padding: 8px 16px; background: rgba(30, 182, 222, 0.05); transition: background 0.2s ease; }
.option-card-header:hover { background: rgba(30, 182, 222, 0.1); }
.option-card-title { margin: 0; padding: 0; border: none; cursor: pointer; flex: 1; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; color: var(--primary); pointer-events: none; display: flex; align-items: center; gap: 8px; }
.collapse-icon { font-size: 0.85rem; color: var(--primary); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; background: rgba(27, 164, 200, 0.1); cursor: pointer; flex-shrink: 0; }
.collapse-icon:hover { background: rgba(27, 164, 200, 0.2); }
.option-card.collapsed .collapse-icon { transform: rotate(-90deg); }
.option-card-content { overflow: hidden; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); max-height: 2000px; opacity: 1; padding: 0 16px 12px 16px; }
.option-card.collapsed .option-card-content { max-height: 0 !important; opacity: 0; padding: 0 16px; visibility: hidden; margin: 0; }

/* ===== SWITCH ITEMS ===== */
.switch-item { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.switch-item:last-child { border-bottom: none; }
.switch-label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 500; cursor: pointer; color: var(--text); }
.switch-label i { width: 20px; color: var(--primary); }
.switch { position: relative; display: inline-block; width: 44px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--switch-bg); transition: 0.25s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: 0.25s; border-radius: 50%; }
input:checked + .slider { background-color: var(--switch-active); }
input:checked + .slider:before { transform: translateX(22px); }

/* ===== HELPER TEXT ===== */
.helper-text { font-size: 0.75rem; color: var(--text-light); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.helper-text i { color: var(--primary); }

/* ===== ACTION BAR ===== */
.action-buttons-bar { display: flex; gap: 12px; flex-wrap: wrap; padding: 16px 20px; background: var(--card-bg); border-top: 1px solid var(--border); }

/* ===== TOAST NOTIFICATIONS ===== */
#toastContainer { position: fixed; bottom: 24px; right: 24px; z-index: 1000; }
.toast { background: var(--toast-bg); color: white; padding: 12px 20px; border-radius: 5px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 10px; font-size: 14px; margin-top: 8px; animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s forwards; max-width: 350px; border-left: 4px solid var(--primary); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .tool-header-content { flex-direction: column; align-items: flex-start; }
  .editor-wrapper { padding: 16px; }
  .editor-panel { min-height: 300px; }
  .options-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .action-buttons-bar { flex-direction: column; }
  .action-buttons-bar button { width: 100%; justify-content: center; }
  .mini-stats { flex-wrap: wrap; }
  /* Header buttons stay compact on mobile */
  .btn-group { width: 100%; }
  .btn-group button { flex: 1; min-width: 0; justify-content: center; }
}