/* ========== COMPLETE STYLE.CSS - FIXED INPUT ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4299e1; --primary-dark: #3182ce; --success: #48bb78; --danger: #f56565;
    --bg-light: #f7fafc; --border: #e2e8f0; --text-dark: #2d3748; --text-muted: #718096;
    --shadow-sm: 0 4px 6px rgba(0,0,0,0.05); --shadow-md: 0 8px 24px rgba(0,0,0,0.1);
    --radius: 12px; --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh; color: var(--text-dark); line-height: 1.6;
}

/* HEADER */
.header {
    background: rgba(255,255,255,0.95); backdrop-filter: blur(20px);
    padding: 20px 40px; display: flex; align-items: center; justify-content: space-between;
    box-shadow: var(--shadow-md); position: sticky; top: 0; z-index: 100;
}

.logo { height: 50px; width: 50px; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary), var(--primary-dark)); display: flex; align-items: center; justify-content: center; font-size: 24px; color: white; box-shadow: var(--shadow-md); }

.company-name { font-size: 22px; font-weight: 700; color: var(--text-dark); }
.established { color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* PRODUCT BUTTONS */
.core-products { display: flex; gap: 12px; flex-wrap: wrap; }
.product-btn {
    display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: white;
    border: 2px solid var(--border); border-radius: var(--radius); color: var(--text-dark);
    cursor: pointer; transition: var(--transition); font-weight: 600; box-shadow: var(--shadow-sm);
    white-space: nowrap;
}
.product-btn:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.product-btn.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-color: var(--primary); }

/* MAIN LAYOUT */
.main-layout { display: flex; min-height: calc(100vh - 120px); max-width: 1600px; margin: 0 auto; }
.left-sidebar, .right-sidebar { width: 320px; background: white; box-shadow: var(--shadow-sm); }
.left-sidebar { border-right: 1px solid var(--border); }
.right-sidebar { border-left: 1px solid var(--border); }
.center-content { flex: 1; max-width: 900px; background: white; box-shadow: var(--shadow-sm); margin: 0 1px; display: flex; flex-direction: column; }

