/*
 * Gemeinsames Prozessierungs-/Download-Modal ("ENSCAPE-ASSET WIRD VORBEREITET"
 * → "…ERSTELLT"), genutzt von web/pcon_host.html und web/pcon_reconfig.html.
 * Kanonisch aus pcon_host.html extrahiert. Siehe web/processing_modal.js.
 * Self-contained: enthält auch .hidden + die verwendeten @keyframes.
 */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(6, 15, 32, 0.68);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-card {
    background: #fff;
    border-radius: 20px;
    padding: 2rem;
    max-width: min(480px, 92vw);
    width: 100%;
    position: relative;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.modal-body {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.modal-spinner {
    position: relative;
    width: 72px;
    height: 72px;
}

.modal-spinner::before,
.modal-spinner::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.modal-spinner::before {
    border-top-color: #90a7ff;
    border-bottom-color: #90a7ff;
    animation: orbit 1.4s linear infinite;
}

.modal-spinner::after {
    border-left-color: #2563eb;
    border-right-color: #2563eb;
    animation: orbit 1.4s linear infinite reverse;
}

.modal-content h3 {
    margin: 0 0 0.4rem;
}

.modal-eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
    color: #94a3b8;
}

.modal-status {
    margin: 0 0 0.9rem;
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-line;
}

/* Fortschrittsbalken im Prozessierungsfenster (oberhalb von Abbrechen). */
.modal-progress {
    margin: 0 0 1.1rem;
}
.modal-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
}
.modal-progress-phase {
    color: #64748b;
}
.modal-progress-pct {
    color: #2563eb;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.modal-progress-track {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: #e6ecf7;
    overflow: hidden;
}
.modal-progress-bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(135deg, #2a6df6, #5ca0ff);
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Wandernder Glanz signalisiert "läuft", auch wenn die Breite kurz steht. */
.modal-progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: translateX(-100%);
    animation: modalProgressSheen 1.6s ease-in-out infinite;
}
@keyframes modalProgressSheen {
    to { transform: translateX(100%); }
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.modal-first-row {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
}
/* Buttons füllen die Zeile gleichmäßig: gleiche Abstände + gleiche Ränder,
   robust gegen unterschiedliche Label-Längen (DE/EN/ES). */
.modal-first-row > button {
    flex: 1 1 0;
    min-width: 0;
}
.modal-folder-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.modal-folder-row #modalDownloadToFolderBtn {
    flex: 1;
    min-width: 0;
}
.modal-datasheet-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.modal-datasheet-row #modalDatasheetBtn {
    flex: 1;
    min-width: 0;
}
.modal-material-folder-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.modal-material-folder-row #modalDownloadToMaterialFolderBtn {
    flex: 1;
    min-width: 0;
}
.modal-change-folder-btn {
    flex-shrink: 0;
    width: 2.25rem;
    min-width: 2.25rem;
    padding: 0.4rem;
    font-size: 1rem;
}

/* "Bereitgestellt durch"-Streifen unten im Modal — wie der Footer auf der
   Landing-Page (dunkler Grund, helle Logos). Negative Ränder spannen ihn
   über die 2rem-Polsterung bis an die Modal-Kanten, gerundete Unterkanten
   passend zum 20px-Radius der Karte. */
.modal-powered-by {
    margin: 1.5rem -2rem -2rem;
    padding: 0.9rem 2rem;
    background: #1a1a2e;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-size: 0.75rem;
    border-radius: 0 0 20px 20px;
}
.modal-powered-by p { margin: 0; }
.modal-powered-logos {
    margin-top: 0.55rem !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.modal-powered-logos a { display: inline-flex; }
.modal-powered-logos img { height: 20px; width: auto; display: block; }

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: none;
    background: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    color: #94a3b8;
}

.hidden {
    display: none !important;
}

@keyframes orbit {
    to {
        transform: rotate(360deg);
    }
}
