/* ==========================================================================
   Generador y traductor de expresiones cron - Estilos visuales
   ========================================================================== */

:root {
  --primary-color: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-light: rgba(14, 165, 233, 0.15);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  --bg-app: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-header: #19243d;
  --bg-input: #0f172a;
  --border-color: #1e293b;
  --border-color-focus: #0ea5e9;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-header: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-color-focus: #0ea5e9;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-wrapper {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.tool-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  align-items: start;
}

.tool-main-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Hero */
.tool-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.tool-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 20px;
  margin-bottom: 12px;
}

.tool-hero h2 {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Bloque Expresión Principal */
.cron-display-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.cron-expression-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.cron-input-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cron-input-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.cron-main-input {
  background: var(--bg-input);
  color: var(--primary-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  outline: none;
  transition: border-color 0.2s;
}

.cron-main-input:focus {
  border-color: var(--border-color-focus);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  background: var(--primary-color);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* Desglose de chips */
.cron-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.breakdown-chip {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}

.chip-val {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 2px;
}

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

/* Traducción */
.cron-human-translation {
  background: var(--primary-light);
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.translation-icon {
  color: var(--primary-color);
  display: flex;
}

.translation-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Presets */
.presets-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.presets-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.presets-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-btn:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

/* Constructor por pestañas */
.builder-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.builder-nav {
  display: flex;
  background: var(--bg-card-header);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.builder-tab {
  padding: 12px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}

.builder-tab:hover {
  color: var(--text-main);
}

.builder-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: var(--bg-card);
}

.builder-content {
  padding: 20px;
}

.radio-option {
  margin-bottom: 16px;
  font-size: 0.92rem;
  color: var(--text-main);
}

.radio-option label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-num-input {
  width: 54px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--primary-color);
  font-family: var(--font-mono);
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  text-align: center;
  outline: none;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.checkbox-grid-names {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.cb-item {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}

.cb-item:hover {
  border-color: var(--primary-color);
}

.cb-item.selected {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
  font-weight: 700;
}

/* Próximas ejecuciones */
.executions-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.executions-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--primary-color);
}

.executions-header h3 {
  font-size: 1.1rem;
  color: var(--text-main);
}

.executions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.exec-item {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.exec-idx {
  background: var(--bg-card-header);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.exec-date {
  font-family: var(--font-mono);
  color: var(--text-main);
}

/* Generador de comando terminal */
.command-generator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.command-header h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.cmd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.cmd-field label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.cmd-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.command-preview-box {
  background: #060911;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.command-preview-box code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8;
  word-break: break-all;
}

.btn-copy-cmd {
  background: var(--bg-card-header);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy-cmd:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

/* FAQ & Sidebar & Modal standard */
.faq-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.faq-section h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-card-header);
}

.faq-question {
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question svg {
  transition: transform 0.2s;
  color: var(--primary-color);
}

.faq-item[open] .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 16px 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.tool-sidebar {
  width: 300px;
}

.ad-sidebar-wrapper {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ad-sidebar-card {
  width: 300px;
  min-height: 600px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-dev-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
}

.ad-size-badge {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: var(--bg-card-header);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.btn-modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px 18px;
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
}

.modal-footer {
  padding: 12px 18px;
  background: var(--bg-card-header);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--primary-color);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .tool-with-sidebar {
    grid-template-columns: 1fr;
  }
  .tool-sidebar {
    width: 100%;
  }
  .ad-sidebar-card {
    width: 100%;
    min-height: 250px;
  }
}

@media (max-width: 640px) {
  .cron-breakdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .cron-expression-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
