/* Nakano Pro Style Cart CSS */

:root {
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --bg-body: #ffffff;
    --bg-card: #f5f5f7;
    --accent-color: #0071e3;
    /* Apple Blue */
    --accent-hover: #0077ed;
    --radius-card: 24px;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Yu Gothic", "YuGothic", Arial, sans-serif;
}

/* Product Grid */
.tsm-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 60px 0;
}

.tsm-product-card {
    background-color: #fff;
    border-radius: var(--radius-card);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.tsm-product-card:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.tsm-product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    /* Changed to contain to show full item if white bg */
    background-color: #fff;
    /* White background for white images */
    /* Slight padding so item doesn't touch edge */
    position: relative;
}

.tsm-sold-out-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    font-weight: bold;
    font-size: 14px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

.tsm-product-card.sold-out {
    opacity: 0.7;
}

.tsm-product-card.sold-out .tsm-product-image img {
    filter: grayscale(100%);
}

/* Product Card Details */
.tsm-product-details {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    flex-grow: 1;
    text-align: left;
}

.tsm-product-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

/* Price Container (New) */
.tsm-price-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-bottom: 8px;
    line-height: 1.2;
}

.tsm-product-price {
    /* Legacy override or wrapper */
    margin: 0;
    padding: 0;
}

.tsm-price-regular {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    margin-bottom: 2px;
}

.tsm-price-sale {
    font-size: 18px;
    color: #e60012;
    /* vivid red */
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Ensure range connector looks okay if on same line (fallback) but we prefer block */
.tsm-price-range-connector {
    font-size: 14px;
    color: #666;
    margin: 0 4px;
}

/* Actions Row */
.tsm-product-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Info Button (Description) */
.tsm-product-info-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #f0f0f5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--accent-color);
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tsm-product-info-btn:hover {
    background-color: #e5e5ea;
    transform: scale(1.05);
}

.tsm-add-to-cart-btn {
    flex-grow: 1;
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 980px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 44px;
    white-space: nowrap;
}

/* Hide Old Trigger */
.tsm-product-desc-trigger,
.tsm-product-desc-content {
    display: none !important;
}

/* Glass Modal for Description */
.tsm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tsm-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.tsm-modal-container {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    padding: 30px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.tsm-modal-overlay.open .tsm-modal-container {
    transform: scale(1);
}

.tsm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.tsm-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.tsm-modal-close {
    background: #f0f0f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsm-modal-body {
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 15px;
}

/* Variation Select */

/* Variation Select */
.tsm-variation-select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: #f5f5f7;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 12px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230071e3%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
}

.tsm-variation-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.tsm-add-to-cart-btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 980px;
    /* Pill shape */
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1.2;
}

.tsm-add-to-cart-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.tsm-add-to-cart-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Floating Cart Toggle */
.tsm-cart-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tsm-cart-float:hover {
    transform: scale(1.1);
}

.tsm-cart-icon svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.tsm-cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ff3b30;
    color: white;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid #fff;
}

/* Cart Overlay (Glassmorphism) */
.tsm-cart-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.tsm-cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.tsm-cart-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 90%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
}

.tsm-cart-overlay.open .tsm-cart-panel {
    transform: translateX(0);
}

.tsm-cart-header {
    padding: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tsm-cart-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.tsm-close-cart {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.tsm-close-cart:hover {
    color: var(--text-primary);
}

.tsm-cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

.tsm-cart-item {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease;
}

.tsm-cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    background-color: var(--bg-card);
}

.tsm-cart-item-info {
    flex-grow: 1;
}

.tsm-cart-item-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.tsm-cart-item-price {
    font-size: 13px;
    color: var(--text-secondary);
}

.tsm-cart-item-remove {
    margin-top: 8px;
    font-size: 12px;
    color: #ff3b30;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.tsm-cart-footer {
    padding: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(245, 245, 247, 0.5);
}

.tsm-cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 18px;
}

.tsm-checkout-btn {
    width: 100%;
    padding: 16px;
    background-color: var(--text-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.3s;
}

.tsm-checkout-btn:hover {
    opacity: 0.9;
}

.tsm-checkout-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@media (max-width: 480px) {
    .tsm-cart-panel {
        width: 100%;
    }
}

/* Quantity Controls */
.tsm-cart-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.tsm-qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #dcdce0;
    /* Apple-like border */
    border-radius: 6px;
    background-color: #fff;
    overflow: hidden;
    height: 32px;
    width: 100px;
}

.tsm-qty-btn {
    width: 28px;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    padding: 0;
}

.tsm-qty-btn:hover:not(:disabled) {
    background-color: #f5f5f7;
}

.tsm-qty-btn:disabled {
    color: #dedede;
    cursor: not-allowed;
}

.tsm-qty-value {
    flex-grow: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    line-height: 32px;
    color: #1d1d1f;
}

.tsm-cart-item-delete-btn {
    font-size: 13px;
    color: #ff3b30;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    transition: opacity 0.2s;
}

.tsm-cart-item-delete-btn:hover {
    opacity: 0.8;
}

.tsm-sold-out-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(26, 26, 26, 0.9);
    color: #fff;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 4px;
    z-index: 10;
    white-space: nowrap;
}

/* Sale Badge */
.tsm-sale-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #e60012;
    /* vivid red */
    color: #fff;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 980px;
    z-index: 9;
    box-shadow: 0 4px 10px rgba(230, 0, 18, 0.3);
}

/* Sale Price Typography */
.tsm-price-regular {
    text-decoration: line-through;
    color: #999;
    font-size: 0.9em;
    margin-right: 8px;
    font-weight: 400;
}

.tsm-price-sale {
    color: #e60012;
    font-weight: 700;
    font-size: 1.1em;
}

/* Summary Rows (Subtotal, Tax, Shipping) */
.tsm-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.tsm-summary-row .tsm-value {
    color: var(--text-primary);
    font-weight: 500;
}

.tsm-cart-total {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
}