/* PingPrice Web Interface Styles */
/* Inspired by mobile app design with modern blue theme */

:root {
    --primary-blue: #4FC3F7;
    --primary-blue-dark: #29B6F6;
    --primary-blue-light: #81D4FA;
    --background: #F5F8FA;
    --surface: #FFFFFF;
    --text-primary: #1A1A1A;
    --text-secondary: #666666;
    --border: #E0E0E0;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #F44336;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.95;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 600px;
    margin: auto;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-message h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.welcome-message > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 480px;
    margin: 0 auto 2rem auto;
}

.feature {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--background);
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    width: 100%;
}

.feature-icon {
    font-size: 1.25rem;
}

.hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Chat Messages */
.message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    color: white;
}

.message.assistant .message-avatar {
    background: var(--background);
    color: var(--text-primary);
}

.message-content {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    line-height: 1.5;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--background);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

/* Products Container */
.products-container {
    position: fixed;
    right: 2rem;
    top: 6rem;
    bottom: 8rem;
    width: 400px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow);
    display: flex;
    flex-direction: column;
    z-index: 100;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.products-container.hidden {
    display: none;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.products-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.products-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Product Card */
.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.product-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    transform: translateY(-2px);
}

.product-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.product-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-brand {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.product-details {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.product-quantity {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.product-price {
    text-align: right;
}

.price-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue-dark);
}

.price-per-unit {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.product-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.badge-bio {
    background: #E8F5E9;
    color: #2E7D32;
}

.badge-promo {
    background: #FFF3E0;
    color: #E65100;
}

.promotion-info {
    background: #FFF3E0;
    border: 1px solid #FFE0B2;
    border-radius: 8px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}

.promotion-label {
    color: #E65100;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.promotion-message {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

/* Input Area */
.input-area {
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px var(--shadow);
}

.input-container {
    display: flex;
    gap: 1rem;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
}

#messageInput {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid var(--border);
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
}

#messageInput:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.1);
}

.btn-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--shadow);
}

.btn-send:active {
    transform: scale(0.95);
}

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


.message-content.loading-message {
    background: var(--background);
    color: var(--text-secondary);
    font-style: italic;
    border-bottom-left-radius: 4px;
}

/* Animation des trois points */
.loading-dots {
    display: inline-block;
    margin-left: 2px;
}

.loading-dots span {
    animation: loading-dots 1.4s infinite;
    opacity: 0;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loading-dots {
    0%, 60%, 100% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.api-section {
    margin-bottom: 2rem;
}

.api-section h3 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.api-section p {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.api-section pre {
    background: var(--background);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.api-section code {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.api-section ul {
    list-style: none;
    padding-left: 0;
}

.api-section li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.api-section li::before {
    content: "•";
    color: var(--primary-blue);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .products-container {
        width: 350px;
    }
}

@media (max-width: 968px) {
    .products-container {
        right: 1rem;
        left: 1rem;
        width: auto;
    }
    
    .message-content {
        max-width: 85%;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .features {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .products-container {
        top: auto;
        bottom: 0;
        max-height: 60vh;
        border-radius: 16px 16px 0 0;
    }
    
    .message-content {
        max-width: 90%;
    }
}


/* Products Grid intégré dans la conversation */
.products-grid-inline {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 0 1rem;
    max-width: 900px;
    animation: slideIn 0.3s ease;
}

/* Product Card inline */
.product-card-inline {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px var(--shadow);
}

.product-card-inline:hover {
    box-shadow: 0 4px 12px var(--shadow-hover);
    transform: translateY(-2px);
}

/* Image réelle du produit */
.product-image-real {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.product-image-real img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

/* Responsive pour les cards inline */
@media (max-width: 768px) {
    .products-grid-inline {
        grid-template-columns: 1fr;
        padding: 0;
    }
    
    .product-card-inline {
        margin: 0.5rem 0;
    }
}

/* Styles additionnels pour PingPrice - Produits et Retailers */

/* =================================
   PRODUCTS GRID INLINE
   ================================= */

.products-grid-inline {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

/* =================================
   PRODUCT CARD INLINE
   ================================= */

.product-card-inline {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-card-inline:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

/* Product Header with Retailer Badge */
.product-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.product-retailer-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #667eea;
}

.retailer-badge-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.retailer-badge-name {
    white-space: nowrap;
}

/* Product Image */
.product-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    min-height: 120px;
}

.product-image-real {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
}

/* Product Info */
.product-info {
    flex: 1;
    min-height: 60px;
}

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

.product-brand {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

/* Product Details */
.product-details {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.product-quantity {
    font-size: 11px;
    color: #666;
    background: #f5f5f5;
    padding: 3px 8px;
    border-radius: 4px;
}

.product-price {
    text-align: right;
}

.price-main {
    font-size: 18px;
    font-weight: 700;
    color: #2ecc71;
}

.price-per-unit {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
}

/* Product Badges */
.product-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 8px;
}

.badge-bio {
    background: #d4edda;
    color: #155724;
}

/* Promotion Info */
.promotion-info {
    background: linear-gradient(135deg, #ff6b6b15 0%, #ee575715 100%);
    border-left: 3px solid #ff6b6b;
    padding: 8px;
    border-radius: 6px;
    margin-top: 8px;
}

.promotion-label {
    font-size: 11px;
    font-weight: 700;
    color: #ff6b6b;
    margin-bottom: 4px;
}

.promotion-message {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
}

.promotion-price {
    font-size: 12px;
    font-weight: 600;
    color: #ff6b6b;
    margin-top: 4px;
}

/* =================================
   LOADING MESSAGE
   ================================= */

.loading-message {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%) !important;
    border: 1px solid #667eea30;
    font-style: italic;
    color: #667eea;
}

.loading-dots {
    display: inline-block;
}

.loading-dots span {
    animation: blink 1.4s infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 60%, 100% {
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
}

/* =================================
   RESPONSIVE
   ================================= */

@media (max-width: 768px) {
    .products-grid-inline {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
        padding: 10px;
    }
    
    .product-card-inline {
        padding: 10px;
    }
    
    .product-image-container {
        min-height: 80px;
        padding: 10px;
    }
    
    .product-image-real {
        max-height: 70px;
    }
    
    .product-name {
        font-size: 12px;
    }
    
    .price-main {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .products-grid-inline {
        grid-template-columns: 1fr;
    }
    
    .retailer-selector {
        padding: 10px 15px;
    }
    
    .retailers-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }
    
    .retailer-item {
        padding: 8px 4px;
    }
    
    .retailer-logo {
        width: 40px;
        height: 40px;
    }
    
    .retailer-name {
        font-size: 10px;
    }
}