/* Image picker (reusable) — shared by profile.php and profile edit pages */
.image-picker-modal .glass-panel,
.image-picker-modal__panel.glass-panel {
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(51, 65, 85, 0.5);
}

body.image-picker-open {
    overflow: hidden;
}

.image-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 2300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.image-picker-modal.hidden {
    display: none;
}

.image-picker-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 24, 0.72);
}

.image-picker-modal__panel {
    position: relative;
    z-index: 1;
    width: min(28rem, 100%);
    max-height: min(92vh, 44rem);
    overflow: auto;
    padding: 1.35rem 1.25rem 1.25rem;
    border-radius: 1rem;
}

.image-picker-modal__panel--wide {
    width: min(40rem, 100%);
}

.image-picker-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border: 0;
    background: transparent;
    color: #c0caff;
    cursor: pointer;
    padding: 0.25rem;
}

.image-picker-modal__title {
    margin: 0 1.75rem 0.35rem 0;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
}

.image-picker-modal__subtitle {
    margin: 0 0 1rem;
    color: #a8b0c8;
    font-size: 0.9rem;
    line-height: 1.4;
}

.image-picker-alert {
    margin-bottom: 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.75rem;
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    font-size: 0.88rem;
}

.image-picker-alert.hidden {
    display: none;
}

#image-edit-title-field.hidden,
#image-edit-confirm.hidden {
    display: none !important;
}

.image-upload-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 2rem 1rem;
    border-radius: 1rem;
    border: 1.5px dashed rgba(161, 251, 255, 0.35);
    background: rgba(255, 255, 255, 0.03);
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.image-upload-drop.hidden,
.image-upload-crop.hidden,
.image-upload-free.hidden,
.image-upload-meta.hidden,
.image-edit-panel.hidden {
    display: none;
}

.image-upload-free__preview {
    width: 100%;
    max-height: min(58vw, 22rem);
    border-radius: 0.85rem;
    overflow: hidden;
    background-color: #0b1020;
    background-image:
        linear-gradient(45deg, #1a2238 25%, transparent 25%),
        linear-gradient(-45deg, #1a2238 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a2238 75%),
        linear-gradient(-45deg, transparent 75%, #1a2238 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-upload-free__preview img {
    display: block;
    max-width: 100%;
    max-height: min(58vw, 22rem);
    width: auto;
    height: auto;
    object-fit: contain;
}

.image-upload-drop.is-dragover {
    border-color: #a1fbff;
    background: rgba(161, 251, 255, 0.08);
}

.image-upload-drop__icon {
    font-size: 2.4rem;
    color: #a1fbff;
}

.image-upload-drop__text {
    margin: 0;
    color: #fff;
    font-weight: 600;
}

.image-upload-drop__hint {
    margin: 0 0 0.5rem;
    color: #8b92a8;
    font-size: 0.82rem;
}

.image-upload-crop__stage {
    position: relative;
    width: 100%;
    height: min(58vw, 22rem);
    border-radius: 0.85rem;
    overflow: hidden;
    background: #0b1020;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    cursor: grab;
    overscroll-behavior: none;
}

.image-upload-crop__stage:active {
    cursor: grabbing;
}

.image-upload-crop {
    touch-action: none;
}

.image-upload-zoom {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.75rem;
    color: #c0caff;
    font-size: 0.85rem;
}

.image-upload-zoom__label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.image-upload-zoom input[type="range"] {
    width: 100%;
    accent-color: #a1fbff;
    touch-action: manipulation;
}

.image-upload-crop__canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.image-upload-crop__frame {
    position: absolute;
    border: 2px solid #a1fbff;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    border-radius: 0.15rem;
}

.image-upload-crop__help {
    margin: 0.65rem 0 0;
    color: #8b92a8;
    font-size: 0.82rem;
}

.image-upload-title-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.85rem;
    color: #c0caff;
    font-size: 0.85rem;
}

.image-upload-title-field input {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    padding: 0.7rem 0.85rem;
}

.image-edit-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 16rem;
    border-radius: 0.85rem;
    overflow: hidden;
    background: #0b1020;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b92a8;
}

.image-edit-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-picker-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.9rem;
}

.image-picker-notice__panel {
    max-width: 22rem;
    text-align: center;
}

.image-picker-notice__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 0.85rem;
    border-radius: 999px;
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
}

.image-picker-notice__icon .material-symbols-outlined {
    font-size: 1.65rem;
}

.image-picker-notice__actions {
    justify-content: center;
}

.image-picker-notice__actions .image-picker-btn {
    min-width: 8rem;
}

.image-picker-btn {
    border-radius: 0.75rem;
    padding: 0.65rem 0.95rem;
    font-weight: 700;
    border: 0;
    cursor: pointer;
}

.image-picker-btn--primary {
    background: #a1fbff;
    color: #1b2a6b;
}

.image-picker-btn--secondary {
    background: rgba(161, 251, 255, 0.14);
    color: #a1fbff;
    border: 1px solid rgba(161, 251, 255, 0.28);
}

.image-picker-btn--ghost {
    background: transparent;
    color: #c0caff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.image-picker-modal.is-uploading .image-picker-modal__close,
.image-picker-modal.is-uploading .image-picker-modal__backdrop {
    pointer-events: none;
    opacity: 0.45;
}

.image-picker-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.image-library-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin: 0 0 0.85rem;
}

.image-library-tabs {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 0.2rem;
    padding: 0.2rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.image-library-tab {
    border: 0;
    background: transparent;
    color: #8b92a8;
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.2;
}

.image-library-tab:hover {
    color: #e8ecf8;
}

.image-library-tab.is-active {
    background: rgba(161, 251, 255, 0.16);
    color: #a1fbff;
}

.image-library-tab:focus-visible {
    outline: 2px solid rgba(161, 251, 255, 0.45);
    outline-offset: 1px;
}

.image-library-search {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    padding: 0.35rem 0.85rem;
}

.image-library-search .material-symbols-outlined {
    font-size: 1.15rem;
    color: #8b92a8;
    flex-shrink: 0;
}

.image-library-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #e8ecf8;
    font-size: 0.9rem;
    padding: 0.35rem 0;
    outline: none;
}

.image-library-search input::placeholder {
    color: #8b92a8;
}

.image-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.65rem;
    max-height: min(60vh, 28rem);
    overflow: auto;
}

.image-library-item {
    aspect-ratio: 1 / 1;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
    color: #8b92a8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-library-item:hover {
    border-color: rgba(161, 251, 255, 0.45);
}

.image-library-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-picker-empty {
    margin: 0;
    color: #8b92a8;
    text-align: center;
    grid-column: 1 / -1;
    padding: 1.5rem 0.5rem;
}
