:root {
    --primary-red: #e60023;
    --primary-red-dark: #b3001a;
    --primary-black: #000000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #fff;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    height: 100vh;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background-color: white;
}

.chat-box {
    flex: 1;
    /* overflow-y: auto; */
    padding: 20px;
    background-color: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 10px;
    max-width: 80%;
    display: inline-block;
    word-wrap: break-word;
    clear: both;
    /* ensure each message starts on new line */
}

.message.user {
    background-color: var(--primary-black);
    color: white;
    float: right;
    /* position on the right */
    text-align: right;
}

.message.assistant {
    background-color: white;
    border: 1px solid #e0e0e0;
    margin-right: auto;
    float: left;
    /* ensure assistant stays on left */
}

.message p {
    margin: 0;
    white-space: pre-wrap;
}

.restaurants-container,
.coupons-container,
.products-container,
.stores-container {
    margin-top: 15px;
}

.search-info {
    padding: 10px;
    padding-left: 0px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-weight: 500;
    font-size: 18px;
    color: rgba(34, 34, 34, 1);
}

.restaurants-grid,
.coupons-grid,
.stores-grid {
    display: grid;
    gap: 15px;
}

.matrix-grid {
    padding: 10px;
}

.products-grid {
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow: auto;
    padding: 10px 10px 10px 10px;
    background: #FBF9F8;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 12px;
}

th,
td {
    border: 1px solid #ddd;
    padding: 5px;
    padding-top: 12px;
    padding-bottom: 12px;
    text-align: center;
}

th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #495057;
}

.products-grid {
    display: flex;
    flex-direction: row;
    gap: 15px;
    overflow: auto;
    padding: 10px 10px 10px 10px;
    background: #FBF9F8;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.products-table {
    width: 100%;
}

.restaurant-card,
.coupon-card,
.store-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}
/* 
.product-card {
    min-width: 218px;
    height: 334px;
    border: 1.26px solid rgba(233, 232, 231, 1);
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 1);
    display: flex;
    flex-direction: column;
    padding-bottom: 12px;       
} */

.restaurant-card:hover,
.coupon-card:hover,
.store-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.restaurant-card.clickable,
.coupon-card.clickable,
.product-card.clickable,
.store-card.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.restaurant-card.clickable:hover,
.coupon-card.clickable:hover,
.store-card.clickable:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.restaurant-card.clickable:active,
.coupon-card.clickable:active,
.store-card.clickable:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.restaurant-header,
.coupon-header,
.store-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}


.coupon-icon,
.store-icon {
    width: 120px;
    /* fixed bounding box width */
    height: 40px;
    /* fixed bounding box height */
    margin-right: 12px;
    object-fit: contain;
    /* keep full logo inside box */
    background-color: transparent;
}

.restaurant-name,
.coupon-name,
.product-title,
.store-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.restaurant-details,
.coupon-details,
.store-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.address {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.address-icon {
    font-size: 16px;
    margin-top: 2px;
}

.address-text {
    color: #666;
    line-height: 1.4;
}

.cashback {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f1f8e9;
    padding: 6px 10px;
    border-radius: 6px;
    align-self: flex-start;
}

.cashback-icon {
    font-size: 16px;
}

.cashback-text {
    color: #388e3c;
    font-weight: 500;
    font-size: 14px;
}

/* Store-specific styles */
.store-description {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    padding: 8px 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary-red);
}

.store-commission {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #e8f5e8;
    padding: 8px 12px;
    border-radius: 6px;
    align-self: flex-start;
}

.store-commission-icon {
    font-size: 16px;
}

.store-commission-text {
    color: #2e7d32;
    font-weight: 600;
    font-size: 14px;
}

.store-commission-type {
    color: #666;
    font-size: 12px;
    font-weight: 400;
    margin-left: 4px;
}

/* Product-specific styles */
/* .product-image {
    min-height: 166px;
    max-height: 166px;
    margin: 8px;
    object-fit: contain;
    background-color: transparent;
} */

.product-title {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    /* limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 6px;
    margin-left: 12px;
    margin-right: 12px;
}

.product-color,
.product-age,
.product-gender {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: #f8f9fa;
    font-size: 13px;
    color: #666;
}

.product-pricing {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-left: 12px;
    margin-right: 12px;
}

.product-cashback {
    font-size: 14px;
    color: var(--primary-red);
    margin-left: 12px;
    margin-top: 7px;
    margin-bottom: 7px;
    height: 16px;
}

/* .product-offer-price {
    font-size: 20px;
    font-weight: 600;
    color: rgba(34, 34, 34, 1);
} */



.product-info-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.product-info-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border-radius: 3px;
    background-color: #f0f0f0;
    font-size: 12px;
    color: #555;
}

/* Coupon-specific styles */
.offer-description,
.offer-value,
.offer-type {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background-color: #f8f9fa;
}

.offer-description {
    background-color: #e8f5e8;
}

.offer-value {
    background-color: #fff3cd;
}

.offer-type {
    background-color: #f0f8ff;
}

.offer-icon,
.value-icon,
.type-icon,
.code-icon {
    font-size: 16px;
    margin-top: 1px;
}

.offer-text,
.value-text,
.type-text {
    color: #333;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
}

.offer-code {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background-color: #ffe5e5;
    border: 2px dashed var(--primary-red);
}

.code-label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary-red);
    font-weight: 500;
    font-size: 14px;
}

.code-value {
    color: var(--primary-black);
    font-weight: 700;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    background-color: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--primary-red);
    flex: 1;
    text-align: center;
    letter-spacing: 1px;
}

.copy-button {
    background: var(--primary-red);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-button:hover {
    background: var(--primary-red-dark);
    transform: scale(1.05);
}

.copy-button:active {
    transform: scale(0.95);
}

.input-container {
    display: flex;
    padding: 15px;
    background-color: white;
    border-top: 1px solid #e0e0e0;
}

.input-container input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
}

.input-container input:focus {
    border-color: var(--primary-red);
}

.input-container button {
    margin-left: 10px;
    padding: 12px 20px;
    background-color: var(--primary-red);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.input-container button:hover:not(:disabled) {
    background-color: var(--primary-red-dark);
}

.input-container button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* Loading indicator */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    margin-right: 7px;
    margin-top: 4px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .message {
        max-width: 90%;
    }

    .restaurant-card,
    .coupon-card,
    .store-card {
        padding: 12px;
    }

    .restaurant-name,
    .coupon-name,
    .store-name {
        font-size: 16px;
    }

    .offer-text,
    .value-text,
    .type-text {
        font-size: 13px;
    }

    .code-value {
        font-size: 14px;
        padding: 3px 6px;
    }

    .copy-button {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }

}

.offer-action-button {
    color: #ffffff;
    border: none;
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    align-self: flex-start;
    transition: transform 0.2s ease, background 0.2s ease;
    background-color: rgba(197, 2, 0, 1);
    box-shadow: 0 0 0 1px rgba(197, 2, 0, 1), 0 2px 4px 0 rgba(223, 177, 177, 1), 0 1px 1px 0 inset rgba(255, 255, 255, 1);
    background: linear-gradient(180deg, 0% rgba(197, 2, 0, 1), 100% rgba(167, 2, 0, 1));
}

.product-card .offer-action-button {
    margin-left: 12px;
}

.offer-action-button:hover {
    background: var(--primary-red-dark);
    transform: scale(1.05);
}

.text-content h2 {
    font-size: 17px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.text-content h3 {
    font-size: 16px;
    margin-top: 15px;
    margin-bottom: 10px;
}

.text-content ul {
    margin-left: 20px;
}
    
