/* style_base.css - Global Variables, Layout, and Common Components */

@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;700&display=swap');

:root {
    --bg-color: #0d1117;
    --panel-bg: transparent;
    --input-bg: #161b22;
    --primary-accent: #58a6ff;
    --primary-accent-hover: #79c0ff;
    --danger-color: #f85149;
    --success-color: #238636;
    --story-color: #d2a8ff;
    --teach-color: #e3b341;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --border-color: #30363d;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(0,0,0,0.4);
    
    /* Store Colors */
    --store-gold: #e3b341;
    --store-gold-bg: rgba(227, 179, 65, 0.1);
    --store-light-bg: #ffffff;
    --store-light-text: #333333;
}

* { box-sizing: border-box; }

body { 
    font-family: 'Sarabun', sans-serif; 
    background-color: var(--bg-color); 
    margin: 0; 
    color: var(--text-primary); 
    display: flex; height: 100vh; padding: 16px; overflow: hidden; 
}

.material-symbols-outlined { 
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20; 
    vertical-align: middle; 
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background-color: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,0.2); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.4); }

/* --- LAYOUT STRUCTURE --- */
.app-container { 
    display: flex; width: 100%; height: 100%; gap: 0; 
    border-radius: var(--radius); overflow: hidden; 
    position: relative; z-index: 5; 
    background-color: rgb(255 255 255 / 7%); 
    backdrop-filter: blur(20px); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    box-shadow: var(--shadow);
}

