/* File: public/css/style.css (PHIÊN BẢN ỔN ĐỊNH HOÀN TOÀN) */

/* Biến CSS cho màu sắc chủ đạo (Blue Theme) */
:root {
    --primary-blue: #1890FF;       
    --primary-blue-dark: #0C457D;    
    --primary-blue-extra-dark: #002766; 
    
    --text-color-dark: #1f2937;    
    --text-color-medium: #4b5563;  
    --text-gray-light: #6b7280;    
    --bg-main: #fcfcfc;            
    --bg-light-gray: #f3f4f6;      
    --border-light-gray: #d1d5db;  
    --bg-white: #ffffff;           
    
    --dark-bg-start: #002766; 
    --dark-bg-end: #0C457D; 
    --dark-text: #ffffff; 
    --dark-highlight: #40a9ff; 
}

/* =============================================================
   RESET VÀ BODY
   =============================================================
*/
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; 
    font-family: "Inter", sans-serif;
}

body {
    background: var(--bg-main); 
    color: var(--text-color-dark); 
    padding-top: 60px; 
    font-family: "Inter", sans-serif;
}

/* Tùy chỉnh thanh cuộn */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border-light-gray); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-gray-light); }

/* =============================================================
   NAVBAR (FIX LỖI HIỂN THỊ MENU)
   =============================================================
*/
.navbar {
    background: linear-gradient(135deg, var(--dark-bg-start) 0%, var(--dark-bg-end) 100%);
    padding: 0 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); 
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px; 
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--dark-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.5rem 0;
}

.nav-menu { 
    display: flex; 
    list-style: none; 
    margin: 0;
    padding: 0; 
}

.nav-item { position: relative; margin-right: 10px; }

.nav-link {
    display: block;
    padding: 1rem 1.2rem;
    color: var(--dark-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--dark-highlight);
    background: rgba(255, 255, 255, 0.1); 
}

.nav-link.active { font-weight: 600; }

/* Dropdown */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--dark-bg-start);
    min-width: 300px; 
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8); 
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    padding: 0.5rem 0;
    border: 1px solid var(--primary-blue-dark); 
    z-index: 100;
}

/* FIX DROPDOWN HOVER */
.nav-item:hover > .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1.25rem;
    color: var(--dark-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    gap: 12px;
}

.dropdown-link i { width: 20px; font-size: 1.2rem; text-align: center; transition: all 0.25s ease; flex-shrink: 0; }
.dropdown-link.seo i { color: #10b981; }
.dropdown-link.comment i { color: #f59e0b; }
.dropdown-link.analytics i { color: #8b5cf6; }

.dropdown-link:hover { background: var(--dark-highlight); color: var(--primary-blue-extra-dark); font-weight: 600; padding-left: 1.5rem; }
.dropdown-link:hover i { color: var(--primary-blue-extra-dark); } 

/* =============================================================
   QUY TẮC CHUNG CHO CÁC PAGE VÀ COMPONENTS
   =============================================================
*/

.focus\:border-primary-light:focus {
    border-color: var(--primary-blue) !important; 
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.4) !important;
}

/* Ẩn/Hiện các trang */
.page { display: none; }
.page.active { display: block; }
#page-hub { display: block; }

/* Logo */
.nav-logo { font-size: 1.1rem; }
img.header-logo { height: 35px; width: 35px; object-fit: contain; background-color: transparent !important; }
img.footer-logo { height: 40px; width: 40px; object-fit: contain; background-color: transparent !important; }

/* Footer Hover */
.footer-col-left a.header-nav-link:hover span { color: var(--primary-blue) !important; }
.footer-col-center a.header-nav-link:hover { color: var(--primary-blue) !important; text-decoration: underline; }

/* Trang chủ (Hub Card) */
.hub-card {
    background-color: var(--bg-white);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05); 
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.hub-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--primary-blue); 
}
.hub-card h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--primary-blue-dark); }
.hub-card p { font-size: 1rem; color: var(--text-color-medium); }

