﻿/* ===== SC UPLOAD (image-with-crop + file) =====
   Styles for Scripts/common/sc-upload.js and the _ImageUploadField / _FileUploadField partials.
   Token-based like the rest of the V2 design system. */

.sc-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.sc-upload__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.sc-upload__box {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: var(--sc-upload-box-w, 260px);
    aspect-ratio: var(--sc-upload-box-ratio, 16 / 9);
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    background: var(--color-surface-secondary);
    overflow: hidden;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.sc-upload__box:hover,
.sc-upload__box:focus-visible,
.sc-upload__box.is-dragover {
    border-color: var(--color-primary);
    outline: none;
}

.sc-upload__preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.sc-upload.has-image .sc-upload__preview { display: block; }
.sc-upload.has-image .sc-upload__empty { display: none; }

.sc-upload__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
    padding: 8px;
}

.sc-upload__empty i { font-size: 22px; }

.sc-upload__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sc-upload__badge {
    font-size: 12px;
    color: var(--color-text-muted);
}

.sc-upload.is-dirty .sc-upload__badge::before {
    content: "\25CF  ";
    color: var(--color-primary);
}

/* file variant */
.sc-upload__filebox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-secondary);
    font-size: 13px;
    min-width: 0;
}

.sc-upload__filebox i { color: var(--color-text-muted); }

.sc-upload__filename {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-link);
}

.sc-upload__filename.is-empty { color: var(--color-text-muted); }

/* crop modal */
.sc-crop-modal {
    position: fixed;
    inset: 0;
    z-index: 10100;   /* above the profile modal (10000) and other custom modals the crop can be opened from */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--modal-overlay-bg, rgba(0, 0, 0, .55));
}

.sc-crop-modal.is-open { display: flex; }

.sc-crop-modal__panel {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    background: var(--color-modal-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.sc-crop-modal__head,
.sc-crop-modal__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
}

.sc-crop-modal__head { border-bottom: 1px solid var(--color-border); font-weight: 600; }
.sc-crop-modal__foot { border-top: 1px solid var(--color-border); justify-content: flex-end; flex-wrap: wrap; }
.sc-crop-modal__tools { display: flex; gap: 6px; margin-right: auto; }

.sc-crop-modal__stage {
    flex: 1;
    min-height: 240px;
    max-height: 62vh;
    background: var(--color-surface-secondary);
}

.sc-crop-modal__stage img { display: block; max-width: 100%; }

/* avatar binder (registration card / profile): drag-over + keyboard focus on the paste zone */
.sc-avatar-zone.is-dragover { outline: 2px dashed var(--color-primary, #a3ff12); outline-offset: 2px; }
.sc-avatar-zone:focus-visible { outline: 2px solid var(--color-primary, #a3ff12); outline-offset: 2px; }
