/**
 * Cirku Swipe - Mobile-First Styles
 */

/* Reset and Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.cirku-swipe-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
}

#cirku-swipe-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Shortcode version */
#cirku-swipe-app.cirku-swipe-shortcode {
    height: auto;
    min-height: 600px;
    width: 100%;
    position: relative;
}

.hidden {
    display: none !important;
}

/* Header */
.swipe-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.header-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.header-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.header-spacer {
    width: 40px;
}

/* Main Container */
.swipe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Filter Bar */
.swipe-filters {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.filter-toggle-btn {
    flex-shrink: 0;
    background: #667eea;
    border: none;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.filter-toggle-btn:active {
    background: #5568d3;
    transform: scale(0.95);
}

.filter-toggle-btn svg {
    stroke: white;
    transition: transform 0.3s;
}

.filter-toggle-btn.active svg {
    transform: rotate(180deg);
}

.filter-options {
    display: none;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
    animation: slideDown 0.3s ease-out;
}

.filter-options.visible {
    display: flex;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-group {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-group.filter-search {
    position: relative;
}

.filter-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s;
}

.filter-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
    width: 20px;
    height: 20px;
}

.filter-select {
    width: 100%;
    padding: 12px 32px 12px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 12 12"><path fill="%23999" d="M6 9L1 4h10z"/></svg>') no-repeat right 12px center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.filter-clear-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: background 0.2s;
}

.filter-clear-btn:active {
    background: #e0e0e0;
}

.filter-clear-btn svg {
    stroke: #666;
    width: 14px;
    height: 14px;
}

.filter-count {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 4px 8px;
    background: #667eea;
    border-radius: 4px;
    font-size: 11px;
    color: white;
}

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: white;
    color: #667eea;
    border-radius: 8px;
    font-weight: 700;
    font-size: 10px;
}

.count-text {
    font-weight: 500;
    font-size: 11px;
}

/* Swipe Stack */
.swipe-stack {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 600px;
    max-height: calc(100vh - 350px);
}

/* Product Card */
.product-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    cursor: grab;
    user-select: none;
    touch-action: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.product-card:active {
    cursor: grabbing;
}

.product-card.moving {
    transition: none;
}

/* Scale down cards behind */
.product-card:nth-child(2) {
    transform: scale(0.95) translateY(10px);
    opacity: 0.8;
}

.product-card:nth-child(3) {
    transform: scale(0.9) translateY(20px);
    opacity: 0.6;
}

/* Card Image */
.card-image {
    position: relative;
    width: 100%;
    height: 60%;
    overflow: hidden;
    background: #f5f5f5;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-indicators {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.image-indicators span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transition: background 0.3s;
}

.image-indicators span.active {
    background: white;
    width: 20px;
    border-radius: 3px;
}

/* Card Content */
.card-content {
    padding: 20px;
    height: 40%;
    overflow-y: auto;
}

.card-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.3;
}

.card-categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.category-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.card-price {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 8px;
}

.card-price del {
    font-size: 18px;
    color: #999;
    margin-right: 8px;
}

.card-rating {
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.stars {
    color: #ffa500;
    font-size: 16px;
    margin-right: 4px;
}

.card-stock {
    font-size: 13px;
    margin-bottom: 8px;
}

.in-stock {
    color: #22c55e;
    font-weight: 500;
}

.out-of-stock {
    color: #ef4444;
    font-weight: 500;
}

.card-description {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
}

/* Action Buttons */
.swipe-actions {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    z-index: 100;
}

.action-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.prev-btn svg {
    stroke: #64748b;
}

.next-btn svg {
    stroke: #64748b;
}

.wishlist-btn svg {
    stroke: #ef4444;
    fill: none;
    transition: fill 0.3s ease, stroke 0.3s ease;
}

.wishlist-btn.in-wishlist svg {
    fill: #ef4444;
    stroke: #ef4444;
}

.wishlist-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.wishlist-btn:hover svg {
    fill: rgba(239, 68, 68, 0.2);
}

.info-btn svg {
    stroke: #667eea;
}

/* Loading */
.swipe-loading {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.swipe-empty {
    text-align: center;
    color: white;
}

.empty-icon {
    font-size: 80px;
    margin-bottom: 16px;
}

.swipe-empty h2 {
    font-size: 28px;
    margin-bottom: 8px;
}

.swipe-empty p {
    font-size: 16px;
    margin-bottom: 24px;
    opacity: 0.9;
}

/* Buttons */
.btn-primary {
    background: white;
    color: #667eea;
    border: none;
    padding: 14px 32px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s;
}

.btn-secondary:active {
    background: #e0e0e0;
}

/* Instructions */
.swipe-instructions {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.instructions-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    text-align: center;
}

.instructions-content h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: #1a1a1a;
}

.instruction-item {
    margin-bottom: 20px;
}

.instruction-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.instruction-item p {
    font-size: 14px;
    color: #666;
}

/* Quick View Modal */
.quick-view-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.modal-body {
    padding: 24px;
}

.quick-view-product {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.quick-view-images {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 12px;
}

.quick-view-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.quick-view-images img.active {
    display: block;
}

.quick-view-info h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.quick-view-info .price {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
    margin: 12px 0;
}

.quick-view-info .rating {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.quick-view-info .description {
    font-size: 14px;
    line-height: 1.6;
    color: #666;
    margin: 16px 0;
}

.quick-view-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.quick-view-actions button,
.quick-view-actions a {
    width: 100%;
    text-align: center;
    padding: 14px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: white;
    color: #333;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #22c55e;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

/* Desktop Only - Keep mobile vertical */
@media (min-width: 1024px) {
    /* Filters on desktop - horizontal layout */
    .swipe-filters {
        max-width: 600px;
    }

    .filter-row {
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    .filter-group.filter-search {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }

    .filter-group {
        flex: 1 1 auto;
        min-width: 140px;
    }

    .filter-clear-btn {
        flex: 0 0 auto;
    }
}

/* Tablet - keep vertical but adjust sizing */
@media (min-width: 768px) {
    .swipe-filters {
        max-width: 500px;
    }

    .swipe-stack {
        max-width: 450px;
        height: 650px;
        max-height: calc(100vh - 300px);
    }

    .action-btn {
        width: 70px;
        height: 70px;
    }

    .swipe-actions {
        bottom: 40px;
        gap: 30px;
    }

    .modal-content {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        transform: translate(-50%, -50%);
        border-radius: 16px;
        max-width: 600px;
        animation: fadeIn 0.3s ease-out;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translate(-50%, -40%);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%);
        }
    }

    .quick-view-product {
        flex-direction: row;
    }

    .quick-view-images {
        width: 50%;
        height: 400px;
    }

    .quick-view-info {
        width: 50%;
    }
}

/* Large Desktop */
@media (min-width: 1024px) {
    .swipe-stack {
        max-width: 500px;
        height: 700px;
    }
}
