/* ============================================================
   Time Zone Converter - page-scoped visual refresh
   Load order: main.css -> dev-tools.css -> this file.
   Only selectors used by time-zone-converter.html live here.
   ============================================================ */

/* ---------- Section copy ---------- */
/* language.js writes the translated string onto the heading's leading
   whitespace node, which lands before the inline icon; order keeps it first. */
.converter-section > .section-title > svg {
    order: -1;
    align-self: flex-start;
    margin-top: 3px;
    flex-shrink: 0;
}

.converter-section > .section-subtitle {
    margin: -6px 0 20px;
    font-size: 14.5px;
    line-height: 1.7;
    color: #5f6368;
}

/* ---------- Quick-start presets ---------- */
.mp-presets {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e8eef7;
    border-radius: 12px;
}

.mp-preset-label {
    margin-right: 4px;
    font-weight: 600;
    font-size: 13px;
    color: #5f6368;
}

.mp-presets .mp-preset-btn {
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
    color: #1a73e8;
    background: #eef4ff;
    border: 1px solid #d7e5ff;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease,
                box-shadow 0.15s ease, transform 0.1s ease;
}

.mp-presets .mp-preset-btn:hover {
    background: #e0edfe;
    border-color: #a8c7fa;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
    transform: translateY(-1px);
}

.mp-presets .mp-preset-btn:active {
    transform: translateY(0);
}

.mp-presets .mp-preset-btn:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* ---------- Search ---------- */
.tz-search-wrap {
    margin-bottom: 14px;
}

.tz-search-wrap .tz-search-input {
    padding: 11px 14px 11px 40px;
    font-size: 14px;
    color: #1f2937;
    background-color: #fff;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%239ca3af'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    background-size: 16px;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[dir="rtl"] .tz-search-wrap .tz-search-input {
    padding: 11px 40px 11px 14px;
    background-position: right 14px center;
}

.tz-search-wrap .tz-search-input:hover {
    border-color: #a8c7fa;
}

.tz-search-wrap .tz-search-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.tz-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

/* One shared control height keeps the search box, selects, date/time inputs
   and the action buttons on the same baseline. Buttons use min-height so a
   long translated label can still grow instead of being clipped. */
.tz-search-wrap .tz-search-input,
.tz-zone-row .tz-field select,
.tz-zone-row .tz-field input {
    height: 46px;
}

.dev-tool-actions .dev-tool-btn {
    min-height: 46px;
}

.tz-search-results {
    max-height: 320px;
    overflow-y: auto;
    border-color: #d0d7de;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.tz-search-results::-webkit-scrollbar {
    width: 8px;
}

.tz-search-results::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.tz-search-results::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}

.tz-search-item {
    padding: 10px 14px;
    transition: background 0.12s ease;
}

.tz-search-item:hover {
    background: #f8fafc;
}

.tz-search-name {
    font-size: 0.92rem;
    font-weight: 500;
}

.tz-search-pick {
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: #1a73e8;
    border: 1px solid #1a73e8;
    border-radius: 6px;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tz-search-pick:hover {
    background: #1765cc;
    border-color: #1765cc;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.25);
}

.tz-search-empty {
    padding: 12px 14px;
    font-size: 0.88rem;
}

/* ---------- Zone fields ---------- */
.tz-zone-row {
    gap: 14px;
    margin-bottom: 14px;
}

.tz-zone-row.tz-datetime-row {
    margin-top: 0;
    margin-bottom: 0;
}

.tz-field {
    gap: 7px;
}

.tz-field .dev-tool-label {
    margin-bottom: 0;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.01em;
}

.tz-zone-row .tz-field select,
.tz-zone-row .tz-field input {
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    background-color: #fff;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tz-zone-row .tz-field select {
    padding-right: 38px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236b7280'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

[dir="rtl"] .tz-zone-row .tz-field select {
    padding: 11px 14px 11px 38px;
    background-position: left 12px center;
}

.tz-zone-row .tz-field select:hover,
.tz-zone-row .tz-field input:hover {
    border-color: #a8c7fa;
}

.tz-zone-row .tz-field select:focus,
.tz-zone-row .tz-field input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.tz-field input[type="date"]::-webkit-calendar-picker-indicator,
.tz-field input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.tz-field input[type="date"]:hover::-webkit-calendar-picker-indicator,
.tz-field input[type="time"]:hover::-webkit-calendar-picker-indicator {
    opacity: 1;
}

/* ---------- Swap ---------- */
.tz-swap-wrap {
    padding-bottom: 1px;
}

.tz-swap-btn {
    width: 46px;
    height: 46px;
    background: #fff;
    border-color: #d0d7de;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    transition: background 0.15s ease, border-color 0.15s ease,
                box-shadow 0.15s ease, transform 0.25s ease;
}

.tz-swap-btn:hover {
    background: #eef4ff;
    border-color: #1a73e8;
    box-shadow: 0 4px 10px rgba(26, 115, 232, 0.2);
    transform: rotate(180deg);
}

.tz-swap-btn:active {
    transform: rotate(180deg) scale(0.94);
}

.tz-swap-btn:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

.tz-swap-btn svg {
    width: 20px;
    height: 20px;
}

/* RTL swaps between a field on the right and one on the left. */
[dir="rtl"] .tz-swap-btn svg {
    transform: scaleX(-1);
}

/* ---------- Action buttons ---------- */
.dev-tool-actions {
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed #e3e6ea;
}

.dev-tool-actions .dev-tool-btn {
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    transition: background 0.15s ease, border-color 0.15s ease,
                box-shadow 0.15s ease, transform 0.1s ease;
}

.dev-tool-actions .dev-tool-btn.ghost:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.28);
}