/* Nút quay lại */
.back-button {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-color-dark); 
    background-color: var(--bg-white);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-light-gray); 
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 16px;
}
.back-button:hover { background-color: var(--bg-light-gray); }

/* Popover và Copy Buttons */
.popover { display: none; position: absolute; z-index: 50; width: 320px; max-height: 400px; overflow-y: auto; word-wrap: break-word; }
.result-btn:hover + .popover, .popover:hover { display: block; }
.toggle-desc { color: var(--primary-blue); font-weight: 500; cursor: pointer; margin-left: 4px; } 
.toggle-desc:hover { text-decoration: underline; }
.desc-full { display: none; }
.copy-btn { background-color: var(--bg-light-gray); color: #374151; border: 1px solid var(--border-light-gray); padding: 2px 8px; border-radius: 6px; font-size: 0.875rem; font-weight: 500; transition: all 0.2s; cursor: pointer; flex-shrink: 0; }
.copy-btn:hover { background-color: #e5e7eb; }
.copy-btn:disabled { background-color: #e0f2f1; color: #0f766e; cursor: not-allowed; } 
.popover-copy-btn { background-color: #e0f2f1; color: #0f766e; padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; font-weight: 500; transition: all 0.2s; cursor: pointer; }
.popover-copy-btn:hover { background-color: #cce9e6; } 
.popover-copy-btn:disabled { background-color: #d1fae5; color: #065f46; cursor: not-allowed; }

/* Comment Tool */
.comment-tool-container { width:100%; max-width:900px; background:var(--bg-white); padding:24px; border-radius:14px; box-shadow:0 10px 28px rgba(0,0,0,.06) }
.comment-tool-container h1 { margin:0 0 8px; text-align:center; color:var(--primary-blue-dark); font-weight:800; } 
.comment-tool-note { text-align: center; font-size: 0.875rem; color: var(--text-gray-light); margin-bottom: 18px; }
.comment-row { display:flex; gap:10px; margin-bottom:10px; flex-wrap:wrap }
.comment-row .field { flex:1; min-width:260px }
.comment-input[type="text"] { width:100%; padding:12px 14px; border:1px solid #ddd; border-radius:10px; font-size:15px; outline:none; }
.comment-btn { padding:12px 18px; font-size:15px; background:var(--primary-blue); color:#fff; border:none; border-radius:10px; cursor:pointer; transition:.2s; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.comment-btn:hover { background:var(--primary-blue-dark); } 
.comment-btn:disabled { background:#cfcfcf; cursor:not-allowed }
.sort-bar { display:none; gap:10px; align-items:center; flex-wrap:wrap; margin:12px 0 6px; }
.sort-title { font-weight:700; color:#444; flex-shrink: 0; }
.sort-btn { border:1px solid #e5e7eb; background:var(--bg-white); color:#333; padding:8px 12px; border-radius:10px; cursor:pointer; font-size:14px; flex-shrink: 0; }
.sort-btn.active { border-color:var(--primary-blue); color:var(--primary-blue); font-weight:800 } 
.time-filter-select { border:1px solid #e5e7eb; background:var(--bg-white); color:#333; padding: 8px 12px; border-radius:10px; font-size:14px; margin-right: 10px; }
.sort-hint { margin-left:auto; color:#888; font-size:12px; flex-shrink: 0; }
#comment-status { text-align:center; font-size:14px; color:#777; margin:8px 0 0 }
#comment-results { margin-top:4px }
.comment-thread { border-bottom:1px solid #e9e9ef; padding:16px 0 }
.comment-thread:last-child { border-bottom:none }
.thread-row { display:grid; grid-template-columns: 1fr 300px; gap:16px; align-items:start }
.left-col { border:1px solid #e9e9ef; border-radius:12px; background:#fafafa; padding:12px }
.left-col h3 { margin:0 0 10px; font-size:14px; color:#555; font-weight:800 }
.comment { display:flex; align-items:flex-start; gap:12px }
.comment + .comment { margin-top:10px }
.comment-author-img { width:40px; height:40px; border-radius:50%; background-color: #eee; }
.comment-content { flex:1 }
.comment-author { font-weight:800; margin-bottom:5px }
.replies-container { margin-left:52px; margin-top:12px; border-left:2px solid #e0e0e0; padding-left:12px }
.reply .comment-author-img { width:30px; height:30px }
.reply { margin-top:8px }
.thread-right { border:1px solid #e9e9ef; border-radius:12px; padding:12px; background:#fafafa }
.metrics-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px }
.metric { text-align:center; padding:10px 8px; border-radius:10px; background:var(--bg-white); border:1px solid #f0f0f0 }
.metric-label { font-size:12px; color:#666; margin-bottom:4px }
.metric-value { font-weight:800; font-size:16px; word-break:normal; line-height: 1.3; }
@media (max-width: 980px){ .thread-row{ grid-template-columns:1fr } .thread-right { margin-top: 16px; } }

/* Analyzer Tool */
.analyzer-container { width:100%; max-width: 100%; background:var(--bg-white); padding:24px; border-radius:14px; box-shadow:0 10px 28px rgba(0,0,0,.06) }
.analyzer-container h1 { margin:0 0 18px; text-align:center; color:var(--primary-blue-dark); font-weight:800; } 
.filter-container-wrapper { overflow-x: auto; scrollbar-width: none; }
.filter-container-wrapper::-webkit-scrollbar { display: none; }
.chart-container { position: relative; width: 100%; height: 300px; margin: auto; }

/* Toasts and Modals */
.copy-success-toast { position: fixed; bottom: 20px; right: 20px; background-color: #10B981; color: white; padding: 12px 20px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 100; opacity: 0; transition: opacity 0.3s ease; }
.save-video-btn { background-color: #e0f2f1; color: #0f766e; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; transition: all 0.2s; margin-left: auto; }
.save-video-btn:hover { background-color: #cce9e6; } 
.save-video-btn:disabled { background-color: #d1fae5; color: #065f46; cursor: not-allowed; opacity: 0.7; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.modal-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.modal-content { background-color: white; padding: 1.5rem; border-radius: 0.5rem; position: relative; z-index: 1001; max-height: 95vh; overflow-y: visible; margin: 1rem; width: 100%; display: flex; flex-direction: column; transform: translateY(20px); transition: transform 0.3s ease-out; }
.modal-overlay:not(.hidden) .modal-content { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 1rem; border-bottom: 1px solid var(--border-light-gray); margin-bottom: 0; }
.modal-header h2 { font-size: 1.25rem; font-weight: 700; }
.modal-close-btn { background: #eee; border-radius: 50%; padding: 4px; cursor: pointer; transition: background 0.2s; }
.modal-close-btn:hover { background: #ddd; }
.modal-body { flex-grow: 1; overflow-y: auto; padding-bottom: 1rem; padding-top: 1rem; }
.modal-list-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-bottom: 1px solid #eee; }
.modal-list-item:last-child { border-bottom: none; }
.modal-list-img { width: 80px; height: 45px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.modal-list-title { flex: 1; font-size: 0.875rem; line-height: 1.3; }
.modal-list-remove-btn { color: #ef4444; font-size: 0.75rem; font-weight: 500; cursor: pointer; text-decoration: underline; flex-shrink: 0; }
.modal-footer { margin-top: 20px; }

/* Loader */
.loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary-blue); border-radius: 50%; width: 20px; height: 20px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Footer Grid */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer-col-left { justify-self: start; text-align: left; }
.footer-col-center { justify-self: center; text-align: left; width: 100%; }
.footer-col-right { justify-self: end; text-align: left; width: 100%; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr; gap: 2rem; } .footer-col-left, .footer-col-center, .footer-col-right { justify-self: start; text-align: left; width: 100%; } }
.footer-social-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; transition: all 0.2s ease-in-out; }
.footer-social-icon:hover { border-color: var(--bg-white); background-color: rgba(255, 255, 255, 0.1); }