/**
 * ITPlatform Tools - CRON Generator
 * Tool-specific CSS — ONLY what base.css does not cover.
 *
 * NOTE: .mode-tabs, .mode-tab, .mode-panel, .result-section, .result-label,
 * .result-value, .copy-button are already defined in base.css V2.
 * Only tool-specific overrides and new components are defined here.
 */

/* ============================================================
   Override: .tool-result
   base.css sets white-space: pre-wrap + font-mono globally.
   The result section uses a mix of structured blocks and
   monospace values — we neutralize the global pre-wrap here
   and apply it selectively via .result-value.
   ============================================================ */
.tool-result {
  white-space: normal;
  font-family: var(--font-sans);
}

/* ============================================================
   Interface blocks — compact layout
   ============================================================ */

/* Reduce section-level spacing from base.css 48px to 28px */
.tool-interface,
.tool-result,
.tool-explanation,
.tool-best-practices,
.tool-context {
  margin-bottom: 28px;
}

.tool-interface {
  padding: var(--space-lg);
}

/* Interface blocks separate the 3 logical groups */
.interface-block {
  padding-bottom: var(--space-lg);
  margin-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.interface-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Block titles */
.block-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-md) 0;
}

.optional-label {
  font-weight: 400;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ============================================================
   Compact field-group inside tool-interface
   base.css uses margin-bottom: 20px — reduce to 12px here
   ============================================================ */
.tool-interface .field-group {
  margin-bottom: var(--space-md);
}

.tool-interface .field-group:last-child {
  margin-bottom: 0;
}

/* field-help: reduce top gap */
.tool-interface .field-help {
  margin: 2px 0 var(--space-xs) 0;
}

/* ============================================================
   Advanced mode — 5-field grid
   ============================================================ */
.cron-fields-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.cron-fields-grid .field-group {
  margin-bottom: 0;
}

/* Compact label in the 5-field grid */
.cron-fields-grid label {
  font-size: var(--text-sm);
  margin-bottom: 4px;
}

/* Advanced syntax hint */
.advanced-help {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-warning-bg);
  border-left: 3px solid #f59e0b;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  margin-top: var(--space-xs);
  line-height: var(--leading-normal);
}

/* ============================================================
   Options grid (advanced options — 2 columns)
   ============================================================ */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 var(--space-xl);
}

.options-grid .field-group {
  margin-bottom: var(--space-md);
}

/* ============================================================
   Monospace shorthand for inputs
   ============================================================ */
.font-mono {
  font-family: var(--font-mono);
}

/* ============================================================
   Result blocks
   ============================================================ */

/* result-block = compact sub-section inside .tool-result */
.result-block {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
}

.result-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Row: label + copy button side by side */
.result-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

/* Compact result label (no bottom margin, handled by parent) */
.result-block .result-label {
  margin-bottom: 0;
}

/* Translation text */
.result-translation {
  margin: var(--space-xs) 0 0 0;
  font-size: var(--text-md);
  color: var(--color-text);
  line-height: var(--leading-normal);
  font-family: var(--font-sans);
}

/* Next-runs list — compact */
.result-next-runs {
  list-style: none;
  padding: 0;
  margin: var(--space-xs) 0 0 0;
}

.result-next-runs li {
  padding: 3px 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: 0;
  line-height: var(--leading-normal);
}

/* Full crontab line — multiline monospace block */
.result-value-full {
  white-space: pre;
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

/* Highlight block (full crontab line / file) */
.result-block-highlight .result-value {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

/* ============================================================
   Responsive adjustments
   ============================================================ */
@media (max-width: 640px) {
  .cron-fields-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cron-fields-grid .field-group:last-child {
    grid-column: 1 / -1;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .result-block-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }
}
