/* 🎨 AI E-commerce Chatbot - Premium Glassmorphism Theme */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-sidebar: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.4);
    --secondary: #c084fc;
    --secondary-glow: rgba(192, 132, 252, 0.4);
    
    --accent: #22c55e;
    --accent-glow: rgba(34, 197, 94, 0.2);
    --danger: #ef4444;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --font-family: 'Outfit', 'Noto Sans Thai', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    display: flex;
    background-image: 
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(192, 132, 252, 0.08) 0px, transparent 50%);
}

/* 🧭 Sidebar Navigation */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px var(--primary-glow);
}

.brand-icon svg {
    width: 22px;
    height: 22px;
    fill: white;
}

.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand span {
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    color: white;
    font-weight: 600;
}

.menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.menu-item svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.menu-item:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: var(--primary);
    background: rgba(56, 189, 248, 0.1);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.15);
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
}

.user-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 🖥️ Main Workspace */
.main-content {
    flex-grow: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 頂 Header */
.top-bar {
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 3rem;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 1.5s infinite;
}

.btn-premium {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    transition: var(--transition-smooth);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

/* 📁 Tab Container */
.tab-container {
    flex-grow: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

/* 📊 Tab 1: Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.stat-icon.purple {
    color: var(--secondary);
}

.stat-icon.green {
    color: var(--accent);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-change {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-change.negative {
    color: var(--danger);
}

/* Dashboard Graphs & Tables */
.dashboard-details {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.chart-card, .list-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Simulated SVG Chart Style */
.chart-container {
    height: 220px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 1rem;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(to top, var(--primary), var(--secondary));
    border-radius: 8px 8px 0 0;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
    transition: height 0.8s ease-out;
}

.chart-label {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Recent Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.activity-details {
    flex-grow: 1;
}

.activity-details h5 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.activity-details p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* 💬 Tab 2: Live Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    border: 1px solid var(--border-color);
    background-color: rgba(15, 23, 42, 0.2);
    border-radius: 20px;
    height: calc(100vh - 180px);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.chat-sessions {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sessions-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.sessions-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.session-list {
    flex-grow: 1;
    overflow-y: auto;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.session-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.session-item.active {
    background-color: rgba(56, 189, 248, 0.06);
    border-left: 3px solid var(--primary);
}

.session-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 1px solid var(--border-color);
}

.session-avatar.online {
    border-color: var(--accent);
    position: relative;
}

.session-avatar.online::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    background-color: var(--accent);
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}

.session-info {
    flex-grow: 1;
    overflow: hidden;
}

.session-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.session-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.session-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.session-last-msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat window on the right */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.chat-user-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-user-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.bot-tag {
    background-color: rgba(192, 132, 252, 0.15);
    color: var(--secondary);
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(192, 132, 252, 0.2);
}

.chat-body {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0);
    background-size: 24px 24px;
}

.chat-bubble {
    max-width: 65%;
    padding: 0.85rem 1.1rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.chat-bubble.customer {
    background-color: rgba(255, 255, 255, 0.05);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.chat-bubble.bot {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(192, 132, 252, 0.15));
    border: 1px solid rgba(56, 189, 248, 0.2);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Order card inside chat */
.order-card {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.15);
}

.order-card h6 {
    color: var(--accent);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.order-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.order-card-row.total {
    border-top: 1px dashed var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
    font-weight: 700;
}

/* Chat Input Bar */
.chat-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.message-input {
    flex-grow: 1;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1.25rem;
    color: white;
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}

.btn-send {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px rgba(56, 189, 248, 0.2);
}

.btn-send:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(56, 189, 248, 0.3);
}

.btn-send svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Simulated customer controls */
.simulator-panel {
    display: flex;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.btn-sim-text {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.btn-sim-text:hover {
    color: var(--text-main);
    border-color: var(--primary);
    background-color: rgba(56, 189, 248, 0.05);
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    border: 1px solid var(--border-color);
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.3s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

/* 📦 Tab 3: Inventory Layout */
.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn-add-product {
    background-color: rgba(56, 189, 248, 0.1);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition-smooth);
}

.btn-add-product:hover {
    background-color: var(--primary);
    color: white;
}

.products-table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-premium th {
    padding: 1.25rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
}

.table-premium td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.table-premium tr:last-child td {
    border-bottom: none;
}

.table-premium tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.product-item-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1e293b, #334155);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid var(--border-color);
}

.product-name {
    font-weight: 600;
}

.badge-stock {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-stock.in-stock {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--accent);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-stock.low-stock {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-edit-stock {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-edit-stock:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.03);
}

/* 🧾 Tab 4: Orders Layout */
.badge-status {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-status.confirmed {
    background-color: rgba(34, 197, 94, 0.15);
    color: var(--accent);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-status.pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ⚙️ Tab 5: Bot Settings Layout */
.settings-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.settings-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(12px);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.form-group textarea {
    height: 150px;
    resize: none;
    line-height: 1.5;
}

.btn-save-settings {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
    transition: var(--transition-smooth);
}

.btn-save-settings:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

/* 🎞️ Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* 📎 Attach Button Style */
.btn-attach {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition-smooth);
}

.btn-attach:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

