/* app-layout.css - Main app layout with sidebar */

.main-app { display: none; margin-top: 70px; height: calc(100vh - 70px); overflow: hidden; }

.main-app.active { display: flex; }

/* Sidebar */

.sidebar { width: 380px; min-width: 180px; max-width: 700px; flex-shrink: 0; background: #ffffff; display: flex; flex-direction: column; box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1); border-right: 1px solid #e5e7eb; }
#sidebarDivider { width: 5px; flex-shrink: 0; cursor: col-resize; background: transparent; transition: background 0.15s; z-index: 10; }
#sidebarDivider:hover, #sidebarDivider.dragging { background: #6366f1; }

.sidebar-header { padding: 24px 20px; border-bottom: 1px solid #e5e7eb; }

.sidebar-logo { width: 60px; height: 60px; margin-bottom: 16px; }

.user-info { margin-top: 0; display: flex; align-items: center; gap: 12px; }

.user-avatar-circle { width: 50px; height: 50px; border-radius: 50%; background: linear-gradient(135deg, #ffd700 0%, #f4c430 100%); display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4); }

.user-avatar-text { font-size: 20px; font-weight: 700; color: #3b82f6; text-transform: uppercase; user-select: none; }

.user-name { font-size: 16px; font-weight: 600; color: #1f2937; }

/* Sidebar Navigation */

.sidebar-nav { padding: 16px 12px; border-bottom: 1px solid #e5e7eb; }

.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 8px; color: #4b5563; text-decoration: none; border-radius: 8px; transition: all 0.3s; font-weight: 500; }

.nav-item:hover { background: #f3f4f6; }

.nav-item.active { background: #fef3c7; color: #92400e; font-weight: 600; }

.nav-icon { font-size: 20px; }

.nav-text { font-size: 16px; }

/* Sidebar Chat */

.sidebar-chat { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-header { padding: 16px 20px; border-bottom: 1px solid #e5e7eb; }

.chat-header h3 { font-size: 16px; font-weight: 600; margin: 0; color: #1f2937; }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: none; -ms-overflow-style: none; }

.chat-messages::-webkit-scrollbar { width: 0; height: 0; }

.message { max-width: 85%; display: flex; flex-direction: column; animation: slideIn 0.3s ease-out; }

.message-content { padding: 10px 14px; border-radius: 12px; line-height: 1.5; word-wrap: break-word; font-size: 14px; }

/* Modern Chat Styling */

.message-user .message-content { background: linear-gradient(135deg, #FFC107 0%, #FFB300 100%); /* Yellow gradient */ color: #1f2937; /* Dark text for contrast on yellow */ border-bottom-right-radius: 4px; box-shadow: 0 4px 6px rgba(255, 193, 7, 0.25); font-weight: 500; }

.message-ai .message-content { background: linear-gradient(135deg, #F8DCC8 0%, #F2C4A3 100%); /* Soft peach gradient */ color: #6b3f24; /* Warm brown text for contrast on peach */ border-bottom-left-radius: 4px; box-shadow: 0 4px 6px rgba(242, 196, 163, 0.35); border: none; font-weight: 500; }

.chat-input-area { padding: 16px; border-top: 1px solid #e5e7eb; background: #f9fafb; }

#chatInput { width: 100%; padding: 12px 14px; /* Slightly more padding for comfort */ border: 2px solid #e5e7eb; /* Lighter border initially */ border-radius: 12px; /* More rounded */ font-size: 14px; resize: none; background: #ffffff; margin-bottom: 8px; font-family: inherit; color: #1f2937; transition: all 0.2s ease-in-out; /* Smooth transition */ box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); /* Subtle inner shadow */ box-sizing: border-box; /* Include padding and border in width */ }

#chatInput:focus { outline: none; border-color: #FFC107; /* Yellow border */ background: #fff; box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15); /* Soft yellow glow */; }

#sendBtn { width: 100%; padding: 10px; background: linear-gradient(135deg, #FFC107 0%, #FFB300 100%); /* Same yellow gradient as user message */ color: #1f2937; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; box-shadow: 0 2px 4px rgba(255, 179, 0, 0.3); box-sizing: border-box; /* Include padding in width */ }

#sendBtn:hover { background: linear-gradient(135deg, #FFB300 0%, #FFA000 100%); transform: translateY(-1px); box-shadow: 0 4px 6px rgba(255, 179, 0, 0.4); }

#sendBtn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Main Content Area */

.main-content-area { flex: 1; overflow: hidden; background: #f5f5f5; position: relative; }

.content-page { display: none; padding: 40px; height: 100%; overflow-y: auto; }

.content-page.active { display: block; }

/* Showroom and Consultation pages - no padding, full height, flex layout */
#showroom-content, #consultation-content {
    padding: 0 !important;
    height: 100%;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#showroom-content.active, #consultation-content.active {
    display: flex;
}

/* Showroom Tabs */

.showroom-tabs { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 2px solid #e5e7eb; }

.showroom-tab { padding: 12px 24px; background: transparent; border: none; border-bottom: 3px solid transparent; color: #6b7280; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s; margin-bottom: -2px; }

.showroom-tab:hover { color: #d1a018; }

.showroom-tab.active { color: #d1a018; border-bottom-color: #d1a018; }

.showroom-tab-content { display: none; }

.showroom-tab-content.active { display: block; }

/* Preview Section */

.preview-header { display: flex; justify-content: flex-start; align-items: center; margin-bottom: 16px; padding: 12px; background: white; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); }

.back-btn { padding: 10px 20px; background: #6b7280; color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; }

.back-btn:hover { background: #4b5563; }

.preview-frame { background: white; border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); min-height: 600px; overflow: auto; }

.content-header { margin-bottom: 32px; }

.content-header h1 { font-size: 36px; color: #0a2952; margin-bottom: 8px; font-family: "Montserrat", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }

.content-header .subtitle { font-size: 18px; color: #666; }

/* Programs Grid (for showroom) */

.programs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin-bottom: 40px; }

/* Results List (for consultation) */

.results-list { display: flex; flex-direction: column; gap: 16px; padding-bottom: 20px; }

.result-card { display: flex; gap: 16px; background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); cursor: pointer; transition: all 0.3s; }

.result-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12); }

.result-thumbnail { width: 120px; height: 120px; border-radius: 8px; object-fit: cover; background: #f0f0f0; flex-shrink: 0; }

.result-content { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.result-title { font-size: 20px; font-weight: 600; color: #0a2952; line-height: 1.3; }

.result-domain { font-size: 14px; color: #d1a018; font-weight: 500; }

.result-snippet { font-size: 15px; color: #666; line-height: 1.5; }

.result-reason { font-size: 14px; color: #4a9d4a; font-weight: 500; padding: 8px 12px; background: #e8f5e8; border-radius: 6px; margin-top: 4px; }

.about-content { padding: 20px; line-height: 1.6; color: #555; }

.about-content p { margin-bottom: 16px; }

@media (max-width: 768px) {
    .result-card { flex-direction: column; }
    .result-thumbnail { width: 100%; height: 180px; }
}

/* Status Indicator (in sidebar chat) */

.sidebar-chat .status-indicator { background: #f3f4f6; padding: 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; animation: slideIn 0.3s ease-out; }

.sidebar-chat .status-spinner { width: 16px; height: 16px; border: 2px solid #e5e7eb; border-top-color: #d1a018; border-radius: 50%; animation: spin 1s linear infinite; }

.sidebar-chat .status-text { color: #4b5563; font-size: 13px; }

/* Status Indicator (in mobile overlay) */

.mobile-chat-messages .status-indicator { background: #f0f0f0; padding: 12px; border-radius: 10px; display: flex; align-items: center; gap: 10px; }

.mobile-chat-messages .status-spinner { width: 16px; height: 16px; border: 2px solid #e0e0e0; border-top-color: #d1a018; border-radius: 50%; animation: spin 1s linear infinite; }

.mobile-chat-messages .status-text { color: #666; font-size: 13px; }

/* Mobile Styles */

.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); z-index: 1000; opacity: 0; transition: opacity 0.3s; }

.mobile-overlay.show { display: flex; opacity: 1; justify-content: center; align-items: flex-end; }

.mobile-chat-container { background: white; width: 100%; max-height: 80vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.3s; }

.mobile-overlay.show .mobile-chat-container { transform: translateY(0); }

.mobile-chat-header { padding: 20px; border-bottom: 1px solid #e0e0e0; display: flex; justify-content: space-between; align-items: center; }

.mobile-chat-header h3 { font-size: 20px; color: #333; margin: 0; }

.close-btn { font-size: 32px; background: none; border: none; color: #666; cursor: pointer; line-height: 1; }

.mobile-chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }

.mobile-input-area { padding: 16px; border-top: 1px solid #e0e0e0; background: #f9f9f9; display: flex; gap: 8px; }

#chatInputMobile { flex: 1; padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 14px; resize: none; font-family: inherit; }

#sendBtnMobile { padding: 10px 20px; background: linear-gradient(135deg, #d1a018 0%, #b8901e 100%); color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }

.mobile-chat-btn { display: none; position: fixed; bottom: 24px; right: 24px; width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #d1a018 0%, #b8901e 100%); color: white; border: none; font-size: 28px; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); z-index: 900; }

/* Responsive */

@media (max-width: 1024px) {
    .sidebar { width: 320px; }
    .programs-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
    .content-page { padding: 24px; }
}

.mobile-consultation-chat { display: none; }
.mobile-filter-btn { display: none; }
.sidebar-mobile-backdrop { display: none; }

@media (max-width: 768px) {
    .sidebar { display: none !important; }
    .sidebar.mobile-open { display: flex !important; position: fixed; top: 70px; left: 0; bottom: 0; width: 85%; max-width: 360px; background: white; z-index: 950; box-shadow: 4px 0 16px rgba(0,0,0,0.18); }
    .sidebar-mobile-backdrop { position: fixed; inset: 70px 0 0 0; background: rgba(0,0,0,0.45); z-index: 940; }
    .sidebar-mobile-backdrop.show { display: block; }
    .main-content-area { width: 100%; }
    .mobile-chat-btn { display: flex; align-items: center; justify-content: center; }
    .mobile-filter-btn { display: flex; position: fixed; bottom: 24px; left: 24px; width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #1e488f 0%, #0f2a5a 100%); color: white; border: none; font-size: 24px; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 900; align-items: center; justify-content: center; }
    .content-page { padding: 20px 16px; }
    .content-header h1 { font-size: 28px; }
    .programs-grid { grid-template-columns: 1fr; }
    .back-btn { width: 100%; }
    #consultation-content { padding-bottom: 70px !important; }
    .mobile-consultation-chat { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; overflow-y: auto; max-height: 45vh; padding: 10px 12px; margin-bottom: 8px; background: white; border-radius: 8px; }
    .mobile-consultation-chat .message-user { align-self: flex-end; }
    .mobile-consultation-chat .message-ai { align-self: flex-start; }
    .mobile-consultation-chat .status-indicator { background: #f3f4f6; padding: 10px 12px; border-radius: 10px; display: flex; align-items: center; gap: 8px; }
    .mobile-consultation-chat .status-spinner { width: 14px; height: 14px; border: 2px solid #e5e7eb; border-top-color: #d1a018; border-radius: 50%; animation: spin 1s linear infinite; }
    .mobile-consultation-chat .status-text { color: #4b5563; font-size: 13px; }
}

/* ===== Admin Mode Toggle (Navbar) ===== */

.admin-mode-toggle { display: flex; align-items: center; margin-left: 20px; background: rgba(0, 0, 0, 0.25); padding: 8px 16px; border-radius: 8px; gap: 15px; }

.toggle-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }

.toggle-switch input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }

.toggle-slider { position: relative; display: inline-block; width: 48px; height: 24px; background: #cbd5e0; border-radius: 24px; transition: all 0.3s; }

.toggle-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; background: white; border-radius: 50%; transition: all 0.3s; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }

.toggle-switch input:checked + .toggle-slider { background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%); }

.toggle-switch input:checked + .toggle-slider::after { transform: translateX(24px); }

.toggle-label { font-size: 14px; font-weight: 600; color: #e0e0e0; white-space: nowrap; }

.toggle-switch input:checked ~ .toggle-label { color: #4ade80; }

.phpmyadmin-link { color: #60d5f0 !important; font-weight: 600; transition: all 0.2s; border-left: 1px solid rgba(255, 255, 255, 0.2); padding-left: 15px; }

.phpmyadmin-link:hover { color: #22d3ee !important; transform: translateY(-1px); }

/* Chat Mode Badge in Sidebar */

.chat-header { position: relative; display: flex; align-items: center; justify-content: space-between; }

.chat-mode-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 12px; background: #e0f2fe; color: #0369a1; text-transform: uppercase; letter-spacing: 0.5px; transition: all 0.3s; }

.chat-mode-badge.admin-mode { background: #ffedd5; color: #c2410c; }

/* Admin Mode Styling (Applied when in admin mode) */

body.admin-chat-mode .chat-header { background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%); }

body.admin-chat-mode .chat-header h3, body.admin-chat-mode .chat-header .chat-mode-badge { color: white; background: rgba(255, 255, 255, 0.2); }

body.admin-chat-mode .message-user .message-content { background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%); color: white; box-shadow: 0 4px 6px rgba(255, 107, 53, 0.3); }

body.admin-chat-mode .message-ai .message-content { background: linear-gradient(135deg, #ffe5d9 0%, #ffd4c1 100%); color: #8b3a1a; box-shadow: 0 4px 6px rgba(255, 140, 66, 0.2); }

body.admin-chat-mode #chatInput:focus { border-color: #ff6b35; box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15); }

body.admin-chat-mode #sendBtn { background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%); color: white; box-shadow: 0 2px 4px rgba(255, 107, 53, 0.3); }

body.admin-chat-mode #sendBtn:hover { background: linear-gradient(135deg, #ff5722 0%, #ff6b35 100%); box-shadow: 0 4px 6px rgba(255, 87, 34, 0.4); }

body.admin-chat-mode .status-spinner { border-top-color: #ff6b35; }

/* Mobile Admin Mode */

body.admin-chat-mode .mobile-chat-messages .message-user .message-content { background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%); color: white; }

body.admin-chat-mode .mobile-chat-messages .message-ai .message-content { background: linear-gradient(135deg, #ffe5d9 0%, #ffd4c1 100%); color: #8b3a1a; }

body.admin-chat-mode #sendBtnMobile { background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%); }
