/* DevFix — Timestamp Converter (UI/UX refinado) */

.ts-shell {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px 24px 26px;
    box-shadow: var(--shadow-sm);
}

.ts-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.ts-head-copy {
    min-width: 0;
}

.ts-head h2 {
    margin: 0 0 8px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(1.28rem, 2vw, 1.78rem);
    letter-spacing: -0.02em;
}

.ts-head p {
    margin: 0;
    max-width: 52rem;
    color: var(--text-secondary);
    line-height: 1.55;
    font-size: 0.94rem;
}

/* ── Tempo real ── */
.ts-live-card {
    background: linear-gradient(165deg, var(--bg-raised) 0%, var(--bg-surface) 100%);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 18px 18px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.ts-live-card-top {
    margin-bottom: 14px;
}

.ts-live-kicker {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 6px;
}

.ts-live-lede {
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.45;
    max-width: 48rem;
}

.ts-live-card-body {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 20px;
}

.ts-live-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    flex: 1 1 280px;
    min-width: 0;
}

.ts-metric-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px 13px;
    min-height: 68px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ts-metric-chip--wide {
    grid-column: span 1;
}

.ts-metric-label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ts-metric-value {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ts-metric-value--sm {
    font-size: 0.82rem;
    font-weight: 600;
}

.ts-live-cta {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.ts-live-cta .ts-btn {
    min-width: 160px;
    justify-content: center;
}

/* ── Botões (escopo só desta ferramenta) ── */
.ts-shell .ts-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: var(--r-md);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.18s var(--ease), background 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), color 0.18s var(--ease);
    white-space: nowrap;
}

.ts-shell .ts-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-color: var(--accent);
}

.ts-btn-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

.ts-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-sm);
}

.ts-btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--text-on-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.ts-btn-secondary {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.ts-btn-secondary:hover {
    background: var(--bg-surface);
    transform: translateY(-1px);
}

.ts-btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}

.ts-btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--bg-raised);
}

.ts-btn-sm {
    min-height: 38px;
    padding: 0 14px;
    font-size: 0.82rem;
}

/* ── Grelha principal ── */
.ts-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ts-panel {
    min-width: 0;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 18px 20px 20px;
}

.ts-panel-head {
    margin-bottom: 16px;
}

.ts-panel-head--compact {
    margin-bottom: 0;
}

.ts-panel-title {
    margin: 0 0 6px;
    color: var(--text-primary);
    font-size: 1.02rem;
    font-weight: 800;
}

.ts-panel-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.ts-panel-desc strong {
    color: var(--text-secondary);
    font-weight: 700;
}

.ts-subheading {
    margin: 18px 0 10px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.ts-label {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 800;
}

.ts-input {
    width: 100%;
    box-sizing: border-box;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 11px 13px;
    outline: none;
    font-size: 0.9rem;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.ts-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.ts-input::placeholder {
    color: var(--text-muted);
    opacity: 0.85;
}

/* Barra de ações */
.ts-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 14px;
    margin: 16px 0 0;
}

.ts-actions--block {
    margin-top: 14px;
    justify-content: flex-start;
}

.ts-actions-main {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ts-actions-extra {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.ts-actions--block .ts-actions-main {
    width: 100%;
}

.ts-actions--block .ts-actions-main .ts-btn {
    flex: 1 1 auto;
    min-width: min(100%, 200px);
}

/* Resultado timestamp → data */
.ts-result-card {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-glow);
    border-radius: var(--r-md);
}

.ts-result-card strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.88rem;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.ts-result-card span {
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.45;
}

.ts-timezone-list,
.ts-history-list {
    display: grid;
    gap: 8px;
}

.ts-zone-row {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 13px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
}

.ts-zone-row strong {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.ts-zone-row span {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

.ts-date-output {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.ts-date-output > div {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px 13px;
}

.ts-date-output span {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ts-date-output strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

/* Diferença */
.ts-diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
}

.ts-diff-output-card {
    margin-top: 14px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    min-height: 72px;
    display: grid;
    gap: 6px;
    align-content: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
}

.ts-diff-output-card strong {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 800;
}

/* Histórico */
.ts-history-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.ts-history-toolbar .ts-panel-head {
    min-width: 0;
}

.ts-history-list {
    max-height: 280px;
    overflow: auto;
    padding-right: 2px;
}

.ts-history-item {
    display: grid;
    gap: 5px;
    width: 100%;
    padding: 13px 14px;
    color: var(--text-secondary);
    text-align: left;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    cursor: pointer;
    font: inherit;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.ts-history-item:hover {
    border-color: var(--accent);
    background: var(--bg-raised);
}

.ts-history-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-color: var(--accent);
}

.ts-history-item strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    overflow-wrap: anywhere;
}

.ts-history-item span,
.ts-empty {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.ts-empty {
    margin: 0;
    padding: 12px 4px;
    text-align: center;
}

@media (max-width: 1020px) {
    .ts-live-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .ts-metric-chip--wide {
        grid-column: span 2;
    }

    .ts-live-cta {
        width: 100%;
    }

    .ts-live-cta .ts-btn {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .ts-grid,
    .ts-diff-grid {
        grid-template-columns: 1fr;
    }

    .ts-actions-extra {
        margin-left: 0;
        width: 100%;
    }

    .ts-actions-extra .ts-btn {
        flex: 1;
        justify-content: center;
    }

    .ts-actions-main {
        width: 100%;
    }

    .ts-actions-main .ts-btn {
        flex: 1;
        justify-content: center;
    }

    .ts-zone-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .ts-live-metrics {
        grid-template-columns: 1fr;
    }

    .ts-metric-chip--wide {
        grid-column: span 1;
    }

    .ts-shell {
        padding: 16px 16px 20px;
    }

    .ts-head {
        flex-direction: column;
    }
}
