:root {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;

  --success: #10b981;
  --success-subtle: #ecfdf5;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

html.dark,
[data-theme="dark"] {
  --bg-primary: #0b0f17;
  --bg-card: #131b2e;
  --bg-card-alt: #1a243b;
  --bg-input: #1a243b;
  --border-color: #24324f;
  --border-focus: #60a5fa;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-subtle: #1e293b;

  --success: #34d399;
  --success-subtle: #064e3b;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.box-title,
.sub-tool-title,
.results-heading,
.faq-section-title {
  font-family: var(--font-heading);
}

.mono {
  font-family: var(--font-mono);
}

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

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

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

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

/* Reloj Epoch en vivo */
.epoch-live-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.epoch-live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.epoch-live-title-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.epoch-live-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.epoch-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.epoch-stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.epoch-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
}

/* Pestañas */
.tool-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tool-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

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

.tool-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Formularios y controles */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .converter-grid {
    grid-template-columns: 1fr;
  }
}

.converter-box {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.box-title {
  font-size: 1.05rem;
  margin: 0;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
}

select.form-control,
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 16px 16px;
  padding-right: 40px;
  cursor: pointer;
  color-scheme: dark light;
}

select option,
select optgroup {
  background-color: var(--bg-card);
  color: var(--text-main);
}

.input-with-badge {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-badge .form-control {
  padding-right: 120px;
}

.badge-unit {
  position: absolute;
  right: 10px;
  font-size: 0.72rem;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  pointer-events: none;
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.quick-examples-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.quick-title {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 3px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-link-action {
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-link-action:hover {
  color: var(--primary-hover);
}

/* Resultados */
.conversion-results {
  margin-top: 1.5rem;
}

.results-heading {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.result-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.result-card.card-full {
  grid-column: 1 / -1;
}

.result-card.highlight-card {
  border-color: var(--primary);
  background: var(--primary-subtle);
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

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

.result-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.btn-copy-inline {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-copy-inline:hover {
  color: var(--primary);
  background: var(--bg-card);
  border-color: var(--border-color);
}

/* Diferencias e intervalos */
.sub-tool-section {
  padding: 0.5rem 0;
}

.sub-tool-title {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.diff-inputs-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 640px) {
  .diff-inputs-grid {
    grid-template-columns: 1fr;
  }
}

.diff-swap-col {
  display: flex;
  justify-content: center;
}

.btn-icon-circle {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.diff-result-card {
  background: var(--primary-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.diff-main-text {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.diff-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
}

.metric-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.metric-num {
  font-weight: 700;
  color: var(--primary);
  margin-right: 4px;
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--border-color);
  margin: 2rem 0;
}

.interval-controls-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .interval-controls-grid {
    grid-template-columns: 1fr;
  }
}

.interval-units-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .interval-units-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.interval-result-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.interval-result-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.35rem 0;
}

.interval-result-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* UUID v7 */
.section-badge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.badge-tag {
  background: var(--primary-subtle);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}

.input-with-action {
  display: flex;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .input-with-action {
    flex-direction: column;
  }
}

.btn-secondary {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.uuid-breakdown-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.uuid-visual-strip {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  padding: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: center;
  margin-bottom: 1.25rem;
  word-break: break-all;
}

.uuid-part.time-part {
  color: var(--primary);
  font-weight: 700;
}

.uuid-part.ver-part {
  color: var(--success);
  font-weight: 700;
}

.uuid-part.var-part {
  color: #f59e0b;
  font-weight: 700;
}

.uuid-part.rand-part {
  color: var(--text-muted);
}

.uuid-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.uuid-detail-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.detail-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.detail-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Chuleta */
.code-snippets-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.snippet-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

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

.code-box {
  margin: 0;
  padding: 1rem;
  background: transparent;
  font-size: 0.85rem;
  overflow-x: auto;
  line-height: 1.45;
  color: var(--text-main);
}

/* Toast de notificación */
.app-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal */
.app-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
  box-sizing: border-box;
}

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

.app-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.app-modal-title {
  margin: 0;
  font-size: 1.1rem;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close:hover {
  color: var(--text-main);
}

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

.app-modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

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

/* FAQ */
.faq-section {
  margin-top: 2.5rem;
  margin-bottom: 2rem;
}

.faq-section-title {
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.faq-item[open] {
  border-color: var(--border-focus);
}

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

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

.faq-chevron {
  transition: transform 0.2s ease;
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.faq-answer p {
  margin: 0;
}