.dev-tool-actions .dev-tool-btn.ghost {
    background: #fff;
    border-color: #d7e5ff;
}

.dev-tool-actions .dev-tool-btn.ghost:hover {
    background: #eef4ff;
    border-color: #1a73e8;
}

/* ---------- Result card ---------- */
.tz-result {
    position: relative;
    margin-top: 22px;
    padding: 24px 26px;
    background: linear-gradient(135deg, #1a73e8 0%, #0f5bc4 100%);
    border-radius: 14px;
    box-shadow: 0 10px 24px -6px rgba(26, 115, 232, 0.4),
                0 4px 10px -4px rgba(26, 115, 232, 0.2);
    overflow: hidden;
    gap: 8px;
}

/* Soft glow so the card reads as the page's focal point. */
.tz-result::after {
    content: "";
    position: absolute;
    top: -70px;
    inset-inline-end: -70px;
    width: 210px;
    height: 210px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
    pointer-events: none;
}

.tz-result > * {
    position: relative;
    z-index: 1;
}

.tz-result-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    opacity: 1;
}

.tz-result-zone {
    padding: 2px 9px;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    opacity: 1;
}

.tz-result-zone:empty {
    display: none;
}

.tz-result-time {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tz-result-date {
    font-size: 14.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    opacity: 1;
}

.tz-result-date:empty {
    display: none;
}

.tz-result-from {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.8);
    opacity: 1;
}

/* ---------- Status ---------- */
.dev-tool-status {
    margin-bottom: 14px;
    border-radius: 10px;
    font-size: 13.5px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .mp-presets {
        padding: 10px 12px;
        gap: 8px;
    }

    .tz-zone-row {
        gap: 12px;
        margin-bottom: 12px;
    }

    .tz-swap-wrap {
        padding: 2px 0;
    }

    /* One-column layout: the sideways arrow should point down the stack. */
    .tz-swap-btn svg,
    [dir="rtl"] .tz-swap-btn svg {
        transform: rotate(90deg);
    }

    .tz-swap-btn:hover {
        transform: none;
    }

    .dev-tool-actions {
        flex-direction: column;
        gap: 8px;
        margin-top: 16px;
        padding-top: 14px;
    }

    .tz-result {
        padding: 20px 22px;
        border-radius: 12px;
    }

    .tz-result-time {
        font-size: 2rem;
    }

    .converter-section > .section-subtitle {
        font-size: 13.5px;
    }
}

@media (max-width: 480px) {
    .mp-presets .mp-preset-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .tz-result-time {
        font-size: 1.8rem;
    }

    /* 16px keeps iOS from zooming into the field on focus. */
    .tz-zone-row .tz-field select,
    .tz-zone-row .tz-field input,
    .tz-search-wrap .tz-search-input {
        font-size: 16px;
    }

    .tz-zone-row .tz-field select {
        padding-right: 36px;
    }

    [dir="rtl"] .tz-zone-row .tz-field select {
        padding: 11px 14px 11px 36px;
    }
}

/* ---------- Time difference line ---------- */
.tz-result-diff {
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.92);
    opacity: 1;
}

.tz-result-diff:empty {
    display: none;
}

/* ---------- 24-hour comparison strip ---------- */
.tz-hour-strip[hidden],
.tz-copy-menu[hidden] {
    display: none;
}

.tz-hour-strip {
    margin-top: 16px;
    padding: 14px 16px 16px;
    background: #fff;
    border: 1px solid #e8eef7;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.tz-hour-strip-head {
    margin-bottom: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #475569;
}

.tz-hour-scroll {
    overflow-x: auto;
    padding-bottom: 4px;
}

/* Hours always read 00 -> 23 left to right, even on RTL pages. */
.tz-hour-grid {
    display: grid;
    /* Desktop fits all 24 hours in the card; below 768px the cells grow back
       to a comfortable tap target and the strip scrolls horizontally. */
    grid-template-columns: 52px repeat(24, minmax(0, 1fr));
    gap: 2px;
    align-items: center;
    direction: ltr;
    width: 100%;
}

.tz-hour-row-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    unicode-bidi: plaintext;
    white-space: nowrap;
}

.tz-hour-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    border: 1px solid #e8eef7;
    border-radius: 6px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    color: #334155;
    background: #f8fafc;
}

button.tz-hour-cell {
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

button.tz-hour-cell:hover {
    background: #e0edfe;
    border-color: #a8c7fa;
}

button.tz-hour-cell:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.28);
}

.tz-hour-cell-to {
    background: #eef4ff;
    color: #1a73e8;
}

.tz-hour-cell.is-active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff;
    font-weight: 700;
}

/* ---------- Copy format menu ---------- */
.tz-copy-wrap {
    position: relative;
}

.tz-copy-menu {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + 6px);
    z-index: 5;
    min-width: 190px;
    padding: 6px;
    background: #fff;
    border: 1px solid #d7e5ff;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.tz-copy-menu button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #1f2937;
    font-size: 13px;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}

.tz-copy-menu button:hover,
.tz-copy-menu button:focus-visible {
    outline: none;
    background: #eef4ff;
    color: #1a73e8;
}

@media (max-width: 768px) {
    .tz-copy-wrap {
        width: 100%;
    }

    .tz-copy-menu {
        inset-inline-end: 0;
    }

    .tz-hour-strip {
        padding: 12px 12px 14px;
    }

    .tz-hour-grid {
        grid-template-columns: 52px repeat(24, 34px);
        gap: 3px;
        width: max-content;
    }

    .tz-hour-cell {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tz-swap-btn,
    .tz-swap-btn:hover,
    .mp-presets .mp-preset-btn:hover,
    button.tz-hour-cell {
        transition: none;
        transform: none;
    }
}
