/* Organisation creation progress. Mirrors the manual import upload modal (.mi-upload-modal) so the
   two long-running jobs in the app read as the same thing, with a credentials handover on the end. */

.ocp-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ocp-overlay.is-open {
    opacity: 1;
}

.ocp-modal {
    box-sizing: border-box;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    transform: translateY(14px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.ocp-overlay.is-open .ocp-modal {
    transform: none;
}

.ocp-stage {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
}

.ocp-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* start the fill at 12 o'clock */
}

.ocp-ring-track {
    fill: none;
    stroke: #e2e8f0;
    stroke-width: 8;
}

.ocp-ring-fill {
    fill: none;
    stroke: #008080;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.ocp-stage.is-complete .ocp-ring-fill {
    stroke: #16a34a;
}

.ocp-stage.is-complete.has-errors .ocp-ring-fill {
    stroke: #f59e0b;
}

/* Nothing was created — must out-rank the amber partial rule above, so it stays after it. */
.ocp-stage.is-complete.is-failed .ocp-ring-fill {
    stroke: #dc2626;
}

.ocp-stage-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ocp-pct {
    font-size: 23px;
    font-weight: 700;
    color: #234e52;
    transition: opacity 0.2s ease;
}

.ocp-stage.is-complete .ocp-pct {
    opacity: 0;
}

.ocp-check,
.ocp-cross {
    position: absolute;
    width: 58px;
    height: 58px;
    opacity: 0;
    transform: scale(0.6);
}

.ocp-check-path {
    stroke: #16a34a;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
}

.ocp-stage.has-errors .ocp-check-path {
    stroke: #f59e0b;
}

.ocp-stage.is-complete .ocp-check {
    opacity: 1;
    animation: ocp-pop 0.55s 0.1s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.ocp-stage.is-complete .ocp-check-path {
    animation: ocp-draw 0.4s 0.18s ease forwards;
}

.ocp-cross-path {
    stroke: #dc2626;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 26;
    stroke-dashoffset: 26;
}

/* A total failure shows the cross instead of the tick, never both. */
.ocp-stage.is-failed .ocp-check {
    display: none;
}

.ocp-stage.is-failed .ocp-cross {
    opacity: 1;
    animation: ocp-pop 0.55s 0.1s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.ocp-stage.is-failed .ocp-cross-path {
    animation: ocp-draw 0.4s 0.18s ease forwards;
}

/* Second stroke trails the first so the X draws corner to corner. */
.ocp-stage.is-failed .ocp-cross-path-2 {
    animation-delay: 0.34s;
}

@keyframes ocp-pop {
    0% { transform: scale(0.5); }
    55% { transform: scale(1.18); }
    72% { transform: scale(0.92); }
    100% { transform: scale(1); }
}

@keyframes ocp-draw {
    to { stroke-dashoffset: 0; }
}

.ocp-title {
    margin-top: 18px;
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
}

.ocp-phase {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #64748b;
    white-space: pre-line;
}

.ocp-accounts {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
    max-height: 280px;
    overflow-y: auto;
    text-align: left;
}

.ocp-account {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.ocp-accounts.is-revealed .ocp-account {
    opacity: 1;
    transform: none;
}

.ocp-account-name {
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 700;
    color: #1a202c;
}

/* Two columns: label, then a selectable monospace value — these get read out and retyped. */
.ocp-account-fields {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    margin: 0;
    font-size: 13px;
}

.ocp-account-fields dt {
    color: #718096;
}

.ocp-account-fields dd {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #1a202c;
    word-break: break-all;
    user-select: all;
}

.ocp-account-failed {
    padding: 8px 12px;
    border: 1px solid #feb2b2;
    border-radius: 10px;
    background: #fff5f5;
    color: #c53030;
    font-size: 13px;
}

.ocp-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.ocp-copy,
.ocp-done {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, background-color 0.15s ease, transform 0.05s ease;
}

.ocp-copy {
    border: 0;
    background: linear-gradient(120deg, #008080 0%, #4fd1c5 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0, 128, 128, 0.28);
}

.ocp-copy:hover {
    filter: brightness(1.06);
}

.ocp-copy.is-copied {
    background: #16a34a;
    box-shadow: none;
}

.ocp-done {
    border: 1px solid #cbd5e0;
    background: #fff;
    color: #4a5568;
}

.ocp-done:hover {
    background: #f7fafc;
}

.ocp-copy:active,
.ocp-done:active {
    transform: translateY(1px);
}
