/**
 * Publish Package tab styles (isolated).
 *
 * Every selector is scoped to `#publish` so nothing leaks into other tabs.
 */

/* ---------- Searchable select (package picker) ---------- */
#publish .searchable-select {
    position: relative;
}

#publish .searchable-select > .form-input {
    padding-right: 36px;
}

#publish .searchable-select::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid #8a99ad;
    border-bottom: 2px solid #8a99ad;
    transform: translateY(-75%) rotate(45deg);
    pointer-events: none;
    transition: transform 0.2s;
}

#publish .searchable-select.is-open::after {
    transform: translateY(-25%) rotate(-135deg);
}

#publish ul.searchable-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    max-height: 240px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 4px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

#publish ul.searchable-select-options > li.searchable-select-option,
#publish ul.searchable-select-options > li.searchable-select-empty {
    list-style: none;
    margin: 0;
    padding: 8px 12px;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #1f2937;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#publish ul.searchable-select-options > li.searchable-select-option:hover,
#publish ul.searchable-select-options > li.searchable-select-option.is-active {
    background: #eaf3fc;
    color: #1f2937;
}

#publish ul.searchable-select-options > li.searchable-select-option.is-selected {
    background: #d6e8fa;
    font-weight: 600;
}

#publish ul.searchable-select-options > li.searchable-select-empty {
    color: #8a99ad;
    font-style: italic;
    cursor: default;
}

/* ---------- Form helpers ---------- */
#publish .hint {
    display: block;
    margin-top: 6px;
    color: #8a99ad;
    font-size: 12px;
    font-weight: normal;
}

#publish-pat,
#publish-target-pat,
#publish-version {
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    letter-spacing: 0.3px;
}

#publish .form-group label {
    color: #334155;
}

#publish .publish-same-pat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f7f9fc;
    border: 1px solid #d0d7de;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#publish .publish-same-pat-toggle:hover {
    background: #eaf3fc;
    border-color: #4a90e2;
}

#publish .publish-same-pat-toggle input[type="checkbox"] {
    margin: 0;
    width: 14px;
    height: 14px;
    accent-color: #4a90e2;
    cursor: pointer;
}

#publish .publish-same-pat-toggle:has(input[type="checkbox"]:checked) {
    background: #e3f0fc;
    border-color: #4a90e2;
    color: #195a9c;
}

#publish input#publish-target-pat:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

#publish .hint code {
    background: #eef0f3;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 11.5px;
}

/* ---------- Actions ---------- */
#publish .publish-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

#publish-submit-btn {
    padding: 10px 24px;
    font-weight: 600;
}

#publish-submit-btn:disabled,
#publish-reset-btn:disabled {
    background: #b6c4d4;
    cursor: not-allowed;
    color: #fff;
    border-color: transparent;
}

#publish-reset-btn {
    background: #fff;
    color: #4a90e2;
    border: 1px solid #4a90e2;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

#publish-reset-btn:hover:not(:disabled) {
    background: #eaf3fc;
    color: #3a7bc8;
    border-color: #3a7bc8;
}

/* ---------- Feed banner ---------- */
#publish .publish-feeds {
    margin: 12px 0 16px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #f4f6f8;
    border-left: 3px solid #4a90e2;
    font-size: 13px;
    color: #334155;
    display: flex;
    flex-direction: column;
    gap: 2px;
    word-break: break-all;
}

#publish .publish-feeds.hidden {
    display: none;
}

/* ---------- Progress ---------- */
#publish .publish-progress {
    margin: 12px 0 16px;
    padding: 14px 16px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #eef0f3;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

#publish .publish-progress.hidden {
    display: none;
}

#publish .publish-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    margin-bottom: 8px;
}

#publish .publish-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #eef0f3;
    overflow: hidden;
}

#publish .publish-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #3a7bc8);
    transition: width 0.25s ease-out;
    width: 0%;
}

#publish .publish-progress.done .publish-progress-fill {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

#publish .publish-progress.error .publish-progress-fill {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

#publish ul.publish-stage-list {
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: 13px;
    color: #64748b;
}

#publish ul.publish-stage-list > li {
    padding: 4px 10px;
    border-radius: 999px;
    background: #f4f6f8;
    border: 1px solid #eef0f3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

#publish ul.publish-stage-list > li::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
}

#publish ul.publish-stage-list > li.is-active {
    background: #eaf3fc;
    color: #1e40af;
    border-color: #bfdbfe;
}

#publish ul.publish-stage-list > li.is-active::before {
    background: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
    animation: publish-stage-pulse 1.2s ease-in-out infinite;
}

#publish ul.publish-stage-list > li.is-done {
    background: #ecfdf5;
    color: #065f46;
    border-color: #bbf7d0;
}

#publish ul.publish-stage-list > li.is-done::before {
    background: #16a34a;
}

#publish ul.publish-stage-list > li.is-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

#publish ul.publish-stage-list > li.is-error::before {
    background: #dc2626;
}

@keyframes publish-stage-pulse {
    0%   { box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15); }
    50%  { box-shadow: 0 0 0 6px rgba(74, 144, 226, 0.05); }
    100% { box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15); }
}

/* ---------- Result / log ---------- */
#publish #publish-result {
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#publish .publish-status {
    font-weight: 600;
    font-size: 14px;
}

#publish .publish-status.ok    { color: #1b7f3b; }
#publish .publish-status.err   { color: #b42318; }
#publish .publish-status.info  { color: #334155; }

#publish .publish-log {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px 14px;
    border-radius: 6px;
    max-height: 320px;
    overflow-y: auto;
    font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

#publish .publish-log-line {
    display: block;
}

#publish .publish-log-line .publish-log-time {
    color: #64748b;
    margin-right: 8px;
}

#publish .publish-log-line.info    { color: #e2e8f0; }
#publish .publish-log-line.success { color: #86efac; }
#publish .publish-log-line.warning { color: #fcd34d; }
#publish .publish-log-line.error   { color: #fca5a5; }
