/* ==========================================================================
   Estilos Canónicos: Simulador de asunto y preheader de email
   Fijate Tools - 2026
   ========================================================================== */

:root {
  --bg-body: #0b0f17;
  --bg-card: #131b2e;
  --bg-card-sub: #1a243b;
  --bg-input: #0f1626;
  --border-color: #24304f;
  --border-focus: #3b82f6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-primary: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-sub: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent-primary: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.18);
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.1);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-main);
  margin-top: 0;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  box-sizing: border-box;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

.card-main {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  margin-bottom: 2rem;
}

/* Presets */
.presets-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.presets-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-preset {
  background: var(--bg-card-sub);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
}

.btn-preset:hover, .btn-preset.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Formulario */
.form-grid-top {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.badge-group {
  display: flex;
  gap: 0.4rem;
}

.char-pill, .word-pill {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.725rem;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.15rem 0.45rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-family: inherit;
  min-height: 44px;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.length-meter-wrapper {
  height: 4px;
  background: var(--bg-card-sub);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.meter-bar {
  height: 100%;
  width: 0%;
  background: var(--success);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.field-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  margin-bottom: 0;
  line-height: 1.4;
}

/* Selector emojis */
.emoji-picker-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  margin-bottom: 1.25rem;
}

.emoji-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.emoji-buttons {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.btn-emoji {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
}

.btn-emoji:hover {
  transform: scale(1.15);
  border-color: var(--accent-primary);
}

/* Auditoría y Score */
.audit-results-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
  margin-top: 1.75rem;
  margin-bottom: 2rem;
}

.score-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.score-circle {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 4px solid var(--success);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.score-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.score-label {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.score-title {
  font-size: 1rem;
  margin: 0 0 0.3rem 0;
}

.score-text {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.35;
}

.spam-card {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.spam-title {
  font-size: 0.95rem;
  margin: 0 0 0.5rem 0;
}

.spam-status-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--success);
}

.spam-status-box.has-spam {
  color: var(--danger);
}

/* Selector de clientes */
.preview-client-selector {
  margin-bottom: 1.25rem;
}

.client-selector-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.client-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-client-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-sub);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 40px;
}

.btn-client-tab:hover, .btn-client-tab.active {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Mockups fotorrealistas */
.inbox-mockup-wrapper {
  background: #000000;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(255,255,255,0.05);
}

/* iPhone */
.mockup-iphone {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  color: #000000;
  border-radius: 36px;
  border: 8px solid #2d3748;
  padding: 0.75rem 1rem 1.5rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.mockup-top-bar {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

.mockup-app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.mockup-header-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.mockup-header-edit {
  color: #007aff;
  font-size: 0.95rem;
  cursor: pointer;
}

.mockup-email-list {
  display: flex;
  flex-direction: column;
}

.email-row {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.email-row.active-email {
  background: rgba(0, 122, 255, 0.05);
  margin: 0 -0.5rem;
  padding: 0.75rem 0.5rem;
  border-radius: 8px;
  border-left: 3px solid #007aff;
}

.email-sender-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.sender-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #000000;
}

.email-date {
  font-size: 0.8rem;
  color: #8e8e93;
}

.email-subject-line {
  font-weight: 600;
  font-size: 0.875rem;
  color: #1c1c1e;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-preheader-line {
  font-size: 0.825rem;
  color: #8e8e93;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Gmail */
.mockup-gmail {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  color: #202124;
  border-radius: 24px;
  border: 6px solid #374151;
  padding: 1rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  font-family: 'Roboto', sans-serif;
}

.gmail-search-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #f1f3f4;
  border-radius: 24px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: #5f6368;
  margin-bottom: 1rem;
}

.gmail-avatar-mini {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1a73e8;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.75rem;
}

.gmail-category-tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: #5f6368;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gmail-email-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.gmail-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ea4335;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.gmail-email-content {
  flex: 1 1 0%;
  min-width: 0;
}

.gmail-header-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.gmail-sender {
  font-weight: 700;
  font-size: 0.9rem;
  color: #202124;
}

.gmail-time {
  font-size: 0.75rem;
  color: #5f6368;
}

.gmail-subject {
  font-weight: 700;
  font-size: 0.85rem;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}

.gmail-snippet {
  font-size: 0.8rem;
  color: #5f6368;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop */
.mockup-desktop {
  width: 100%;
  background: #ffffff;
  color: #202124;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
}

.desktop-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  background: #f2f6fc;
  border-left: 3px solid #1a73e8;
}

.desktop-col-checkbox input {
  cursor: pointer;
}

.desktop-col-star {
  color: #fbbc04;
  cursor: pointer;
}

.desktop-col-sender {
  font-weight: 700;
  font-size: 0.9rem;
  width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.desktop-col-subject-preheader {
  flex: 1 1 0%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.875rem;
}

.desktop-subject {
  font-weight: 700;
  color: #202124;
}

.desktop-hyphen {
  margin: 0 0.3rem;
  color: #5f6368;
}

.desktop-preheader {
  color: #5f6368;
}

.desktop-col-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: #5f6368;
  margin-left: auto;
  flex-shrink: 0;
}

/* Acciones de pie */
.card-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

.btn-copy-all {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-height: 42px;
}

.btn-copy-all:hover {
  background: var(--accent-hover);
}

.btn-copy-all.copied {
  background: var(--success);
}

.btn-reset {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 0.65rem 1.15rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  min-height: 42px;
}

.btn-reset:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.modal-message {
  color: var(--text-muted);
  font-size: 0.925rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.btn-modal-cancel {
  background: var(--bg-card-sub);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 1.15rem;
  font-size: 0.875rem;
  cursor: pointer;
  min-height: 40px;
}

.btn-modal-confirm {
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  .form-grid-top {
    grid-template-columns: 1fr;
  }
  .audit-results-grid {
    grid-template-columns: 1fr;
  }
  .client-tabs {
    flex-direction: column;
  }
  .btn-client-tab {
    width: 100%;
    justify-content: center;
  }
  .btn-copy-all, .btn-reset {
    width: 100%;
    justify-content: center;
  }
}
