/* Styles specific to the time tool group. */

/* ---------- timestamp converter ---------- */

.timestamp-live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    margin-left: 4px;
    animation: timestamp-live-pulse 1.6s ease-in-out infinite;
}

@keyframes timestamp-live-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63, 221, 154, 0.55); opacity: 1; }
    50% { box-shadow: 0 0 0 6px rgba(63, 221, 154, 0); opacity: 0.65; }
}

.timestamp-now-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 2px;
    border-bottom: 1px solid var(--border);
}

.timestamp-now-row:last-child {
    border-bottom: none;
}

.timestamp-now-label {
    width: 110px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-dim);
}

.timestamp-now-value {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 14px;
    word-break: break-all;
}

.timestamp-now-primary {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.timestamp-now-row .icon-button {
    width: 28px;
    height: 28px;
}

.timestamp-tick {
    animation: timestamp-tick 0.5s ease-out;
}

@keyframes timestamp-tick {
    0% { color: #fff; text-shadow: 0 0 14px hsl(var(--accent-h) 90% 70% / 0.9); }
}

.timestamp-kv-key {
    padding: 6px 12px;
    font-size: 12.5px;
}

.timestamp-kv-value {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12.5px;
}

.timestamp-kv-value > span:first-child {
    flex: 1;
    min-width: 0;
}

.timestamp-kv-value .icon-button {
    width: 26px;
    height: 26px;
}

/* ---------- cron helper ---------- */

.cron-expression-input {
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
}

.cron-field-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.cron-field-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    text-align: center;
    transition: border-color 0.25s, transform 0.25s var(--ease-spring), box-shadow 0.25s;
}

.cron-field-label {
    font-size: 10px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-faint);
}

.cron-field-raw {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    word-break: break-all;
}

.cron-field-meaning {
    font-size: 11.5px;
    color: var(--text-dim);
    line-height: 1.4;
}

.cron-field-active {
    border-color: var(--accent-border);
    transform: translateY(-3px);
    animation: cron-field-ring 1.4s ease-out infinite;
}

@keyframes cron-field-ring {
    0% { box-shadow: 0 0 0 0 hsl(var(--accent-h) 90% 60% / 0.45); }
    70% { box-shadow: 0 0 0 9px hsl(var(--accent-h) 90% 60% / 0); }
    100% { box-shadow: 0 0 0 0 hsl(var(--accent-h) 90% 60% / 0); }
}

.cron-field-error {
    border-color: rgba(255, 100, 116, 0.6);
}

.cron-field-error .cron-field-raw {
    color: var(--err);
}

.cron-field-error .cron-field-meaning {
    color: var(--err);
}

.cron-sentence {
    min-height: 22px;
    font-size: 15px;
    text-align: center;
    color: var(--text);
    margin-top: 12px;
}

.cron-fill-flash {
    animation: cron-fill-flash 0.55s ease-out;
}

@keyframes cron-fill-flash {
    0% { background-color: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
}

.cron-next-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border);
    animation: cron-item-in 0.4s var(--ease-out) both;
    animation-delay: calc(var(--i) * 70ms);
}

.cron-next-item:last-child {
    border-bottom: none;
}

@keyframes cron-item-in {
    from { opacity: 0; transform: translateX(-12px); }
    to { opacity: 1; transform: translateX(0); }
}

.cron-next-index {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.cron-next-date {
    flex: 1;
    font-size: 13.5px;
}

@media (max-width: 860px) {
    .cron-field-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---------- timezone calculator ---------- */

.timezone-row {
    display: grid;
    grid-template-columns: 150px 118px 1fr 30px;
    gap: 12px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    animation: timezone-row-in 0.45s var(--ease-out) both;
    animation-delay: calc(var(--i) * 60ms);
}

.timezone-row:last-child {
    border-bottom: none;
}

@keyframes timezone-row-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.timezone-row-leaving {
    animation: timezone-row-out 0.28s ease-in both;
}

@keyframes timezone-row-out {
    to { opacity: 0; transform: translateX(28px); }
}

.timezone-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.timezone-city {
    font-weight: 650;
    font-size: 13.5px;
    line-height: 1.2;
}

.timezone-zone-id {
    font-size: 10px;
    color: var(--text-faint);
    word-break: break-all;
    line-height: 1.2;
}

.timezone-offset {
    font-size: 10.5px;
    padding: 1px 8px;
}

.timezone-clock {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.timezone-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.timezone-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--text-dim);
}

.timezone-day-badge {
    font-size: 10.5px;
    padding: 1px 7px;
}

.timezone-bar {
    position: relative;
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 2px;
    height: 22px;
}

.timezone-cell {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1px;
    border-radius: 4px;
    background: rgba(160, 180, 220, 0.1);
    font-family: var(--font-mono);
    font-size: 8.5px;
    color: var(--text-faint);
    cursor: pointer;
    user-select: none;
    transition: background 0.18s, transform 0.18s;
}

.timezone-cell:hover {
    transform: translateY(-2px);
}

.timezone-cell-night {
    background: rgba(6, 8, 16, 0.8);
}

.timezone-cell-work {
    background: var(--accent-soft);
}

.timezone-cell-hot {
    background: hsl(var(--accent-h) 90% 62% / 0.5) !important;
    box-shadow: 0 0 10px hsl(var(--accent-h) 90% 62% / 0.45);
    color: #fff;
}

.timezone-marker {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 2px;
    border-radius: 2px;
    background: #fff;
    box-shadow: 0 0 8px hsl(var(--accent-h) 90% 70% / 0.9);
    transition: left 0.45s var(--ease-out);
    pointer-events: none;
}

.timezone-remove {
    width: 28px;
    height: 28px;
}

.timezone-now-spin .icon {
    animation: timezone-spin 0.55s var(--ease-out);
}

@keyframes timezone-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
    .timezone-row {
        grid-template-columns: 1fr auto 30px;
    }

    .timezone-bar {
        grid-column: 1 / -1;
    }
}

