/* Global Professional Style for Laws AI (Refactored) */
:root {
    --primary-color: #067bd3;
    --primary-dark: #0566af;
    --primary-light: #e6f2fb;
    --header-bg: #ffffff;
    --menu-bg: #067bd3;
    --footer-bg: #1a232e;
    --text-main: #1c1e21;
    --text-muted: #65676b;
    --border-color: #e4e6eb;
    --card-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

body { font-family: 'Inter', 'Roboto', sans-serif; background-color: #f8f9fa; color: #1c1e21; }

/* Header Optimization */
.section-header-bar { background: #f0f2f5; border-bottom: 1px solid #e4e6eb; padding: 6px 0; }
.header-nav-inner { display: flex; justify-content: space-between; align-items: center; }

.section-header { padding: 20px 0; background: var(--header-bg); border-bottom: 1px solid #eee; }
#header .logo img { max-height: 80px; }
#header h1 { color: var(--primary-color); font-size: 24px; font-weight: 800; text-transform: uppercase; margin: 0 0 4px; letter-spacing: -0.01em; }
#header h2 { color: #65676b; font-size: 14px; font-weight: 500; margin: 0; }

/* Menu Site Optimization */
.section-nav { background: var(--menu-bg); box-shadow: 0 4px 12px rgba(6, 123, 211, 0.15); border-bottom: 1px solid var(--primary-dark); }
.second-nav .bg { background: transparent !important; box-shadow: none !important; border: none !important; }
#menusite .navbar-nav > li > a { color: #fff !important; font-weight: 600; text-transform: uppercase; font-size: 14px; padding: 18px 22px; transition: all 0.2s; }
#menusite .navbar-nav > li > a:hover, 
#menusite .navbar-nav > li.active > a { background: var(--primary-dark) !important; box-shadow: inset 0 -3px 0 #fff; }

/* Breadcrumbs Styling */
.breadcrumbs-wrap { background: #fff; padding: 12px 0; margin-bottom: 30px; border-bottom: 1px solid #e4e6eb; }
.breadcrumbs li a { color: var(--primary-color); font-weight: 600; background-color: var(--primary-light); border-radius: 4px; }
.breadcrumbs li a:hover { background-color: var(--primary-color); color: #fff; }

/* Footer Optimization */
.section-footer-top { background: var(--footer-bg); color: #aeb4be; padding: 60px 0 40px; }
.section-footer-top h3 { color: #fff; font-size: 17px; font-weight: 700; text-transform: uppercase; margin-bottom: 25px; border-left: 4px solid var(--primary-color); padding-left: 15px; }
.section-footer-top a { color: #9da3ae; text-decoration: none; transition: color 0.2s; }
.section-footer-top a:hover { color: var(--primary-light); }

.section-footer-bottom { background: #0f151c; padding: 20px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.section-footer-bottom .bttop a { background: var(--primary-color); color: #fff; border-radius: 8px; padding: 10px 14px; transition: transform 0.2s; }
.section-footer-bottom .bttop a:hover { transform: translateY(-3px); background: var(--primary-dark); }

/* Search Bar in Header */
.headerSearch .input-group .form-control { border-radius: 8px 0 0 8px; border: 1px solid #ddd; padding: 10px 15px; height: 42px; }
.headerSearch .input-group .btn-info { background: var(--primary-color); border-color: var(--primary-color); border-radius: 0 8px 8px 0; height: 42px; padding: 0 15px; }
.headerSearch .input-group .btn-info:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* VAN BAN MODULE STYLES - Premium Refactor */
.vb-search-page { font-family: 'Inter', sans-serif; min-height: 100vh; padding: 60px 0; color: var(--text-main); }
.search-wrap { background: #fff; border-radius: 24px; padding: 45px; box-shadow: 0 20px 50px rgba(0,0,0,0.06); margin-bottom: 50px; border: 1px solid rgba(26, 115, 232, 0.08); position: relative; }
.search-title { font-size: 22px; font-weight: 800; color: var(--primary-color); margin-bottom: 30px; display: flex; align-items: center; gap: 15px; letter-spacing: -0.02em; }
.search-box-custom { display: flex; gap: 18px; position: relative; z-index: 5; }
.input-wrapper-search { flex: 1; position: relative; display: flex; align-items: center; }
.input-wrapper-search input { width: 100%; padding: 18px 50px 18px 24px; border: 2px solid #eef0f2; border-radius: 16px; font-size: 16px; transition: all 0.3s; background: #f8f9fa; color: var(--text-main); }
.input-wrapper-search input:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 5px var(--primary-light); background: #fff; }
.clear-q { position: absolute; right: 18px; color: #bcc0c4; font-size: 20px; transition: 0.2s; cursor: pointer; }
.clear-q:hover { color: var(--primary-color); transform: scale(1.1); }

.search-box-custom button { background: var(--primary-color); color: #fff; border: none; padding: 0 35px; border-radius: 16px; font-weight: 700; cursor: pointer; transition: 0.3s; display: flex; align-items: center; gap: 12px; font-size: 15px; box-shadow: 0 6px 20px rgba(26, 115, 232, 0.25); }
.search-box-custom button:hover { background: var(--primary-dark); transform: translateY(-3px); box-shadow: 0 10px 25px rgba(26, 115, 232, 0.35); }
.search-box-custom button i { font-size: 18px; }

.list-title { font-size: 20px; font-weight: 800; color: var(--text-main); padding-bottom: 18px; margin-bottom: 30px; border-bottom: 2px solid var(--primary-light); display: flex; justify-content: space-between; align-items: center; letter-spacing: -0.01em; }
.list-title i { color: var(--primary-color); margin-right: 8px; }
.res-count { text-transform: none; font-weight: normal; color: var(--text-muted); font-size: 13px; }

.vb-item { background: #fff; border: 1px solid #f0f2f5; border-radius: 20px; padding: 30px; margin-bottom: 25px; transition: 0.3s; position: relative; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.vb-item:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0,0,0,0.08); border-color: rgba(26, 115, 232, 0.15); }
.vb-item-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 15px; }
.vb-item-title { color: var(--text-main); font-weight: 700; font-size: 19px; text-decoration: none !important; line-height: 1.4; transition: 0.2s; flex: 1; }
.vb-item-title:hover { color: var(--primary-color); }

.rel-badge { background: var(--primary-light); color: var(--primary-color); padding: 7px 16px; border-radius: 30px; font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(26, 115, 232, 0.1); }

.vb-item-meta { display: flex; flex-wrap: wrap; gap: 24px; font-size: 13.5px; color: var(--text-muted); margin-bottom: 20px; }
.vb-item-meta span { display: flex; align-items: center; gap: 8px; }
.vb-item-meta i { color: var(--primary-color); opacity: 0.8; }
.vb-item-meta b { color: var(--text-main); font-weight: 600; }

.vb-snippet-box { background: #fdfdfe; border: 1px solid #eef0f2; padding: 20px; font-size: 14.5px; color: #4b4b4b; line-height: 1.7; margin-top: 20px; border-radius: 14px; position: relative; transition: 0.2s; }
.vb-item:hover .vb-snippet-box { background: #fff; border-color: var(--primary-light); }
.snippet-tag { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--primary-color); font-size: 12px; text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.05em; }
.snippet-tag i { font-size: 14px; }

.no-results { text-align: center; padding: 100px 40px; background: #fff; border: 1px solid var(--border-color); border-radius: 24px; box-shadow: var(--card-shadow); }
.no-results i { font-size: 64px; color: #dee2e6; margin-bottom: 25px; }

.pagination-wrap { margin-top: 50px; border-top: 1px solid #f0f2f5; padding-top: 40px; }
.pagination-wrap .pagination > li > a, .pagination-wrap .pagination > li > span { border-radius: 12px !important; font-weight: 700; border: 1px solid #eef0f2; padding: 12px 20px; margin: 0 2px; transition: 0.2s; }
.pagination-wrap .pagination > li > a:hover { background-color: var(--primary-color); color: #fff; border-color: var(--primary-color); transform: translateY(-2px); }

/* Detail View - Modernized & Fixed */
.vb-detail-container { font-family: 'Inter', sans-serif; padding: 40px 0; background: #f8f9fa; min-height: 100vh; }
.vb-card { background: #fff; border-radius: 16px; box-shadow: var(--card-shadow); padding: 40px; border: 1px solid var(--border-color); }

.vb-title { color: var(--text-main); font-size: 26px; font-weight: 800; line-height: 1.4; margin-bottom: 35px; border-left: 6px solid var(--primary-color); padding-left: 20px; letter-spacing: -0.02em; }

.table-vb-info { width: 100%; border-collapse: collapse; margin-bottom: 35px; }
.table-vb-info td { padding: 18px 22px; border: 1px solid var(--border-color); font-size: 15px; }
.table-vb-info td.lbl { background: #fcfcfd; font-weight: 700; color: var(--text-muted); width: 20%; text-transform: uppercase; font-size: 12px; letter-spacing: 0.02em; }
.table-vb-info td.val { color: var(--text-main); }

.vb-actions { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 35px; border-top: 1px solid var(--border-color); padding-top: 35px; }
.btn-vb { display: inline-flex; align-items: center; gap: 10px; padding: 14px 28px; border-radius: 12px; font-weight: 700; text-decoration: none !important; transition: all 0.2s; font-size: 15px; cursor: pointer; }
.btn-vb-primary { background: var(--primary-color); color: #fff !important; box-shadow: 0 4px 12px rgba(6, 123, 211, 0.2); }
.btn-vb-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(6, 123, 211, 0.3); }
.btn-vb-secondary { background: #fff; color: var(--text-main) !important; border: 1px solid var(--border-color); }
.btn-vb-secondary:hover { background: #f0f2f5; border-color: #bcc0c4; transform: translateY(-2px); }

.tabs-header { border-bottom: 2px solid var(--primary-color); margin-bottom: 25px; }
.tabs-header span { display: inline-block; padding: 12px 25px; background: var(--primary-color); color: #fff; border-radius: 10px 10px 0 0; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Print Styles */
@media print {
    body * { visibility: hidden; }
    .vb-detail-container, .vb-detail-container * { visibility: visible; }
    .vb-detail-container { position: absolute; left: 0; top: 0; width: 100%; padding: 0 !important; background: #fff !important; margin: 0 !important; }
    .vb-card { box-shadow: none !important; border: none !important; padding: 0 !important; }
    .vb-actions { display: none !important; }
    .container { width: 100% !important; max-width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .vb-title { border-left-width: 10px; margin-top: 20px; font-size: 28px; }
    .table-vb-info td { border-color: #000 !important; }
}

/* Chat AI UI - Premium Refactor */
.chat-wrapper { margin: 20px auto; font-family: 'Inter', sans-serif; height: calc(100vh - 220px); min-height: 550px; }
.chat-container { border-radius: 20px; overflow: hidden; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.08); display: flex; flex-direction: column; height: 100%; border: 1px solid var(--border-color); }

.chat-header { background: var(--primary-color); color: #fff; padding: 20px 25px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 10; }
.chat-header .title { display: flex; align-items: center; gap: 15px; }
.chat-header .title-text { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.chat-header i.main-icon { font-size: 24px; background: rgba(255,255,255,0.2); padding: 8px; border-radius: 12px; }
.chat-header .header-tools { display: flex; align-items: center; gap: 18px; }
.chat-header .back-btn { color: #fff; opacity: 0.8; text-decoration: none !important; transition: 0.2s; }
.chat-header .back-btn:hover { opacity: 1; transform: translateX(-3px); }

.chat-box { flex: 1; overflow-y: auto; padding: 35px; display: flex; flex-direction: column; gap: 24px; background: #fdfdfe; }
.chat-box::-webkit-scrollbar { width: 5px; }
.chat-box::-webkit-scrollbar-thumb { background: #e0e4e9; border-radius: 10px; }

.message { max-width: 82%; padding: 16px 22px; border-radius: 20px; font-size: 14.5px; line-height: 1.6; position: relative; transition: 0.3s; }
.message.user { align-self: flex-end; background: var(--primary-color); color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 4px 15px rgba(26, 115, 232, 0.15); }
.message.bot { background: #f1f3f4; color: var(--text-main); border-bottom-left-radius: 4px; align-self: flex-start; }

.message-info { font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; letter-spacing: 0.05em; }
.message.user .message-info { color: rgba(255,255,255,0.7); flex-direction: row-reverse; }
.message.bot .message-info { color: var(--primary-color); }

/* AI Content Formatting - Optimized */
.bot-content h1, .bot-content h2, .bot-content h3 { color: var(--primary-color); margin: 20px 0 12px; font-weight: 700; line-height: 1.3; }
.bot-content h1 { font-size: 1.4rem; }
.bot-content h2 { font-size: 1.2rem; }
.bot-content h3 { font-size: 1.1rem; }
.bot-content strong { color: var(--primary-color); font-weight: 700; }
.bot-content div { margin-bottom: 10px; }

.list-item { margin: 10px 0; display: flex; align-items: flex-start; gap: 14px; padding: 12px 16px; background: rgba(255,255,255,0.7); border-radius: 12px; border: 1px solid rgba(0,0,0,0.03); transition: 0.2s; }
.list-item:hover { background: #fff; transform: translateX(5px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-color: rgba(26, 115, 232, 0.2); }
.list-item i.list-icon { color: var(--primary-color); font-size: 10px; margin-top: 8px; flex-shrink: 0; }
.list-item .list-number { font-weight: 800; color: var(--primary-color); min-width: 24px; font-size: 14px; flex-shrink: 0; margin-top: 2px; }
.list-item .list-content { flex: 1; font-size: 14px; color: var(--text-main); line-height: 1.5; }

.source-tag { display: inline-flex; align-items: center; gap: 8px; background: rgba(26, 115, 232, 0.08); color: var(--primary-color); padding: 6px 14px; border-radius: 8px; font-size: 12px; font-weight: 700; margin-top: 12px; border: 1px dashed var(--primary-color); transition: 0.2s; }
.source-tag:hover { background: var(--primary-color); color: #fff; transform: scale(1.02); }

blockquote { margin: 15px 0; padding: 12px 20px; border-left: 5px solid var(--primary-color); background: rgba(26, 115, 232, 0.04); border-radius: 4px 12px 12px 4px; font-style: italic; color: #555; }

.chat-input-area { padding: 25px 30px; background: #fff; border-top: 1px solid #f0f2f5; display: flex; gap: 15px; align-items: center; }
.input-wrapper { flex: 1; background: #f1f3f4; border-radius: 15px; border: 2px solid transparent; transition: 0.2s; }
.input-wrapper:focus-within { background: #fff; border-color: var(--primary-color); box-shadow: 0 0 0 4px var(--primary-light); }
.input-wrapper input { width: 100%; border: none; background: transparent; outline: none; padding: 14px 20px; font-size: 15px; color: var(--text-main); }

.send-btn { background: var(--primary-color); color: #fff; border: none; width: 52px; height: 52px; border-radius: 15px; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(26, 115, 232, 0.25); }
.send-btn:hover { background: var(--primary-dark); transform: translateY(-3px) rotate(-5deg); box-shadow: 0 6px 18px rgba(26, 115, 232, 0.35); }

.typing-indicator { font-size: 13px; color: var(--text-muted); padding: 15px 35px; display: none; align-items: center; gap: 15px; background: #fff; border-top: 1px solid #f0f2f5; position: relative; }
.ai-pulse-ring { position: absolute; left: 35px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); animation: ai-pulse 2s infinite; z-index: 1; }
.ai-avatar-mini { width: 34px; height: 34px; background: var(--primary-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; position: relative; z-index: 2; font-size: 14px; box-shadow: 0 4px 10px rgba(26, 115, 232, 0.2); }
.typing-text { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--primary-color); letter-spacing: 0.01em; background: linear-gradient(90deg, var(--primary-color) 0%, #8ab4f8 50%, var(--primary-color) 100%); background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent; animation: shimmer 2s linear infinite; }
.status-dot { width: 6px; height: 6px; background: var(--primary-color); border-radius: 50%; display: inline-block; animation: dot-bounce 1s infinite alternate; box-shadow: 0 0 10px var(--primary-light); }

@keyframes shimmer {
    to { background-position: 200% center; }
}

@keyframes ai-pulse {
    0% { transform: translateY(-50%) scale(0.95); box-shadow: 0 0 0 0 rgba(26, 115, 232, 0.4); }
    70% { transform: translateY(-50%) scale(1.1); box-shadow: 0 0 0 15px rgba(26, 115, 232, 0); }
    100% { transform: translateY(-50%) scale(0.95); box-shadow: 0 0 0 0 rgba(26, 115, 232, 0); }
}
@keyframes text-fade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}
@keyframes dot-bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

/* AI Promo & Loading Overlay - Premium Style */
.ai-chat-promo { background: #fff; border: 1px solid var(--border-color); padding: 35px; border-radius: 24px; display: flex; align-items: center; justify-content: space-between; margin-top: 50px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); border: 1px solid rgba(26, 115, 232, 0.1); position: relative; overflow: hidden; }
.ai-chat-promo::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--primary-color); }
.ai-chat-promo-info { font-size: 15px; color: var(--text-main); display: flex; align-items: center; gap: 25px; }
.ai-chat-icon-box { background: var(--primary-light); width: 64px; height: 64px; border-radius: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: 0.3s; }
.ai-chat-promo:hover .ai-chat-icon-box { transform: scale(1.1) rotate(10deg); background: var(--primary-color); }
.ai-chat-promo:hover .ai-chat-icon-box i { color: #fff; }
.ai-chat-icon-box i { color: var(--primary-color); font-size: 28px; }
.ai-chat-promo-text strong { display: block; margin-bottom: 6px; font-size: 18px; color: var(--text-main); font-weight: 700; }
.ai-chat-promo-text span { color: var(--text-muted); font-size: 14.5px; line-height: 1.5; }

.btn-chat-ai { background: var(--primary-color); color: #fff !important; padding: 16px 35px; border-radius: 14px; font-weight: 700; text-decoration: none !important; transition: 0.3s; display: flex; align-items: center; gap: 12px; font-size: 15px; box-shadow: 0 4px 15px rgba(26, 115, 232, 0.25); }
.btn-chat-ai:hover { background: var(--primary-dark); transform: translateY(-3px); box-shadow: 0 8px 20px rgba(26, 115, 232, 0.35); }

#loadingOverlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(255,255,255,0.98); z-index:9999; flex-direction:column; align-items:center; justify-content:center; text-align: center; backdrop-filter: blur(5px); }
.spinner-ai { width: 70px; height: 70px; border: 5px solid #f3f3f3; border-top: 5px solid var(--primary-color); border-radius: 50%; animation: spin-ai 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite; margin-bottom: 30px; }
#loadingOverlay h3 { color: var(--primary-color); font-weight: 800; font-size: 26px; margin-bottom: 12px; letter-spacing: -0.02em; }
#loadingOverlay p { color: var(--text-muted); font-size: 16px; line-height: 1.6; }
@keyframes spin-ai { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* MOBILE RESPONSIVE OPTIMIZATION */
@media (max-width: 768px) {
    /* Global & Search Page */
    .vb-search-page { padding: 30px 0; }
    .search-wrap { padding: 25px; border-radius: 15px; }
    .search-box-custom { flex-direction: column; gap: 12px; }
    .input-wrapper-search { width: 100%; }
    .search-box-custom button { width: 100%; padding: 15px; justify-content: center; }

    /* Document List */
    .vb-item { padding: 18px; border-radius: 12px; }
    .vb-item-header { flex-direction: column; gap: 10px; align-items: flex-start; }
    .vb-item-title { font-size: 16px; margin-bottom: 0; }
    .rel-badge { padding: 4px 10px; font-size: 12px; }
    
    .vb-item-meta { gap: 10px; font-size: 12px; }
    .vb-snippet-box { padding: 12px; font-size: 13.5px; }

    /* Detail View */
    .vb-card { padding: 20px; border-radius: 12px; }
    .vb-title { font-size: 20px; padding-left: 15px; margin-bottom: 25px; }
    .table-vb-info td { display: block; width: 100% !important; padding: 10px 15px; border-bottom: none; }
    .table-vb-info td.lbl { background: #f8f9fa; border-top: 1px solid var(--border-color); border-bottom: none; }
    .table-vb-info td.val { border-bottom: 1px solid var(--border-color); padding-bottom: 15px; }
    .table-vb-info tr:last-child td.val { border-bottom: none; }
    
    .vb-actions { flex-direction: column; padding-top: 25px; margin-top: 25px; }
    .btn-vb { width: 100%; justify-content: center; padding: 12px; }

    /* Chat AI Interface */
    .chat-wrapper { margin: 0; height: 100vh; height: -webkit-fill-available; min-height: 0; border-radius: 0; }
    .chat-container { border-radius: 0; border: none; }
    .chat-header { padding: 15px 20px; }
    .chat-header .title-text { font-size: 16px; }
    .chat-box { padding: 20px 15px; gap: 15px; }
    .message { max-width: 90%; font-size: 14px; padding: 12px 15px; }
    .chat-input-area { padding: 15px; padding-bottom: 30px; gap: 10px; }
    .send-btn { width: 44px; height: 44px; border-radius: 10px; }
    .input-wrapper input { padding: 10px 12px; font-size: 14px; }
    .typing-indicator { padding: 12px 20px; }
    .ai-pulse-ring { left: 20px; }

    /* AI Promo Box */
    .ai-chat-promo { flex-direction: column; text-align: center; gap: 20px; padding: 25px; }
    .ai-chat-promo-info { flex-direction: column; gap: 15px; }
    .btn-chat-ai { width: 100%; justify-content: center; }

    /* Header & Navbar */
    #header{
        gap: 10px;
    }
    #header h1 { font-size: 14px; }
    #header p { font-size: 13px; }

    #header .logo img{
        max-height: 70px;
    }
}

@media (max-width: 480px) {
    .vb-item-meta span { width: 100%; border-bottom: 1px dashed #eee; padding-bottom: 5px; }
    .vb-item-meta span:last-child { border-bottom: none; }
}