/* SIDEBAR */
.sidebar-section { padding: 32px 24px; }
.sidebar-section h3 { font-size: 18px; font-weight: 700; margin-bottom: 24px; color: var(--text-dark); display: flex; align-items: center; gap: 8px; }
.history-count { background: var(--primary); color: white; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.history-list { max-height: 500px; overflow-y: auto; scrollbar-width: thin; }
.history-item { padding: 20px; margin-bottom: 12px; background: var(--bg-light); border-radius: var(--radius); cursor: pointer; transition: var(--transition); border: 2px solid transparent; position: relative; }
.history-item:hover { background: #edf2f7; border-color: var(--primary); transform: translateX(4px); }
.history-item.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; }
.history-delete { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: var(--danger); color: white; border: none; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; opacity: 0; transition: var(--transition); }
.history-item:hover .history-delete { opacity: 1; }
.clear-history { width: 100%; padding: 14px; background: #fed7d7; border: none; border-radius: var(--radius); color: #c53030; font-weight: 600; cursor: pointer; }
.clear-history:hover { background: #feb2b2; transform: translateY(-2px); }

/* CENTER CONTENT */
.question-status { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; padding: 16px 32px; text-align: center; font-weight: 500; font-size: 15px; }
.product-header { padding: 40px 32px; text-align: center; background: var(--bg-light); border-bottom: 1px solid var(--border); }
.product-header h1 { font-size: 36px; font-weight: 800; margin-bottom: 12px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.product-specs { font-size: 16px; color: var(--text-muted); font-weight: 500; }

/* ========== CHATGPT PERFECT LAYOUT ========== */
.ai-chat-container {
    height: 700px !important; display: flex !important; flex-direction: column !important; overflow: hidden !important; flex: 1;
}

.product-nav {
    padding: 24px 32px !important; border-bottom: 1px solid var(--border) !important;
    background: var(--bg-light) !important; display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0 !important; z-index: 10;
}

.chat-messages {
    flex: 1 !important; padding: 40px 32px !important; overflow-y: auto !important; overflow-x: hidden !important;
    background: #fafbfc !important; scrollbar-width: thin;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.chat-input-area {
    padding: 24px 32px !important; border-top: 1px solid var(--border) !important; background: white !important;
    display: flex !important; gap: 16px !important; align-items: flex-end !important;
    flex-shrink: 0 !important; position: sticky !important; bottom: 0 !important; z-index: 100 !important;
}

#user-input {
    flex: 1 !important; padding: 20px 24px !important; border: 2px solid var(--border) !important;
    border-radius: var(--radius) !important; font-size: 16px !important; outline: none !important;
    resize: none !important; max-height: 120px !important; min-height: 60px !important;
    font-family: inherit !important; line-height: 1.5 !important; overflow: hidden !important;
}

#user-input:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.1); }

#send-btn {
    width: 60px !important; height: 60px !important; border-radius: 50% !important;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
    border: none !important; color: white !important; font-size: 20px !important;
    cursor: pointer !important; flex-shrink: 0 !important;
}

.nav-btn { padding: 12px 20px; border: 1px solid var(--border); background: white; border-radius: var(--radius); cursor: pointer; font-weight: 500; transition: var(--transition); }
.nav-btn:hover:not(:disabled) { background: var(--primary); color: white; border-color: var(--primary); }

/* MESSAGES */
.message { display: flex; margin-bottom: 24px; opacity: 0; animation: slideIn 0.4s ease forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.message.user { justify-content: flex-end; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.ai-avatar { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; }
.user-avatar { background: linear-gradient(135deg, var(--success), #38a169); color: white; }
.message-bubble { max-width: 70%; padding: 20px 24px; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.message.user .message-bubble { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-bottom-right-radius: 8px; }
.message.ai .message-bubble { background: white; border: 1px solid var(--border); border-bottom-left-radius: 8px; }
.message-text { font-size: 15px; line-height: 1.7; }

/* RIGHT SIDEBAR */
.product-card { background: var(--bg-light); padding: 24px; border-radius: var(--radius); margin-bottom: 16px; cursor: pointer; transition: var(--transition); border: 2px solid transparent; }
.product-card:hover { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; transform: translateY(-4px); }
.buy-btn { width: 100%; padding: 20px; background: linear-gradient(135deg, var(--success), #38a169); color: white; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 700; cursor: pointer; transition: var(--transition); margin-top: 16px; }
.buy-btn:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }

/* MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 10000; backdrop-filter: blur(10px); }
.modal-box { background: white; padding: 48px; border-radius: var(--radius); max-width: 450px; width: 90%; box-shadow: 0 25px 50px rgba(0,0,0,0.25); }
.close-modal { position: absolute; top: 20px; right: 24px; background: none; border: none; font-size: 28px; cursor: pointer; color: var(--text-muted); width: 44px; height: 44px; border-radius: 50%; }
.login-form input { width: 100%; padding: 20px; margin-bottom: 20px; border: 2px solid var(--border); border-radius: var(--radius); font-size: 16px; }
.login-btn { width: 100%; padding: 20px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border: none; border-radius: var(--radius); font-size: 16px; font-weight: 600; cursor: pointer; }

/* THEMES */
.theme-hydroxyapatite { --primary: #4299e1; }
.theme-graphene { --primary: #805ad5; }
.theme-aluminized { --primary: #ed8936; }
.theme-stainless { --primary: #48bb78; }

/* RESPONSIVE */
@media (max-width: 1200px) { .main-layout { flex-direction: column; } .left-sidebar, .right-sidebar { width: 100%; max-height: 300px; } }
@media (max-width: 768px) { .header { flex-direction: column; gap: 20px; text-align: center; } .ai-chat-container { height: 65vh !important; } }