/* ---------- url parser ---------- */

.url-parser-breakdown {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.9;
    word-break: break-all;
}

.url-parser-part {
    position: relative;
    padding: 2px 3px;
    border-radius: 5px;
}

.url-parser-part::after {
    content: '';
    position: absolute;
    left: 3px;
    right: 3px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease-out);
}

.url-parser-part-hot {
    filter: brightness(1.3);
}

.url-parser-part-hot::after {
    transform: scaleX(1);
}

.url-parser-part-dim {
    color: var(--text-faint);
}

.url-parser-part-scheme { color: hsl(187 85% 68%); background: hsl(187 85% 55% / 0.13); }
.url-parser-part-user { color: hsl(262 85% 76%); background: hsl(262 85% 62% / 0.15); }
.url-parser-part-host { color: hsl(215 90% 72%); background: hsl(215 90% 60% / 0.14); }
.url-parser-part-port { color: hsl(42 95% 66%); background: hsl(42 95% 55% / 0.13); }
.url-parser-part-path { color: hsl(152 75% 62%); background: hsl(152 75% 50% / 0.13); }
.url-parser-part-query { color: hsl(315 80% 72%); background: hsl(315 80% 60% / 0.14); }
.url-parser-part-fragment { color: hsl(350 90% 72%); background: hsl(350 90% 60% / 0.14); }

.url-parser-legend-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 11px;
    animation: chip-in 0.3s var(--ease-spring) both;
}

.url-parser-kv-key {
    padding: 6px 12px;
    font-size: 12.5px;
    transition: background 0.15s;
}

.url-parser-kv-value {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12.5px;
    transition: background 0.15s;
}

.url-parser-kv-value > span:first-child {
    flex: 1;
    min-width: 0;
}

.url-parser-kv-value .icon-button {
    width: 26px;
    height: 26px;
}

.url-parser-row-hot {
    background: var(--bg-raised-hover) !important;
}

.url-parser-param-input {
    padding: 6px 9px;
    font-size: 12.5px;
    min-width: 130px;
}

/* ---------- subnet calculator ---------- */

.subnet-bits {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 2px;
}

.subnet-octet {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.subnet-octet-label {
    text-align: center;
    font-size: 13px;
    font-weight: 650;
    color: var(--text-dim);
}

.subnet-bit-row {
    display: flex;
    gap: 3px;
}

.subnet-bit {
    width: 23px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.subnet-bit-network {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: hsl(var(--accent-h) 85% 76%);
}

.subnet-bit-flip {
    animation: subnet-bit-flip 0.35s var(--ease-spring);
}

@keyframes subnet-bit-flip {
    45% { transform: scale(1.22); }
}

.subnet-divider {
    position: absolute;
    top: 24px;
    bottom: 2px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(var(--accent), hsl(var(--accent-h) 90% 72%));
    box-shadow: 0 0 12px hsl(var(--accent-h) 90% 60% / 0.8);
    transition: left 0.45s var(--ease-spring);
    pointer-events: none;
}

.subnet-kv-key {
    padding: 6px 12px;
    font-size: 12.5px;
}

.subnet-kv-value {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12.5px;
}

.subnet-kv-value > span:first-child {
    flex: 1;
    min-width: 0;
}

.subnet-kv-value .icon-button {
    width: 26px;
    height: 26px;
}

/* ---------- unit converter ---------- */

.units-row {
    display: grid;
    grid-template-columns: 84px 1fr 1.15fr 34px 1.15fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    animation: units-row-in 0.4s var(--ease-out) both;
    animation-delay: calc(var(--i) * 50ms);
}

.units-row:last-child {
    border-bottom: none;
}

@keyframes units-row-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.units-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: hsl(var(--units-hue) 80% 72%);
}

.units-category::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: hsl(var(--units-hue) 85% 60%);
    box-shadow: 0 0 8px hsl(var(--units-hue) 85% 60% / 0.7);
}

.units-row .units-value {
    padding: 8px 10px;
    font-size: 14px;
}

.units-row select {
    padding: 8px 26px 8px 9px;
    font-size: 12px;
}

.units-row .units-swap {
    width: 30px;
    height: 30px;
}

.units-pair {
    color: hsl(var(--units-hue) 80% 72%);
    border-color: hsl(var(--units-hue) 80% 60% / 0.35);
    background: hsl(var(--units-hue) 80% 60% / 0.1);
}

.units-pair:hover {
    color: hsl(var(--units-hue) 85% 80%);
    border-color: hsl(var(--units-hue) 80% 65% / 0.6);
}

@media (max-width: 860px) {
    .units-row {
        grid-template-columns: 1fr 1.15fr 34px 1.15fr 1fr;
    }

    .units-category {
        grid-column: 1 / -1;
    }
}
