/* Upload-specific components (layout uses forms.css .create-container-wide + .create-box) */

.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: var(--dark-bg-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(91, 203, 207, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.upload-text {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--dark-bg-tertiary);
    border: 1px solid rgba(91, 203, 207, 0.3);
    border-radius: 10px;
    margin-top: 16px;
}

.file-info-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}

.file-info-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size-pill {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary-color);
    background: rgba(91, 203, 207, 0.12);
    border: 1px solid rgba(91, 203, 207, 0.35);
    border-radius: 999px;
    padding: 2px 10px;
}

.btn-remove-file {
    flex-shrink: 0;
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-remove-file:hover {
    background: #ef4444;
    color: #fff;
}

/* Upload mode switch: simple image vs HTML bundle */
.mode-switch {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.mode-option {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "radio title" "radio desc";
    gap: 2px 10px;
    align-items: center;
    padding: 12px 14px;
    background: var(--dark-bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.mode-option:hover {
    border-color: rgba(255, 255, 255, 0.28);
}

.mode-option input {
    grid-area: radio;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.mode-option:has(input:checked) {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.06);
}

.mode-option-title {
    grid-area: title;
    font-weight: 600;
    font-size: 0.95rem;
}

.mode-option-desc {
    grid-area: desc;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Required image size, derived from aspect ratio x screen share */
.expected-size {
    margin: 14px 0 4px;
    padding: 12px 14px;
    background: rgba(0, 212, 255, 0.06);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
}

.expected-size-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.expected-size-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: monospace;
    margin: 2px 0 6px;
}

/* Result of the in-browser dimension check on the picked image */
.image-check {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.image-check--ok {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.35);
}

.image-check--error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

/* ---- Choice cards: ad format and screen shape ---- */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 6px;
}

.choice-grid--ratios {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.choice-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 12px;
    background: var(--dark-bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    color: var(--text-color);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
}

.choice-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.choice-card--active {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.08);
    box-shadow: 0 0 0 1px var(--primary-color) inset;
}

/* The radio itself is redundant once the card shows state — keep it reachable, not visible. */
.choice-card input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}

.choice-card-icon {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--primary-color);
}

.choice-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.choice-card-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.25;
}

/* Drawn box showing the actual proportions — reads faster than "16:9" alone. */
.ratio-shape-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
}

.ratio-shape {
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
}

.choice-card--active .ratio-shape {
    border-color: var(--primary-color);
    background: rgba(0, 212, 255, 0.16);
}

/* Value the platform worked out rather than asked for */
.derived-note {
    margin: 12px 0 0;
    font-size: 0.88rem;
    color: var(--text-color);
}

.derived-note-why {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Collapsible form sections used to be defined here. They moved to css/forms.css when
   entity-forms.js started folding its optional sections the same way — the pattern is no
   longer specific to the upload form, and two copies would drift. */

/* Screen-reader-only, for the hidden select that backs the ad-format cards */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Manifest generator: screen aspect-ratio multi-select */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 4px 12px;
    padding: 8px 10px;
    background: var(--dark-bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
}

.checkbox-grid .checkbox-container {
    padding: 4px 2px;
    font-size: 0.9rem;
    margin: 0;
}

/* The box itself comes from forms.css. This grid used to force 16px, a fourth size for
   the same control. */

/* Live manifest preview */
#manifest-preview-wrap {
    margin-top: 16px;
}

#manifest-preview-wrap pre {
    margin-top: 6px;
    max-height: 260px;
    overflow: auto;
}

.upload-progress {
    margin: 20px 0;
}

.progress-bar {
    height: 8px;
    background: var(--dark-bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

/* ==========================================
   Collapsible Help Accordion
   ========================================== */

.help-accordion {
    margin-top: 24px;
}

.help-accordion-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 20px 0;
    list-style: none;
    user-select: none;
}

.help-accordion-summary::-webkit-details-marker {
    display: none;
}

.help-accordion-icon {
    font-size: 1.25rem;
}

.help-accordion-title {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.help-accordion-chevron {
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

details.help-accordion[open] .help-accordion-chevron {
    transform: rotate(90deg);
}

.help-accordion-body {
    padding: 0 0 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 24px;
}

.help-accordion-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.7;
    margin-bottom: 16px;
}

.help-accordion-body .section-title {
    margin-top: 28px;
}

.help-accordion-body .section-title:first-child {
    margin-top: 0;
}

.help-structure-block {
    background: var(--dark-bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.help-structure-block pre {
    margin: 0;
}

.help-structure-block code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.help-list li {
    position: relative;
    padding: 8px 0 8px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.help-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: 700;
}

.help-list li strong {
    color: var(--text-primary);
}

.help-list li code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary-color);
}

.help-accordion-body code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary-color);
}

.help-table-wrap {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.help-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.help-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--dark-bg-secondary);
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
}

.help-table td {
    padding: 10px 16px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.help-table td code {
    background: rgba(34, 199, 224, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--primary-color);
}
