/* Base Variables */
:root {
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --border-radius: 20px;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.13);
    --transition: all 0.25s ease;
    --spacing: 1rem;
}

/* Touch handling */
* { touch-action: manipulation; }

a { text-decoration: none !important; }

/* Base Styles */
body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Layout Containers */
.container-fluid {
    padding: 0 1rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* Header Styles */
.site-header {
    background-color: white;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
    padding: 1rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-container {
    max-width: 180px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.logo-container img {
    max-width: 100%;
    height: auto;
    max-height: 50px;
}

/* Product Grid — mobile first */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
    padding: 1rem 0 5rem;
}

/* Product Cards */
.product-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0.875rem;
    height: 100%;
    animation: cardFadeIn 0.3s ease both;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

@media (hover: none) and (pointer: coarse) {
    .product-card:hover { transform: none; box-shadow: var(--shadow); }
    .product-card:active { transform: scale(0.99); opacity: 0.95; }
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    background-color: transparent;
    border-bottom: none;
    padding: 0;
}

.seller-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.seller-image {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: contain;
    border: 1px solid #eee;
    padding: 3px;
    flex-shrink: 0;
}

.seller-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.seller-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.seller-name {
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timestamp {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Card Image */
.product-image-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.375rem 0 0.875rem;
    height: 150px;
    background: #f8f8f8;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.product-image {
    max-height: 90%;
    max-width: 90%;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.25s ease;
}

.product-card:hover .product-image {
    transform: scale(1.04);
}

@media (hover: none) and (pointer: coarse) {
    .product-card:hover .product-image { transform: none; }
}

/* Product Details */
.product-title {
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    margin: 0 0 0.75rem;
    min-height: 3.25em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-height: 1.45;
    color: var(--text-primary);
}

.product-pricing {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0.75rem;
}

.price-before {
    font-size: 0.75rem;
    color: #ccc;
    text-decoration: line-through;
    margin-bottom: 0.125rem;
}

.price-now-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.125rem;
}

.price-now {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--default-color);
    margin-bottom: 0.125rem;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.payment-info {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.75rem;
}

/* Coupon Styles */
.coupon-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 0.875rem;
    border: 2px dashed #d4d4d4;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    width: 100%;
    background: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
}

.coupon-button:hover {
    border-color: var(--default-color);
    background-color: rgba(255, 98, 1, 0.04);
}

.coupon-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.coupon-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
}

.coupon-code {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.copy-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Action Buttons */
.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--default-color);
    color: white !important;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.375rem;
    border: none;
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.2s ease;
    width: 100%;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.action-button:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
    color: white !important;
}

.action-button:active { transform: scale(0.98); opacity: 0.9; }

@media (hover: none) and (pointer: coarse) {
    .action-button:hover { filter: none; transform: none; }
}

.action-icon { margin-left: 0.5rem; }

.alert-message {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.flex-grow { flex-grow: 1; }

/* Modal Styles */
.promo-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.promo-modal[style*="block"] {
    display: flex !important;
}

.modal-content {
    background-color: var(--card-bg);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 1.5rem;
    border-radius: 24px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.15);
    animation: modalCenter 0.3s ease;
}

@keyframes modalCenter {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 20px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    border-bottom: none;
    padding: 0;
}

.modal-product {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.modal-image {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: contain;
    flex-shrink: 0;
}

.modal-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.modal-close {
    background: rgba(0,0,0,0.06);
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: background 0.15s ease;
    flex-shrink: 0;
    min-width: 32px;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover { background-color: rgba(0,0,0,0.1); color: var(--text-primary); }

.modal-body { margin-bottom: 1.25rem; }

.modal-divider { height: 1px; background-color: #f0f0f0; margin: 0.875rem 0; }

.modal-section-title {
    font-size: 0.9375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
}

.attention-text {
    font-weight: 600;
    color: var(--default-color);
    text-align: center;
    margin: 0.375rem 0;
    font-size: 0.875rem;
}

.modal-instruction {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.text-center { text-align: center; }

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem 0;
}

.empty-state-image {
    max-width: 300px;
    width: 100%;
    border-radius: 20px;
    margin: 1rem auto;
    display: block;
}

.empty-state-message {
    color: var(--text-primary);
    font-size: 1.125rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    justify-content: center;
    padding: 2rem 0;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 98, 1, 0.15);
    border-radius: 50%;
    border-left-color: var(--default-color);
    animation: spin 0.9s linear infinite;
}

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

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--default-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { filter: brightness(0.9); transform: translateY(-3px); }

/* Card entrance animation */
@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Share Section */
.share-section { margin-top: 1.5rem; text-align: center; }

.share-button {
    background-color: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
}

.share-button:hover { background-color: #f5f5f5; border-color: #ccc; }

.back-link {
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: inherit;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.back-link:hover { background: rgba(0,0,0,0.04); }

/* Header for produto page */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Product detail page */
.product-card-large {
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    max-width: 480px;
    margin: 0 auto;
    animation: cardFadeIn 0.35s ease both;
}

.product-image-container.detail-view {
    height: 280px;
    border-radius: 16px;
    background: #f8f8f8;
    margin-bottom: 1.25rem;
}

.product-title-large {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-primary);
    margin: 0 0 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-info { padding: 0 0.125rem; }

/* Responsive Media Queries */
@media (min-width: 480px) {
    .container-fluid { padding: 0 1rem; }
    .product-image-container { height: 180px; }
    .product-title { font-size: 0.875rem; }
}

@media (min-width: 576px) {
    .container-fluid { padding: 0 1.5rem; }
    .logo-container { max-width: 200px; }
    .products-grid { gap: 1.25rem; }
}

@media (min-width: 768px) {
    .container-fluid { padding: 0 2rem; }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    .product-image-container { height: 200px; }
    .product-title { font-size: 0.9375rem; min-height: 3.5em; }
    .price-now { font-size: 1.75rem; }
    .seller-image { width: 38px; height: 38px; }
}

@media (min-width: 992px) {
    .container-fluid { padding: 0 3rem; }
    .logo-container { max-width: 220px; }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.75rem;
    }
    .product-image-container { height: 210px; }
}
