/* ============================================================
   OLD UPLOAD SYSTEM
============================================================ */

/* Container */
.upload-boxes { 
    gap: 1rem; 
}

/* Upload Box */
.upload-box {
    aspect-ratio: 1;
    border: 2px dashed #555;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-box:hover {
    border-color: var(--primary);
    background-color: #1e1e1e;
}

.upload-box.dragover {
    border-color: var(--primary);
    background-color: #eef9f0;
}

/* Placeholder */
.upload-placeholder { 
    width: 100%; 
    height: 100%;
    text-align: center; 
}

/* Preview Image */
.preview-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

/* Remove Button */
.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background-color: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.remove-btn:hover { 
    background-color: rgba(255,0,0,0.7); 
}

.upload-box .remove-btn span { 
    position: relative;
    top: -1px; 
}



/* ============================================================
   NEW UPLOAD SYSTEM — PHOTO GRID
============================================================ */

/* Grid Layout */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 0 auto;
    overflow: visible;
}

@media (max-width: 991px) {
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 640px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grid Dragover */
.photo-grid:not(.photo-filled).dragover {
    outline: 2px dashed var(--primary);
    outline-offset: 6px;
}

.photo-grid.photo-filled.dragover {
    outline: none !important;
    outline-offset: 0 !important;
}



/* ============================================================
   PHOTO TILES
============================================================ */

.photo-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: #1f1f1f;
    border: 1px solid rgba(255,255,255,0.08);
}

/* ======================================================
PHOTO SORTING STATES
====================================================== */

.photo-tile.filled {
    cursor: grab;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.photo-grid.is-sort-armed .photo-tile.filled.sortable-chosen {
    box-shadow: 0 10px 26px rgba(0,0,0,0.45);
    transform: scale(1.03);
}

.photo-grid.is-sorting .photo-tile.filled {
    cursor: grabbing;
}

.photo-grid.is-sorting .photo-tile.filled.sortable-chosen:not(.sortable-fallback) {
    opacity: 0.35;
    transform: scale(0.98);
    border: 1px dashed rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
}

.photo-grid.is-sorting .photo-tile.filled.sortable-chosen:not(.sortable-fallback) img,
.photo-grid.is-sorting .photo-tile.filled.sortable-chosen:not(.sortable-fallback) .photo-remove {
    opacity: 0.25;
}

.photo-tile.filled.sortable-ghost {
    opacity: 0.4;
    border: 1px dashed rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.05);
}

.photo-tile.filled.sortable-drag:not(.sortable-fallback) {
    transform: scale(1.03) rotate(1deg);
    box-shadow: 0 14px 30px rgba(0,0,0,0.55);
    z-index: 20;
}

.sortable-fallback.photo-tile.filled {
    position: fixed !important;
    opacity: 1 !important;
    box-shadow: 0 18px 34px rgba(0,0,0,0.65);
    border: 1px solid rgba(255,255,255,0.22);
    z-index: 99999 !important;
    pointer-events: none !important;
    transition: none !important;
    will-change: transform, top, left;
}

.sortable-fallback.photo-tile.filled img,
.sortable-fallback.photo-tile.filled .photo-remove {
    visibility: visible !important;
}

/* Image */
.photo-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* ======================================================
MOBILE LONG PRESS BLOCK
====================================================== */

.upload-images-wrap .photo-grid,
.upload-images-wrap .photo-tile,
.upload-images-wrap .photo-tile img,
.upload-images-wrap .existing-photo,
.upload-images-wrap .existing-photo img {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
}

.upload-images-wrap .existing-photo img {
    pointer-events: none;
}

@media (max-width: 992px) {
    .upload-images-wrap .photo-grid,
    .upload-images-wrap .photo-tile.filled {
        touch-action: none;
    }
}

/* Remove button */
.photo-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 16px;
    line-height: 100%;
    text-align: center;
    cursor: pointer;
    z-index: 2;
    padding-bottom: 3px;
}

/* Highlight empty tiles only */
.photo-tile.empty.dragover {
    border: 2px dashed var(--primary);
    background-color: rgba(130,174,50,0.15);
}

/* Disable for filled tiles */
.photo-tile.filled.dragover {
    border-color: transparent !important;
    background-color: transparent !important;
    outline: none !important;
}

/* ======================================================
SOCIAL PREFIX INPUTS
====================================================== */

.social-prefix-input {
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    background: #1a1a1a;
    overflow: hidden;
}

.social-prefix-text {
    flex: 0 0 auto;
    padding: 0 12px;
    font-size: 14px;
    color: #a7a7a7;
    white-space: nowrap;
    border-right: 1px solid #3a3a3a;
    user-select: none;
    pointer-events: none;
}

.social-prefix-input .social-handle-input {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #fff;
    min-width: 0;
}

