/* ==================== Upload Zone ==================== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    text-align: center;
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(239, 68, 68, 0.02);
    pointer-events: none;
    transition: all var(--transition);
}

@keyframes dropzonePulse {
    0% {
        background: rgba(239, 68, 68, 0.02);
    }

    50% {
        background: rgba(239, 68, 68, 0.06);
    }

    100% {
        background: rgba(239, 68, 68, 0.02);
    }
}

.upload-zone:hover {
    border-color: var(--primary-light);
    background: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.upload-zone.drag-over {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(239, 68, 68, 0.1);
    animation: dropzonePulse 1.5s infinite;
}

.upload-icon {
    color: var(--text-light);
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
    transition: transform var(--transition), color var(--transition);
}

.upload-zone:hover .upload-icon {
    transform: scale(1.05);
    color: var(--primary-light);
}

.upload-zone h2 {
    color: var(--text);
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.upload-zone .btn {
    margin-top: 20px;
}

/* ==================== Progress List ==================== */
.progress-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    animation: fadeInUp 0.2s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.progress-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg);
    border: 1px solid var(--border);
}

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.progress-bar-wrap {
    background: var(--bg);
    border-radius: 9999px;
    height: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 9999px;
    transition: width 0.15s ease;
}

.progress-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.progress-status.done {
    color: var(--primary);
}

.progress-status.error {
    color: var(--accent);
}

/* ==================== Toolbar / Control Panel ==================== */
.toolbar {
    margin-bottom: 20px;
}

.toolbar-inner {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    margin: 0 4px;
}

.toolbar-price {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-display {
    text-align: right;
}

.price-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1;
}

.price-discount {
    font-size: 0.78rem;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}

/* ==================== Bulk Settings Row ==================== */
.bulk-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.bulk-row label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.bulk-row .form-control {
    width: auto;
    min-width: 120px;
    padding: 7px 10px;
    font-size: 0.85rem;
}

/* ==================== Photo Grid ==================== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

/* ==================== Photo Card ==================== */
.photo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: #D1D5DB;
}

.photo-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-md);
    transform: translateY(-2px);
}

.photo-card.selected:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-lg);
}

.photo-card-check {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    opacity: 1;
    box-shadow: var(--shadow-sm);
    touch-action: manipulation;
}

.photo-card-check:hover {
    background: white;
    border-color: var(--primary-light);
}

.photo-card.selected .photo-card-check {
    background: var(--primary);
    border-color: var(--primary);
    opacity: 1;
}

.photo-card.selected .photo-card-check::after {
    content: url('data:image/svg+xml;charset=UTF-8,<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>');
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-card-img-wrap {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: var(--bg);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

.photo-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--transition);
}

.photo-card:hover .photo-card-img-wrap img {
    transform: scale(1.03);
}

.photo-card-crop-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
    touch-action: manipulation;
}

.photo-card-crop-btn svg {
    width: 16px;
    height: 16px;
}

.photo-card-crop-btn:hover {
    background: white;
    color: var(--primary);
    border-color: var(--primary-light);
}

.photo-card.cropped .photo-card-crop-btn {
    color: var(--primary);
    border-color: var(--primary);
}

.photo-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.photo-card-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-card-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.photo-card-row .form-control {
    padding: 6px 8px;
    font-size: 0.8125rem;
}

.qty-control {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qty-btn {
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    touch-action: manipulation;
}

.qty-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.qty-input {
    width: 32px;
    text-align: center;
    border: none;
    outline: none;
    background: none;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    padding: 0;
}

.photo-card-price {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-align: right;
    padding-top: 2px;
}

.delete-photo-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
    z-index: 10;
    box-shadow: var(--shadow-sm);
    opacity: 1;
    touch-action: manipulation;
}

.delete-photo-btn svg {
    width: 14px;
    height: 14px;
}

.delete-photo-btn:hover {
    background: #FEE2E2;
    color: var(--primary-dark);
    border-color: #FCA5A5;
}

/* ==================== Crop Modal ==================== */
.crop-container {
    position: relative;
    max-height: 420px;
    overflow: hidden;
    background: #111;
    border-radius: var(--radius-sm);
}

.crop-container img {
    display: block;
    max-width: 100%;
}

/* ==================== Checkout button area ==================== */
@keyframes slideUpCheckout {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.checkout-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
    padding: 16px 24px;
    z-index: 99;
    display: none;
}

.checkout-area.visible {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    animation: slideUpCheckout 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.checkout-area .checkout-summary {
    margin-right: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.checkout-summary-total {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.checkout-summary-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .toolbar-inner {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .toolbar-section {
        justify-content: flex-start;
    }

    .toolbar-divider {
        width: 100%;
        height: 1px;
        margin: 4px 0;
    }

    .bulk-row {
        gap: 8px;
    }

    .toolbar-price {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .btn-bottom-wrap {
        flex-direction: column;
        align-items: stretch;
    }

    .checkout-area.visible {
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px 24px;
        justify-content: space-between;
    }

    .checkout-area .checkout-summary {
        margin-right: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .crop-rotate-controls {
        justify-content: center;
        margin-bottom: 4px;
    }

    .qty-input {
        font-size: 16px !important;
    }
}

/* ==================== Preview Modal ==================== */
.preview-modal-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    height: 90vh;
    position: relative;
}

.preview-close-btn {
    position: fixed;
    top: 24px;
    right: 32px;
    z-index: 601;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    width: 48px;
    height: 48px;
    font-size: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: all var(--transition);
}

.preview-close-btn:hover {
    background: var(--accent);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.preview-content-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.preview-image-wrap {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-image-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.preview-controls {
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
}

.preview-controls-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.preview-nav {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--primary);
    font-size: 2.2rem;
    line-height: 1;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.preview-nav:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
    color: var(--primary-dark);
}

.preview-photo-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .preview-nav {
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
    }

    .preview-image-wrap {
        padding: 0 10px;
    }

    .preview-close-btn {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* ==================== Crop Rotation Controls ==================== */
.crop-rotate-controls {
    display: flex;
    gap: 8px;
}

.crop-rotate-handle {
    position: absolute;
    top: -30px;
    /* Position above the crop box */
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: white;
    border: 1px solid var(--border-focus);
    border-radius: 50%;
    cursor: grab;
    z-index: 2024;
    /* Above cropper handles */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    color: var(--primary);
    font-size: 14px;
}

.crop-rotate-handle::after {
    content: "↻";
    line-height: 1;
}

.crop-rotate-handle:active {
    cursor: grabbing;
    background: var(--bg-glass);
}

.crop-rotate-controls .btn-icon {
    font-size: 1.2rem;
    padding: 6px 10px;
}