/* Widget Bar (Leftmost) */
.widget-bar { 
    width: 56px; flex-shrink: 0; 
    background-color: transparent; border: none; 
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; 
    padding: 16px 0; 
    border-right: 1px solid rgba(255,255,255,0.05);
}
.widget-bar button { 
    background: none; border: none; width: 40px; height: 40px; border-radius: 50%; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; 
    color: #ffffff; transition: all 0.2s; 
}
.widget-bar button:hover { background-color: var(--input-bg); }
.widget-bar button.active { background-color: #37425300; color:#21b5bb; }
.view-switcher { display: flex; flex-direction: column; gap: 10px; }

/* Control Panel (Chat Sidebar) */
.control-panel { 
    width: 400px; 
    background-color: rgba(0,0,0,0.2); 
    border-right: 1px solid var(--border-color); 
    display: flex; flex-direction: column; flex-shrink: 0; 
    transition: width 0.3s ease; 
    position: relative; 
}
.control-panel.collapsed { width: 0; padding: 0; overflow: hidden; border-right: none; }

/* View Container */
.view-container { 
    display: flex; flex-direction: column; height: 100%; padding: 16px; gap: 16px; 
}

/* Interface Sections (Right Side) */
.interface-section {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 24px 40px;
    gap: 20px;
    overflow-y: auto;
}
.interface-section.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Home Content */
#home-content { padding: 0; position: relative; overflow: hidden; }

/* --- COMMON COMPONENTS --- */
.panel-header { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.header-title { display: flex; align-items: center; gap: 12px; }
.header-title .material-symbols-outlined { color: var(--primary-accent); font-size: 28px; }
.header-title h1 { font-size: 20px; font-weight: 700; margin: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn { 
    background: none; border: none; width: 36px; height: 36px; border-radius: 50%; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; 
    color: var(--text-secondary); transition: all 0.2s; 
}
.icon-btn:hover { background-color: var(--input-bg); color: var(--text-primary); }
.icon-btn.danger:hover { color: var(--danger-color); }
.icon-btn.danger-text { color: var(--danger-color); }
.icon-btn.danger-text:hover { background-color: rgba(248, 81, 73, 0.1); }
.icon-btn.primary { color: var(--primary-accent); }
.icon-btn.primary:hover { background-color: var(--primary-accent); color: var(--input-bg); }

.panel-section { display: flex; flex-direction: column; gap: 12px; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; padding-right: 8px; }
.section-title { font-size: 14px; font-weight: 700; color: var(--text-secondary); margin: 0; }

/* Input Area */
.input-area { width: 80%; max-width: 900px; margin: 0 auto; padding: 16px 0 24px; display: flex; align-items: center; position: relative; z-index: 10; margin-top: auto; }
#user-input { flex-grow: 1; border: 1px solid var(--border-color); border-radius: 24px; padding: 12px 50px; font-size: 15px; resize: none; line-height: 1.6; font-family: 'Sarabun', sans-serif; background-color: var(--input-bg); color: var(--text-primary); transition: all 0.2s; }
#user-input:focus { outline: none; border-color: var(--primary-accent); box-shadow: 0 0 10px 4px rgba(88, 166, 255, 0.2); }
.input-action-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; border-radius: 50%; width: 44px; height: 44px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all 0.2s; }
.input-action-btn:hover { color: var(--primary-accent); }
.input-action-btn.hidden { opacity: 0; pointer-events: none; transform: translateY(-50%) scale(0.7); }
.input-action-btn.listening { color: var(--danger-color); animation: pulse 1.5s infinite; }
.input-area.disabled { opacity: 0.6; pointer-events: none; }
.input-action-btn.disabled { color: var(--text-secondary); cursor: not-allowed; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(217, 48, 37, 0); } 100% { box-shadow: 0 0 0 0 rgba(217, 48, 37, 0); } }

/* Performance Mode */
body.performance-mode .glow-container { display: none !important; }
body.performance-mode .app-container { 
    background: radial-gradient(circle at 50% 50%, #1c2331 0%, #0d1117 100%); 
    backdrop-filter: none !important; 
    box-shadow: none !important;
    border: 1px solid var(--border-color);
}
body.performance-mode .youtube-popup-overlay, 
body.performance-mode .image-popup,
body.performance-mode .modal-overlay,
body.performance-mode .modal-content,
body.performance-mode .suggestion-box,
body.performance-mode .user-greeting-display,
body.performance-mode .toast { 
    backdrop-filter: none !important; 
    background-color: rgba(0, 0, 0, 0.95); 
    box-shadow: none !important;
    border: 1px solid var(--border-color);
}
body.performance-mode .message {
    box-shadow: none !important;
    border: 1px solid rgba(255,255,255,0.05);
}
body.performance-mode .mini-cam-wrapper {
    box-shadow: none !important;
}
/* style_base.css - Global Variables, Layout, and Common Components */

/* --- LAYOUT STRUCTURE --- */
.app-container { 
    display: flex; width: 100%; height: 100%; gap: 0; 
    border-radius: var(--radius); overflow: hidden; 
    position: relative; z-index: 5; 
    background-color: rgb(255 255 255 / 7%); 
    backdrop-filter: blur(20px); 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    box-shadow: var(--shadow);
}

/* Widget Bar (Leftmost) */
.widget-bar { 
    width: 56px; flex-shrink: 0; 
    background-color: transparent; border: none; 
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; 
    padding: 16px 0; 
    border-right: 1px solid rgba(255,255,255,0.05);
    z-index: 20; /* อยู่เหนือ Main Interface */
}
/* ... (Widget Bar Buttons คงเดิม) ... */

/* Control Panel (Chat Sidebar) - ปรับให้ซ่อนได้หรือมีความกว้างคงที่ */
.control-panel { 
    width: 400px; 
    background-color: rgba(0,0,0,0.2); 
    border-right: 1px solid var(--border-color); 
    display: flex; flex-direction: column; flex-shrink: 0; 
    transition: width 0.3s ease, opacity 0.3s ease; 
    position: relative; 
    overflow: hidden;
}

/* เมื่อ Collapsed ให้ซ่อนไปเลย */
.control-panel.collapsed { 
    width: 0; 
    padding: 0; 
    border-right: none; 
    opacity: 0;
}

/* Main Interface - ขยายเต็มพื้นที่ */
.main-interface { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    justify-content: flex-end; 
    background-color: transparent; 
    position: relative; 
    overflow: hidden; 
    width: 100%; /* บังคับเต็มความกว้างที่เหลือ */
    height: 100%; /* บังคับเต็มความสูง */
}
