/* style_views.css - Specific Styles for Chat, DB, Store, Cam, and Settings Views */

/* --- CHAT VIEW --- */
#chat-view { padding: 0; gap: 0; }
#chat-view .panel-header { padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05); }
.chat-window { flex-grow: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 20px; }
.message-container { display: flex; flex-direction: column; max-width: 85%; }
.message { padding: 12px 16px; border-radius: 18px; line-height: 1.6; font-size: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.message-time { font-size: 11px; color: var(--text-secondary); padding: 4px 12px 0; }
.user-container { align-self: flex-end; align-items: flex-end; }
.bot-container { align-self: flex-start; align-items: flex-start; }
.user-message { background-color: #f0f6fc; color: #0d1117; border-bottom-right-radius: 4px; }
.bot-message { background-color: #212c40; color: #c9d1d9; border-bottom-left-radius: 4px; }
.session-separator { text-align: center; font-size: 11px; color: var(--text-secondary); margin: 16px 0; opacity: 0.6; position: relative; display: flex; align-items: center; justify-content: center; width: 100%; }
.session-separator::before, .session-separator::after { content: ''; height: 1px; background-color: var(--border-color); flex-grow: 1; margin: 0 10px; }

/* --- DB & STORE VIEWS --- */
.db-list-container { flex-grow: 1; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.db-list { flex-grow: 1; overflow-y: scroll; scrollbar-width: none; -ms-overflow-style: none; cursor: pointer; padding-bottom: 10px; }
.db-list::-webkit-scrollbar { display: none; }

.db-item { background-color: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; margin: 0 4px 8px; display: flex; gap: 12px; align-items: center; transition: all 0.2s; }
.db-item:hover { background-color: #30363d; border-color: var(--primary-accent); }
.db-item.story-starter { border-left: 3px solid var(--story-color); }
#teach-list .db-item { border-left: 3px solid var(--teach-color); }

.db-item-icon { width: 32px; height: 32px; background-color: rgba(255,255,255,0.05); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 18px; flex-shrink: 0; }
.db-item-info { flex-grow: 1; min-width: 0; }
.db-item-title { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.4; }
.db-item-cat { font-size: 11px; color: var(--text-secondary); background-color: rgba(255,255,255,0.05); padding: 1px 6px; border-radius: 4px; display: inline-block; margin-top: 4px; }
.db-item-actions { flex-shrink: 0; }
.db-item-actions button { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; }
.db-item-actions button:hover { color: var(--text-primary); }

/* Category Grid */
.category-grid-layout { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; padding-bottom: 20px; }
.category-card { background: linear-gradient(145deg, #161b22, #1f252e); border: 1px solid #30363d; border-radius: 16px; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; cursor: pointer; transition: all 0.25s; position: relative; min-height: 160px; }
.category-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); border-color: var(--primary-accent); background: linear-gradient(145deg, #1f252e, #262e3a); }
.cat-icon-large { width: 60px; height: 60px; background-color: rgba(255,255,255,0.05); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s; margin-bottom: 4px; }
.category-card:hover .cat-icon-large { background-color: var(--primary-accent); color: #fff; transform: scale(1.1); }
.cat-icon-large .material-symbols-outlined { font-size: 32px; color: var(--text-secondary); }
.category-card:hover .cat-icon-large .material-symbols-outlined { color: #fff; }
.cat-info-centered { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cat-name-large { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.cat-count-badge { font-size: 11px; color: var(--text-secondary); background-color: rgba(0,0,0,0.3); padding: 4px 10px; border-radius: 12px; }

/* Special Store Link (Bright Blue Theme) */
.category-card.special-store-link {
    background: rgba(240, 248, 255, 0.9);
    border: 2px solid #58a6ff;
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.2);
    backdrop-filter: blur(5px);
}
.category-card.special-store-link:hover {
    background: #ffffff;
    border-color: #218bff;
    box-shadow: 0 8px 25px rgba(88, 166, 255, 0.4);
    transform: translateY(-5px) scale(1.02);
}
.category-card.special-store-link .cat-icon-large { background-color: rgba(88, 166, 255, 0.2); color: #0969da; }
.category-card.special-store-link .material-symbols-outlined { color: #0969da; }
.category-card.special-store-link .cat-name-large { color: #0969da; font-weight: 700; }
.category-card.special-store-link .cat-count-badge { background-color: #0969da; color: #ffffff; font-weight: 600; }

/* Store Items (Light Theme) */
.store-item { background-color: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 12px; margin: 0 4px 10px; display: flex; align-items: center; gap: 12px; transition: all 0.2s; flex-shrink: 0; }
.store-item:hover { background-color: #30363d; border-color: var(--primary-accent); }
.store-icon { width: 40px; height: 40px; border-radius: 8px; background-color: rgba(88, 166, 255, 0.1); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--primary-accent); flex-shrink: 0; }
.store-info { flex-grow: 1; min-width: 0; }
.store-name { font-size: 15px; font-weight: 500; margin: 0 0 4px 0; color: var(--text-primary); }
.store-desc { font-size: 12px; color: var(--text-secondary); margin: 0 0 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-meta { font-size: 11px; color: #888; margin-top: 4px; display: flex; gap: 10px; }

.store-item.light-theme { background-color: #ffffff; border: 1px solid #e0e0e0; color: #333333; margin-bottom: 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.store-item.light-theme:hover { border-color: var(--primary-accent); box-shadow: 0 4px 12px rgba(88, 166, 255, 0.2); transform: translateY(-2px); }
.store-item.light-theme .store-name { color: #222; font-weight: 700; }
.store-item.light-theme .store-desc { color: #666; }
.store-item.light-theme .store-icon { background-color: rgba(88, 166, 255, 0.1); color: var(--primary-accent); }

.download-btn { background: none; border: none; color: var(--text-secondary); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.download-btn:hover { background-color: rgba(63, 185, 80, 0.15); color: var(--success-color); }
.download-btn:disabled { opacity: 0.5; cursor: not-allowed; animation: spin 1s linear infinite; }
.store-item.installed { opacity: 0.3; order: 999; }
.store-item.installed .download-btn { color: var(--success-color); cursor: default; }
.store-item.installed:hover { border-color: var(--success-color); }

/* Download All Button */
.download-all-btn {
    background: linear-gradient(135deg, #e3b341, #f0c040);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 10px rgba(227, 179, 65, 0.3);
    transition: all 0.2s;
}
.download-all-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(227, 179, 65, 0.5); }

/* Download Progress Bar */
.progress-container { display: flex; flex-direction: column; width: 200px; gap: 4px; }
.progress-bar-bg { width: 100%; height: 6px; background-color: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background-color: var(--success-color); width: 0%; transition: width 0.3s ease; }

/* Store List Container in Main View */
#store-list-container { display: flex; flex-direction: column; gap: 10px; }
#store-list-container .store-item { margin: 0; width: 100%; }

/* --- RECOMMENDATION SLIDER --- */
.recommend-wrapper { position: relative; width: 100%; display: flex; align-items: center; }
.recommend-slider { display: flex; overflow-x: auto; gap: 16px; padding: 4px 4px 16px 4px; scroll-behavior: smooth; width: 100%; scrollbar-width: none; -ms-overflow-style: none; }
.recommend-slider::-webkit-scrollbar { display: none; }
.recommend-card { flex: 0 0 calc(20% - 12.8px); min-width: 180px; background-color: #ffffff; color: #333333; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(0,0,0,0.2); border: 2px solid transparent; height: 100%; min-height: 180px; }
.recommend-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(255,255,255,0.2); border-color: var(--primary-accent); }
.rec-icon { width: 40px; height: 40px; background-color: #f0f2f5; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--primary-accent); font-size: 1.2rem; }
.rec-info { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.rec-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.rec-desc { font-size: 11px; color: #666; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-author { font-size: 10px; color: #888; margin-top: auto; display: flex; align-items: center; gap: 4px; }

.nav-slider-btn { background-color: rgb(22 27 34 / 0%); color: var(--primary-accent); border: 0px solid var(--border-color); width: 32px; height: 100%; position: absolute; top: 0; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; z-index: 2; opacity: 0.7; }
.nav-slider-btn:hover { background-color: var(--primary-accent); color: #fff; opacity: 1; }
.nav-slider-btn.prev { left: -40px; }
.nav-slider-btn.next { right: -40px; }

/* --- AI CAM VIEW --- */
#cam-view .panel-header .header-title .material-symbols-outlined { color: #d2a8ff; }
.cam-interface { flex-grow: 1; display: flex; flex-direction: column; gap: 16px; height: 100%; }
.cam-viewport { width: 100%; aspect-ratio: 4/3; background-color: #000; border-radius: 12px; overflow: hidden; position: relative; border: 1px solid var(--border-color); max-width: 600px; margin: 0 auto; }
.cam-placeholder { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--text-secondary); }
.cam-placeholder .material-symbols-outlined { font-size: 48px; margin-bottom: 8px; opacity: 0.5; }
#video-container { position: relative; width: 100%; height: 100%; }
#webcam-video { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
#ai-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.emotion-status-bar { background-color: #20252d; padding: 10px; border-radius: 8px; text-align: center; border: 0px solid var(--border-color); font-size: 14px; }
.cam-controls { display: flex; justify-content: center; gap: 12px; }

/* Camera Settings Panel */
.cam-settings-panel { background: var(--input-bg); padding: 15px; border-radius: 12px; border: 1px solid var(--border-color); margin-top: 10px; max-width: 600px; margin: 0 auto; width: 100%; }
.cam-settings-header { font-size: 14px; font-weight: bold; color: var(--text-secondary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }

/* Greeting Upload UI */
.greeting-upload-wrapper { display: flex; align-items: center; gap: 8px; padding-right: 4px; }
.icon-upload-btn { cursor: pointer; color: var(--text-secondary); transition: all 0.2s; display: flex; align-items: center; justify-content: center; padding: 4px; border-radius: 50%; background-color: rgba(255,255,255,0.05); }
.icon-upload-btn:hover { color: var(--primary-accent); background-color: rgba(88, 166, 255, 0.1); transform: scale(1.1); }
.icon-upload-btn .material-symbols-outlined { font-size: 20px; }
.icon-upload-btn.danger { color: var(--danger-color); }
.icon-upload-btn.danger:hover { background-color: rgba(248, 81, 73, 0.15); color: #ff6b6b; }
.file-name-display { font-size: 11px; color: var(--success-color); font-style: italic; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visitor-count-badge { background-color: var(--primary-accent); color: white; font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 10px; margin-left: 5px; display: inline-flex; align-items: center; gap: 3px; }

/* --- SETTINGS & STATUS --- */
#status-view .panel-header .header-title .material-symbols-outlined { color: var(--success-color); }
#status-view .section-title { display: none; }
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 12px; background-color: var(--input-bg); border-radius: 8px; margin-bottom: 8px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #555; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--success-color); }
input:checked + .slider:before { transform: translateX(20px); }

.admin-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 12px; background-color: var(--success-color); color: white; text-decoration: none; border-radius: 8px; font-weight: 600; transition: all 0.3s ease; border: 1px solid rgba(255,255,255,0.1); margin-top: 10px; }
.admin-btn:hover { background-color: #2ea043; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.admin-btn.disabled { background-color: #21262d; color: #484f58; cursor: not-allowed; pointer-events: none; border-color: #30363d; transform: none; box-shadow: none; }
.hint-text { font-size: 11px; color: var(--danger-color); margin-top: 6px; text-align: center; display: none; }
.admin-btn.disabled + .hint-text { display: block; }

.storage-card { background: linear-gradient(145deg, #1f252e, #161b22); border: 1px solid rgba(88, 166, 255, 0.3); border-radius: 16px; padding: 20px; margin-top: 20px; position: relative; overflow: hidden; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.storage-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.storage-title { font-size: 14px; color: var(--text-secondary); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.storage-percent-big { font-size: 24px; font-weight: 700; color: var(--primary-accent); }
.storage-bar-bg { width: 100%; height: 12px; background-color: rgba(255,255,255,0.05); border-radius: 6px; overflow: hidden; margin-bottom: 10px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); }
.storage-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary-accent), #79c0ff); border-radius: 6px; width: 0%; transition: width 1s ease-in-out; position: relative; }
.storage-bar-fill::after { content: ''; position: absolute; top: 0; left: 0; bottom: 0; right: 0; background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%); transform: translateX(-100%); animation: shimmer 2s infinite; }
.storage-details { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); }
/* style_views.css */

/* --- INTERFACE SECTIONS (Right Side / Main Area) --- */
.interface-section {
    display: none;
    flex-direction: column;
    height: 100%;
    width: 100%;
    padding: 20px; /* ลด Padding เล็กน้อยเพื่อให้เนื้อหาชิดขอบสวยงาม */
    gap: 20px;
    overflow-y: auto;
    position: absolute; /* ใช้ Absolute เพื่อซ้อนทับกันได้พอดี */
    top: 0;
    left: 0;
}

.interface-section.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
    z-index: 10; /* ให้แสดงอยู่บนสุด */
}

/* Home Content Specifics */
#home-content {
    padding: 0;
    position: relative;
    overflow: hidden;
    /* Home Content ไม่ต้องมี Scrollbar */
}

/* Input Area - ปรับให้ลอยอยู่ด้านล่างและกว้างขึ้น */
.input-area { 
    width: 90%; /* กว้างขึ้น */
    max-width: 1000px; 
    margin: 0 auto; 
    padding: 20px 0 30px; 
    display: flex; 
    align-items: center; 
    position: absolute; /* ลอยอยู่ด้านล่าง */
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20; 
}
/* --- SPECIAL STORE LINK (Light Theme Update) --- */

.category-card.special-store-link {
    background-color: #ffffff; /* พื้นหลังสีขาว */
    border: 0px solid var(--primary-accent); /* ขอบสีฟ้าของระบบ */
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.1);
    backdrop-filter: none; /* ปิดความเบลอเพื่อให้เป็นสีขาวสนิท */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ปรับสีตัวหนังสือหัวข้อ */
.category-card.special-store-link .cat-name-large {
    color: #333333; /* ตัวหนังสือสีดำ/เทาเข้ม */
    font-weight: 700;
}

/* ปรับส่วนไอคอน */
.category-card.special-store-link .cat-icon-large {
    background-color: rgba(88, 166, 255, 0.1); /* พื้นหลังไอคอนฟ้าอ่อนๆ */
    color: var(--primary-accent); /* สีไอคอนเป็นสีฟ้าระบบ */
}

.category-card.special-store-link .cat-icon-large .material-symbols-outlined {
    color: var(--primary-accent);
}

/* ปรับสี Badge ตัวเลขรายการ */
.category-card.special-store-link .cat-count-badge {
    background-color: var(--primary-accent); /* พื้นหลัง Badge สีฟ้า */
    color: #ffffff; /* ตัวเลขสีขาว */
    font-weight: 600;
}

/* เอฟเฟกต์ตอน Hover */
.category-card.special-store-link:hover {
    background-color: #f0f7ff; /* เปลี่ยนเป็นสีฟ้าจางมากๆ ตอนเอาเมาส์วาง */
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(88, 166, 255, 0.3);
    border-color: var(--primary-accent-hover);
}

/* ปรับสีตัวหนังสือตอน Hover (รักษาความเป็นสีดำไว้) */
.category-card.special-store-link:hover .cat-name-large {
    color: #000000;
}
/* --- TEACH VIEW ENHANCEMENT --- */

/* Quick Search Box */
.quick-search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 12px;
    margin-right: 15px;
    transition: all 0.3s;
}
.quick-search-wrapper:focus-within {
    border-color: var(--teach-color);
    background: rgba(255, 255, 255, 0.1);
}
.quick-search-wrapper input {
    background: none;
    border: none;
    color: white;
    font-size: 13px;
    padding: 4px;
    outline: none;
    width: 150px;
}

/* Time Group Header */
.time-group-header {
    width: 100%;
    color: var(--teach-color);
    font-size: 14px;
    font-weight: 700;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(227, 179, 65, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: span 3; /* ให้หัวข้อเต็มความกว้างของ Grid */
}

/* Teach Grid Layout (3 Columns) */
.teach-grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 10px 5px 30px 5px;
}

/* Teach Card Style */
.teach-card {
    background: linear-gradient(145deg, #1c2128, #161b22);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: all 0.2s ease;
    border-left: 4px solid var(--teach-color);
    height: 100%;
}
.teach-card:hover {
    transform: translateY(-3px);
    border-color: var(--teach-color);
    box-shadow: 0 5px 15px rgba(227, 179, 65, 0.1);
}

.teach-card-key {
    font-size: 16px;
    font-weight: 700;
    color: white;
    margin: 0;
}
.teach-card-val {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.teach-card-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 8px;
}

/* Responsive for Small Screens */
@media (max-width: 1100px) {
    .teach-grid-view { grid-template-columns: repeat(2, 1fr); }
    .time-group-header { grid-column: span 2; }
}
@media (max-width: 768px) {
    .teach-grid-view { grid-template-columns: 1fr; }
    .time-group-header { grid-column: span 1; }
}
/* --- TEACH VIEW ENHANCEMENT --- */

/* Quick Search Box */
.quick-search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 12px;
    margin-right: 15px;
    transition: all 0.3s;
}
.quick-search-wrapper:focus-within {
    border-color: var(--teach-color);
    background: rgba(255, 255, 255, 0.1);
}
.quick-search-wrapper input {
    background: none;
    border: none;
    color: white;
    font-size: 13px;
    padding: 4px;
    outline: none;
    width: 150px;
}

/* Time Group Header */
.time-group-header {
    width: 100%;
    color: var(--teach-color);
    font-size: 14px;
    font-weight: 700;
    margin: 20px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(227, 179, 65, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    grid-column: span 3;
}

/* Teach Grid Layout (3 Columns) */
.teach-grid-view {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 10px 5px 30px 5px;
}

/* Teach Card Style - ปรับให้สั้นลง (Horizontal Layout) */
.teach-card {
    background: linear-gradient(145deg, #1c2128, #161b22);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: row; /* เรียงแนวนอน */
    align-items: center; /* กึ่งกลางแนวตั้ง */
    justify-content: space-between;
    gap: 12px;
    position: relative;
    transition: all 0.2s ease;
    border-left: 4px solid var(--teach-color);
    min-height: 70px; /* กำหนดความสูงขั้นต่ำให้ดูสมดุล */
}

.teach-card:hover {
    transform: translateY(-2px);
    border-color: var(--teach-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ส่วนข้อมูลข้อความ */
.teach-card-info {
    flex: 1;
    min-width: 0; /* สำคัญเพื่อให้ text-overflow ทำงาน */
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.teach-card-key {
    font-size: 15px;
    font-weight: 700;
    color: white;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.teach-card-val {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1; /* บรรทัดเดียวเพื่อความสั้น */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ส่วนปุ่มกด - ย้ายมาต่อท้าย */
.teach-card-actions {
    display: flex;
    flex-direction: row; /* เรียงปุ่มแนวนอน */
    gap: 4px;
    flex-shrink: 0; /* ป้องกันปุ่มโดนบีบ */
}

.teach-card-actions .icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.teach-card-actions .edit-btn {
    color: var(--primary-accent);
    background-color: rgba(88, 166, 255, 0.1);
}
.teach-card-actions .edit-btn:hover {
    background-color: var(--primary-accent);
    color: white;
}

.teach-card-actions .delete-btn {
    color: var(--danger-color);
    background-color: rgba(248, 81, 73, 0.1);
}
.teach-card-actions .delete-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

/* Responsive */
@media (max-width: 1200px) {
    .teach-grid-view { grid-template-columns: repeat(2, 1fr); }
    .time-group-header { grid-column: span 2; }
}
@media (max-width: 768px) {
    .teach-grid-view { grid-template-columns: 1fr; }
    .time-group-header { grid-column: span 1; }
}
/* --- COMPACT STORAGE INDICATOR (Updated: No Border & High Contrast) --- */
.compact-storage-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06); /* เพิ่มความเข้มพื้นหลังเล็กน้อยแทนเส้นขอบ */
    border: none !important; /* เอาเส้นขอบออกตามคำขอ */
    border-radius: 10px;
    padding: 4px 14px;
    margin-left: auto;
    margin-right: 15px;
    height: 38px;
    transition: all 0.3s ease;
}

.compact-storage-indicator:hover {
    background: rgba(255, 255, 255, 0.1);
}

.compact-storage-indicator .storage-icon {
    font-size: 18px;
    color: var(--primary-accent); /* เปลี่ยนไอคอนเป็นสีฟ้าเพื่อให้เห็นชัด */
}

.storage-info-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 110px;
}

.storage-text-row {
    font-size: 10px;
    font-weight: 400; /* เพิ่มความหนาตัวอักษร */
    color: #ffffff; /* เปลี่ยนเป็นสีขาวบริสุทธิ์เพื่อให้ชัดเจนที่สุด */
    display: flex;
    justify-content: space-between;
    line-height: 1;
    letter-spacing: 0.3px;
}

/* ปรับปรุงเส้นกราฟให้ชัดเจน */
.compact-storage-indicator .storage-bar-bg {
    width: 100%;
    height: 6px; /* เพิ่มความหนาของเส้นกราฟเล็กน้อย */
    background-color: rgba(0, 0, 0, 0.4); /* พื้นหลังกราฟเข้มขึ้นเพื่อให้ตัว Fill เด่น */
    border-radius: 3px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.compact-storage-indicator .storage-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #58a6ff, #00dfd8); /* ใช้สี Gradient ที่สว่างและสดใส */
    border-radius: 3px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.5); /* เพิ่มเงาฟุ้งให้เส้นกราฟดูมีพลัง */
}

.storage-percent {
    font-size: 14px; /* ขยายขนาดตัวเลขเปอร์เซ็นต์ */
    font-weight: 800;
    color: #79c0ff; /* สีฟ้าสว่าง */
    min-width: 35px;
    text-align: right;
    text-shadow: 0 0 10px rgba(121, 192, 255, 0.3);
}

/* Responsive: ปรับขนาดเมื่อจอแคบ */
@media (max-width: 768px) {
    .storage-text-row { display: none; }
    .storage-info-wrapper { width: 70px; }
    .compact-storage-indicator { gap: 8px; padding: 4px 10px; }
}
/* --- AI CAM VIEW (Redesigned: Left-Right Layout) --- */
#cam-view .panel-header .header-title .material-symbols-outlined { color: #d2a8ff; }

/* Container หลัก: จัดเรียงแบบ Flex แนวนอน */
.cam-interface { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: row; /* ซ้าย-ขวา */
    gap: 24px; 
    height: 100%; 
    align-items: flex-start; /* ให้อยู่ชิดขอบบน */
}

/* ฝั่งซ้าย: หน้าจอกล้อง (ขยายเต็มพื้นที่ที่เหลือ) */
.cam-viewport { 
    flex: 1; /* ให้กล้องกินพื้นที่หลัก */
    width: 100%; 
    aspect-ratio: 4/3; 
    background-color: #000; 
    border-radius: 16px; 
    overflow: hidden; 
    position: relative; 
    border: 1px solid var(--border-color); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.cam-placeholder { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    color: var(--text-secondary); 
    background: linear-gradient(145deg, #161b22, #0d1117);
}
.cam-placeholder .material-symbols-outlined { font-size: 56px; margin-bottom: 12px; opacity: 0.3; }

#video-container { position: relative; width: 100%; height: 100%; }
#webcam-video { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; border-radius: 16px; }
#ai-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; border-radius: 16px; }

/* ฝั่งขวา: แผงควบคุม (ความกว้างคงที่) */
.cam-settings-panel {
    width: 550px;
    flex-shrink: 0;
    background: rgba(22, 27, 34, 0.8);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cam-settings-header { 
    font-size: 15px; 
    font-weight: 700; 
    color: var(--text-primary); 
    margin-bottom: 4px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* แถบสถานะ AI (ย้ายมาอยู่ด้านบนสุดของแผงควบคุมให้เด่นๆ) */
.emotion-status-bar { 
    background: linear-gradient(90deg, rgba(88, 166, 255, 0.1), rgba(210, 168, 255, 0.1));
    padding: 12px 16px; 
    border-radius: 12px; 
    text-align: center; 
    border: 1px solid rgba(88, 166, 255, 0.2); 
    font-size: 14px; 
    font-weight: 500;
    color: var(--primary-accent);
    margin-bottom: 10px;
}

/* Responsive Design (ยืดหยุ่นสำหรับจอเล็ก) */
@media (max-width: 1024px) {
    /* เมื่อจอเริ่มแคบ ให้แผงควบคุมเล็กลงนิดนึง */
    .cam-settings-panel { width: 300px; }
}

@media (max-width: 768px) {
    /* เมื่อเป็นมือถือ/แท็บเล็ตแนวตั้ง ให้พับกลับมาเป็น บน-ล่าง */
    .cam-interface { 
        flex-direction: column; 
        align-items: center;
    }
    .cam-viewport { 
        width: 100%; 
        max-width: 600px; /* จำกัดขนาดไม่ให้ล้นจอ */
        flex: none;
    }
    .cam-settings-panel { 
        width: 100%; 
        max-width: 600px; 
    }
}