/* ===== VARIABLES ===== */
:root {
  --wp-blue: #2271b1;
  --wp-dark: #1d2327;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,.09);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.13);
}

/* ===== BASE ===== */
* { box-sizing: border-box; }
body {
  background: #f0f2f5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin: 0;
}
.screen { width: 100%; }

/* ===== LOGIN ===== */
#login-screen { background: linear-gradient(135deg, #1d2327 0%, #2271b1 100%); }
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.wp-logo {
  width: 64px; height: 64px;
  background: var(--wp-blue);
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem;
}
.login-card .form-control:focus { border-color: var(--wp-blue); box-shadow: 0 0 0 3px rgba(34,113,177,.15); }
.login-card .btn-primary { background: var(--wp-blue); border-color: var(--wp-blue); padding: .65rem; }

/* ===== NAVBAR ===== */
.navbar { background: var(--wp-dark); border-bottom: 1px solid #333; }
.site-badge {
  background: rgba(255,255,255,.1);
  color: #adb5bd; padding: 4px 10px;
  border-radius: 20px; font-family: monospace;
  max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ===== TABS ===== */
.tool-tabs .nav-link {
  color: #6c757d; border: none;
  border-bottom: 3px solid transparent;
  padding: .6rem 1.2rem; font-weight: 500;
  background: none; transition: all .2s;
}
.tool-tabs .nav-link:hover { color: var(--wp-blue); }
.tool-tabs .nav-link.active {
  color: var(--wp-blue);
  border-bottom-color: var(--wp-blue);
  background: none;
}

/* ===== TOOL CARDS ===== */
.tool-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overflow: hidden; border: 1px solid #e9ecef;
}
.tool-card-header {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  gap: .5rem; padding: .85rem 1rem;
  background: #f8f9fa; border-bottom: 1px solid #e9ecef;
}
.tool-card-footer {
  display: flex; align-items: center; gap: .5rem;
  padding: .75rem 1rem;
  background: #f8f9fa; border-top: 1px solid #e9ecef;
}

/* ===== FORMAT BUTTONS (editor) ===== */
.fmt-btn {
  background: #fff; border: 1px solid #dee2e6;
  border-radius: 6px; padding: 4px 8px;
  cursor: pointer; color: #495057; font-size: .85rem;
  transition: all .15s;
}
.fmt-btn:hover { background: var(--wp-blue); color: #fff; border-color: var(--wp-blue); }
.fmt-select {
  border: 1px solid #dee2e6; border-radius: 6px;
  padding: 4px 6px; font-size: .8rem;
  color: #495057; background: #fff; cursor: pointer;
}
.fmt-select:focus { outline: none; border-color: var(--wp-blue); }

/* ===== WYSIWYG ===== */
.wysiwyg-area {
  min-height: 320px; padding: 1rem;
  outline: none; flex-grow: 1; overflow-y: auto;
  line-height: 1.7; font-size: .95rem;
  caret-color: var(--wp-blue);
}
.wysiwyg-area:focus { background: #fafeff; }
.wysiwyg-area p { margin-bottom: .5rem; }
.wysiwyg-area ul,.wysiwyg-area ol { padding-left: 1.4rem; }

/* ===== HTML OUTPUT ===== */
.html-output {
  margin: 0; padding: 1rem;
  font-size: .78rem; line-height: 1.6;
  background: #1e2228; color: #abb2bf;
  flex-grow: 1; overflow: auto;
  min-height: 320px; white-space: pre-wrap;
  word-break: break-all;
}

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2px dashed #dee2e6;
  border-radius: var(--radius);
  background: #f8f9fa;
  transition: all .2s; cursor: pointer;
  min-height: 190px;
  display: flex; align-items: center; justify-content: center;
}
.drop-zone.drag-over { border-color: var(--wp-blue); background: #eef4fb; }
.drop-zone-content { text-align: center; padding: 1.5rem; }

/* ===== FILE PREVIEW ===== */
.file-preview { text-align: center; padding: 1.2rem; }
.file-preview img {
  max-width: 180px; max-height: 160px;
  object-fit: contain; border-radius: 8px;
  border: 1px solid #dee2e6;
}

/* ===== RESULT ===== */
.upload-result {
  border: 1px solid #d1e7dd;
  background: #f0fff4;
  border-radius: var(--radius);
  padding: 1.2rem;
}
.result-header { display: flex; align-items: center; font-size: .95rem; }
.result-preview-wrap { text-align: center; }
.result-img {
  max-width: 100%; max-height: 220px;
  object-fit: contain; border-radius: 8px;
  border: 1px solid #dee2e6; box-shadow: var(--shadow);
}

/* ===== TOAST ===== */
.toast { min-width: 280px; }
.toast.toast-success { background: #198754; color: #fff; }
.toast.toast-error   { background: #dc3545; color: #fff; }
.toast.toast-info    { background: var(--wp-blue); color: #fff; }

/* ===== SPINNER ===== */
.btn .spinner-border { width: .9rem; height: .9rem; border-width: .15em; }

/* ===== SECTION LABEL ===== */
.section-label {
  font-size: .85rem; font-weight: 600;
  color: #495057; margin-bottom: .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--wp-blue); color: #fff;
  border-radius: 50%; font-size: .75rem; font-weight: 700;
  flex-shrink: 0;
}

/* ===== TEMPLATE CARDS ===== */
.tmpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.tmpl-card {
  border: 2.5px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.1rem .9rem;
  cursor: pointer; text-align: center;
  background: #fafafa;
  transition: all .2s;
}
.tmpl-card:hover {
  border-color: var(--wp-blue); background: #f0f4fb;
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(34,113,177,.13);
}
.tmpl-card.selected {
  border-color: var(--wp-blue); background: #e8f0fe;
  box-shadow: 0 3px 12px rgba(34,113,177,.2);
}
.tmpl-preview {
  background: #fff; border: 1.5px solid #dde;
  border-radius: 7px; margin: 0 auto .7rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; position: relative; overflow: hidden;
}
.tmpl-sq   { width: 90px; height: 90px; }
.tmpl-rect { width: 112px; height: 90px; }
.tmpl-badge {
  position: absolute; bottom: 3px; right: 3px;
  background: var(--wp-blue); color: #fff;
  font-size: .46rem; padding: 2px 4px;
  border-radius: 3px; font-weight: 700;
}
.tmpl-title {
  font-weight: 700; color: #1a1a2e;
  font-size: .82rem; margin-bottom: .45rem; line-height: 1.4;
}
.tmpl-size {
  font-size: .74rem; color: #555;
  background: #e8ecef; padding: .2rem .75rem;
  border-radius: 100px; display: inline-block;
}

/* ===== PROCESO INLINE ===== */
.process-steps {
  background: #f8f9fa; border: 1px solid #e9ecef;
  border-radius: var(--radius); padding: 1rem 1.2rem;
  display: flex; flex-direction: column; gap: .6rem;
}
.ps-item {
  display: flex; align-items: center; gap: .65rem;
  font-size: .84rem; color: #adb5bd;
  transition: color .25s;
}
.ps-item i { font-size: 1rem; flex-shrink: 0; }
.ps-item.active { color: var(--wp-blue); font-weight: 600; }
.ps-item.done   { color: #198754; }

/* Icono giratorio para el paso activo */
.ps-spin { animation: psSpin .8s linear infinite; display: inline-block; }
@keyframes psSpin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .tmpl-grid { grid-template-columns: 1fr; }
  .html-output { min-height: 200px; }
  .wysiwyg-area { min-height: 200px; }
  .navbar .site-badge { display: none; }
}
