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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #2e7d32;
    color: #fff;
    flex-shrink: 0;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-cart {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cart:hover {
    background: rgba(255, 255, 255, 0.35);
}

.cart-count {
    background: #ff9800;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 4px;
}

.btn-new-cart {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-new-cart:hover {
    background: rgba(255, 255, 255, 0.35);
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.welcome {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-size: 15px;
    line-height: 1.5;
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message-user {
    align-self: flex-end;
    background: #2e7d32;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-assistant {
    align-self: flex-start;
    background: #f1f8e9;
    color: #333;
    border-bottom-left-radius: 4px;
}

.message-assistant.final {
    background: #e8f5e9;
    border-left: 3px solid #2e7d32;
    max-width: 95%;
}

.message-error {
    align-self: center;
    background: #ffebee;
    color: #c62828;
    border-radius: 8px;
    font-size: 13px;
}

.tool-badge {
    display: inline-block;
    background: #ff9800;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    margin-right: 4px;
    vertical-align: middle;
}

.tool-calls {
    margin-top: 6px;
}

.tool-call {
    margin: 4px 0;
    font-size: 13px;
    color: #e65100;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    cursor: default;
}

.product-card:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-img {
    width: 100%;
    height: 120px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.no-image {
    font-size: 40px;
    color: #ccc;
}

.product-info {
    padding: 8px 10px 10px;
}

.product-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.product-price {
    font-size: 14px;
    font-weight: 700;
    color: #2e7d32;
}

.product-rating {
    font-size: 12px;
    color: #ff9800;
}

.btn-add-to-cart {
    width: 100%;
    padding: 6px;
    background: #2e7d32;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-to-cart:hover {
    background: #1b5e20;
}

.btn-add-to-cart.added {
    background: #4caf50;
}

.cart-panel {
    position: absolute;
    top: 52px;
    right: 0;
    width: 280px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-left: 1px solid #e0e0e0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 0 12px;
}

.cart-panel.hidden {
    display: none;
}

.cart-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
}

.cart-panel-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.btn-close-cart {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    padding: 0 4px;
}

.btn-close-cart:hover {
    color: #333;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item:last-child {
    border-bottom: none;
}

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

.cart-item-name {
    font-size: 13px;
    color: #333;
}

.cart-item-price {
    font-size: 12px;
    color: #2e7d32;
    font-weight: 600;
}

.btn-remove-item {
    background: none;
    border: none;
    font-size: 18px;
    color: #ccc;
    cursor: pointer;
    padding: 0 4px;
}

.btn-remove-item:hover {
    color: #e53935;
}

.cart-empty {
    text-align: center;
    color: #999;
    padding: 30px 10px;
    font-size: 14px;
}

.input-area {
    display: flex;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    flex-shrink: 0;
    gap: 8px;
}

.message-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.message-input:focus {
    border-color: #2e7d32;
}

.message-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

.btn-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 8px;
    background: #2e7d32;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.btn-send:hover:not(.disabled) {
    background: #1b5e20;
}

.btn-send.disabled {
    background: #a5d6a7;
    cursor: not-allowed;
}
