/* store.css - Isolated styling for the store module */

.store-container {
    padding: 16px;
    padding-bottom: 80px; /* Space for bottom nav */
    color: var(--text-primary);
}

.store-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.store-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
}

.cart-btn {
    position: relative;
    background: var(--accent);
    color: var(--text-white);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.store-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.store-filter-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.store-filter-btn.active {
    background: var(--accent);
    color: var(--text-white);
    border-color: var(--accent);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-card {
    background: var(--bg-card-solid);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.product-img-wrapper {
    position: relative;
    width: 100%;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
}

.product-img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    padding: 8px;
    display: block;
}

.watermark-logo {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    opacity: 0.15;
    pointer-events: none;
    filter: grayscale(100%);
}

.product-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.2;
}

.product-weight {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.product-bottom {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-weight: bold;
    color: var(--accent-hover);
}

.add-to-cart-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* Cart Modal */
.store-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.store-cart-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.store-cart-panel {
    background: var(--bg-primary);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s;
}

.store-cart-overlay.active .store-cart-panel {
    transform: translateY(0);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-weight: bold;
    font-size: 1.2rem;
}

.cart-items {
    overflow-y: auto;
    flex: 1;
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.cart-item-img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

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

.cart-item-title {
    font-size: 0.9rem;
    font-weight: bold;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border-medium);
    background: var(--bg-card);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.cart-delete-btn {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin-left: 8px;
    font-size: 1.1rem;
}

.cart-delete-btn:hover {
    background: rgba(231, 76, 60, 0.2);
}

.cart-total {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: right;
    margin-bottom: 16px;
}

/* Product Modal */
.store-product-modal {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.product-modal-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.product-modal-header {
    padding: 16px;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    background: transparent;
    border: none;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-img-wrapper.modal-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border-bottom: none;
    overflow: hidden;
}

.product-img-wrapper.modal-wrapper .watermark-logo {
    width: 48px;
    height: 48px;
    bottom: 16px;
    right: 16px;
    opacity: 0.2;
}

.product-modal-img {
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    padding: 16px;
    display: block;
}

.product-modal-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-primary);
}

.product-modal-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--accent);
}

.product-modal-availability {
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-block;
    align-self: flex-start;
}
.availability-in-stock {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}
.availability-out-of-stock {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.product-modal-description {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.product-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.btn-add-to-cart {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
}

.btn-add-to-cart:disabled {
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-ai-analyze {
    background: linear-gradient(135deg, #a29bfe, #6c5ce7);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ai-analysis-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}