.social-prefix-input .social-handle-input:focus {
    box-shadow: none;
}



/* ============================================================
   ADD TILE (Small "+" tile)
============================================================ */

.add-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #c9c9c9;
    border: 2px dashed rgba(255,255,255,0.18);
    border-radius: 10px;
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.add-tile:hover {
    background: #1a1a1a;
    border-color: #4f0707;
    color: #eaeaea;
}

.add-tile .add-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    display: grid;
    place-items: center;
}



/* ============================================================
   BIG ADD TILE (Before any photos)
============================================================ */

.big-add-tile {
    margin: 0 auto;
    padding: 50px 0;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    background: #181818;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.big-add-tile:hover {
    background: #1a1a1a;
    border-color: #4f0707;
}

.big-add-tile:hover .icon-wrap {
    background-color: var(--primary-alt);
}

.big-add-tile .icon-wrap {
    width: 56px;
    height: 56px;
    font-size: 28px;
    transition: 0.3s ease all;
    border-radius: 7px;
    background: rgba(255,255,255,0.08);
    display: grid;
    place-items: center;
    margin: 0 auto 12px;
}

.big-add-tile .text-1 { 
    font-size: 18px; 
    font-weight: 500; 
}

.big-add-tile .text-2 { 
    font-size: 13px; 
    opacity: 0.6; 
}



/* ============================================================
   EMPTY TILE STYLE (New system)
============================================================ */

.empty-tile {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px dashed rgba(255,255,255,0.15);
    cursor: pointer;
    border-radius: 10px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.empty-tile:hover {
    background: #1a1a1a;
    border-color: #4f0707;
}

.empty-tile .empty-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 42px;
    transition: 0.3s ease all;
    height: 42px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    font-size: 24px;
    color: #ccc;
}


.empty-tile:hover .empty-inner {
    background-color: var(--primary-alt);
    transform: scale(1.05);
}



/* ============================================================
   ALERT MESSAGES
============================================================ */

.upload-limit-alert {
    margin: 8px auto 10px;
    padding: 10px 12px;
    background: #3a1f1f;
    color: #ffd9d9;
    border: 1px solid #7f2a2a;
    border-radius: 8px;
    font-size: 13px;
    animation: fadeInOut 2.8s ease forwards;
}

@keyframes fadeInOut {
    0%   { opacity: 0; transform: translateY(-4px); }
    10%  { opacity: 1; transform: translateY(0); }
    80%  { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-4px); }
}



/* ============================================================
   CROP MODAL — LAYOUT
============================================================ */

#cropperModal .modal-dialog {
    max-width: 500px;
}

#cropperModal .modal-body {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cropperStage {
    cursor: grab;
}
#cropperStage:active {
    cursor: grabbing;
}

#cropperStage {
    touch-action: none;
}
#cropperFrame,
.crop-mask {
    pointer-events: none;
}

/* ============================================================
   CROP STAGE — TRUE 1x1
============================================================ */

#cropperStage {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;

    background: #000;
    overflow: hidden;
}


/* ============================================================
   IMAGE (PAN + ZOOM)
============================================================ */

#cropperImage {
    position: absolute;
    top: 0;
    left: 0;

    max-width: none;
    max-height: none;

    transform-origin: top left;

    user-select: none;
    -webkit-user-drag: none;
    pointer-events: auto;
    touch-action: none;
}


/* ============================================================
   FIXED 1x1 FRAME (FULL STAGE)
============================================================ */

#cropFrame {
    position: absolute;
    inset: 0;

    border: 2px solid #fff;
    box-sizing: border-box;

    pointer-events: none;
    z-index: 5;
}


/* ============================================================
   FINAL THUMB WRAPPER (UNCHANGED)
============================================================ */

.sc-thumb-crop-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 10px;
    background: #111;
}

.sc-thumb-img {
    width: 100%;
    height: auto;
    display: block;
}


/* ============================================================
   PHOTO TILE ANIMATION
============================================================ */

.photo-tile {
    transition: transform 0.25s ease;
}

/* ======================================================
FLEX YOUR CAR AUTH OVERLAY
====================================================== */

.flex-upload-form-lock {
    position: relative;
}

.flex-upload-form-lock.is-guest-locked .flex-upload-blur-target {
    filter: blur(3px);
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
}

.flex-upload-auth-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
}

.flex-upload-auth-overlay-content {
    width: 100%;
    max-width: 450px;
    margin-top: 30px;
    text-align: center;
    border: 1px solid #333;
    padding: 25px;
}

.flex-upload-auth-overlay-content p {
    opacity: 0.82;
}



@media (max-width: 767px) {
    .big-add-tile .text-1 {
        font-size: 16px;
        font-weight: 500;
    }
    .big-add-tile .text-2 {
        font-size: 12px;
        opacity: 0.6;
    }
}
