/**
 * Swipe Mode Styles (v15 Logic & UI Fixes)
 * Margin, Close on Card, Progress, Diff Sum
 */

.swipe-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100dvh;
    background: linear-gradient(135deg, #e8edf3 0%, #f6f7fb 45%, #e3e8f2 100%);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 900;
    --swipe-header-h: 0px;
}

/* Global Progress Bar (Top of screen) */
.swipe-progress {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 80;
}

.swipe-progress .seg {
    flex: 1;
    height: 6px;
    background: #f3f4f6;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.swipe-progress .seg.done {
    background: #22c55e;
    border-color: #16a34a;
}

.swipe-progress .seg.current {
    border: 2px solid #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.swipe-stack {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
}

.swipe-container .swipe-card {
    position: absolute;
    width: 90%;
    max-width: none;
    height: calc(100dvh - var(--swipe-header-h, 0px));
    max-height: none;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    left: 5%;

    background-clip: padding-box;
    will-change: transform, opacity;
    transform: translate3d(0, 0, 0);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.swipe-container .swipe-card.current {
    z-index: 20;
    opacity: 1;
}

.swipe-container .swipe-card.saved-flash {
    animation: swipe-saved-flash 0.5s ease;
}

.swipe-container .swipe-card.shake {
    animation: swipe-shake 0.35s ease;
}

@keyframes swipe-saved-flash {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.0); }
    30% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.0); }
}

@keyframes swipe-shake {
    0% { transform: translate3d(0,0,0); }
    25% { transform: translate3d(-8px,0,0); }
    50% { transform: translate3d(8px,0,0); }
    75% { transform: translate3d(-6px,0,0); }
    100% { transform: translate3d(0,0,0); }
}

.swipe-container .swipe-card.next {
    display: none;
}

.swipe-container .swipe-card.prev {
    display: none;
}

/* Animation classes for smooth transitions */
.swipe-container .swipe-card.slide-exit-left {
    transform: translate3d(-120%, 0, 0) scale(0.9) !important;
    opacity: 0 !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease !important;
}

.swipe-container .swipe-card.slide-exit-right {
    transform: translate3d(120%, 0, 0) scale(0.9) !important;
    opacity: 0 !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease !important;
}

.swipe-container .swipe-card.slide-enter-right {
    transform: translate3d(100%, 0, 0);
    animation: swipe-enter-right 0.2s ease forwards;
}

.swipe-container .swipe-card.slide-enter-left {
    transform: translate3d(-100%, 0, 0);
    animation: swipe-enter-left 0.2s ease forwards;
}

@keyframes swipe-enter-right {
    from { transform: translate3d(100%,0,0); opacity: 0; }
    to { transform: translate3d(0,0,0); opacity: 1; }
}

@keyframes swipe-enter-left {
    from { transform: translate3d(-100%,0,0); opacity: 0; }
    to { transform: translate3d(0,0,0); opacity: 1; }
}

/* CLOSE BTN: Inside Card (Top Right) */
.swipe-container .swipe-card-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

/* PHOTO */
.swipe-photo-area {
    flex: 1;
    background: white;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swipe-photo-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    mix-blend-mode: multiply;
    border-radius: 18px;
}

/* BADGES */
.swipe-badges-overlay {
    position: absolute;
    top: 28px;
    left: 16px;
    right: 56px;
    /* Space for close btn */
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.swipe-cnt-badge {
    background: rgba(255, 255, 255, 0.85);
    color: #111;
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: inline-block;
    width: fit-content;
    box-shadow: 0 4px 14px rgba(31, 38, 135, 0.12);
}

/* INFO */
.swipe-info-area {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.55);
    padding: 16px;
    border-radius: 0;
    margin-top: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

.swipe-title {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    text-align: left;
    margin-bottom: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.swipe-page-label {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #4b5563;
    margin-bottom: 8px;
}

/* META */
.swipe-meta-line {
    font-size: 11px;
    font-weight: 700;
    color: #6b7280;
}

.swipe-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    background: #f9fafb;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 12px;
}

.swipe-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.swipe-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    color: #6b7280;
}

.swipe-stat-val {
    font-size: 15px;
    font-weight: 800;
    color: #111;
}

.swipe-stat-val.muted { color: #374151; }

.swipe-stat-val.pos { color: #16a34a; }
.swipe-stat-val.neg { color: #dc2626; }

/* NEW SPLIT LAYOUT */
.swipe-meta-split {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 20px;
}

.swipe-sku-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.swipe-sku-box {
    font-weight: 900;
    color: #111;
    font-family: monospace;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.75);
    padding: 6px 12px;
    border-radius: 10px;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.swipe-data-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.swipe-data-box {
    background: #f9fafb;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
    color: #374151;
    font-weight: 600;
    font-family: monospace;
}

.swipe-diff-sum {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

/* COUNTER */
.swipe-counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
    gap: 10px;
}

.swipe-cockpit {
    margin-top: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 6px 18px rgba(31, 38, 135, 0.12);
}

.swipe-cnt-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: #2563eb;
    transition: transform 0.1s;
    box-shadow: 0 6px 18px rgba(31, 38, 135, 0.12);
}

.swipe-cnt-btn:active {
    transform: scale(0.92);
}

.swipe-cnt-btn.minus {
    background: #f3f4f6;
    color: #4b5563;
}

.swipe-cnt-btn.plus {
    background: #dcfce7;
    color: #16a34a;
}

.swipe-ok-btn {
    height: 64px;
    padding: 0 22px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.35);
}

.swipe-missort-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 6px 0 10px;
}

.swipe-missort-badge {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(245, 158, 11, 0.5);
    color: #b45309;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
}

.swipe-missort-btn {
    border: none;
    background: #111827;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.swipe-nav {
    display: flex;
    gap: 10px;
    margin: 8px 0 4px;
}

.swipe-nav-btn {
    flex: 1;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    color: #111;
}

.swipe-nav-btn.primary {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

.swipe-nav-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.swipe-ok-btn:active {
    transform: translateY(1px);
}

.swipe-cnt-input-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.swipe-cnt-val {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 40px;
    font-weight: 800;
    text-align: center;
    color: #111;
    padding: 0;
    margin: 0;
    height: 60px;
}

.swipe-sum-row {
    margin: -4px 0 12px;
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    text-align: center;
}

.swipe-sum-val.pos { color: #16a34a; }
.swipe-sum-val.neg { color: #dc2626; }

.swipe-price-chip {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 6px 10px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 13px;
    color: #111;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 14px rgba(31, 38, 135, 0.12);
}

.swipe-cnt-val.saved {
    border: 2px solid #22c55e;
    border-radius: 12px;
}

.swipe-cnt-val:focus {
    outline: none;
}

.swipe-acct-lbl {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    margin-top: 4px;
}

.swipe-footer-hint {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
    opacity: 0.7;
}

/* TAGS */
.swipe-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 50px;
    overflow-y: auto;
}

.swipe-tag {
    font-size: 11px;
    padding: 5px 10px;
    border-radius: 14px;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid transparent;
}

.swipe-tag.active {
    background: #374151;
    color: white;
}

/* ZOOM OVERLAY */
.img-zoom {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.img-zoom img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
