/*
Theme Name: My Knowledge Base Theme
Theme URI: https://yourwebsite.com/
Author: Your Name
Author URI: https://yourwebsite.com/
Description: A powerful and stable knowledge base theme. Features advanced Schema, AJAX search, and a clean, professional design.
Version: 15.2 (Widget Styles Update)
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mykbtheme
*/

/* --- General & Layout --- */
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.7; color: #3c434a; background-color: #f8f9fa; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
a { color: #007bff; text-decoration: none; }
a:hover { color: #0056b3; }

/* --- Accessibility: Skip Link (FIXED) --- */
.skip-link { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; word-wrap: normal !important; }
.skip-link:focus { background-color: #f1f1f1; border-radius: 3px; box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6); clip: auto !important; clip-path: none; color: #21759b; display: block; font-size: 14px; font-weight: bold; height: auto; left: 5px; line-height: normal; padding: 15px 23px 14px; text-decoration: none; top: 5px; width: auto; z-index: 100000; }

/* --- Header & Navigation --- */
.site-header { background: #fff; border-bottom: 1px solid #e9ecef; padding: 15px 0; position: sticky; top: 0; z-index: 999; }
.site-header > .container { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.site-branding { flex-shrink: 0; }
.site-branding img.custom-logo { max-height: 50px; width: auto; }
.desktop-navigation { display: none; }
.desktop-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; }
.desktop-navigation ul li a { display: block; padding: 5px 10px; text-decoration: none; font-weight: 500; color: #333; }
.mobile-menu-toggle { display: none; background: none; border: none; padding: 5px; cursor: pointer; }
.mobile-menu-toggle .icon-bar { display: block; width: 22px; height: 2px; background-color: #333; margin: 4px 0; border-radius: 1px; transition: all 0.3s; }
.mobile-menu-panel { position: fixed; top: 0; left: -320px; width: 280px; height: 100%; background: #fff; box-shadow: -5px 0 15px rgba(0,0,0,0.1); z-index: 1001; transition: right 0.3s ease-in-out; padding: 20px; display: flex; flex-direction: column; }
.mobile-menu-panel.is-open { left: 0; }
.mobile-menu-panel .close-btn { font-size: 30px; line-height: 1; border: none; background: none; position: absolute; top: 10px; right: 15px; cursor: pointer; color: #aaa; }
.mobile-menu-panel .mobile-navigation { margin-top: 50px; }
.mobile-menu-panel ul { list-style: none; padding: 0; margin: 0; }
.mobile-menu-panel ul li a { display: block; padding: 12px 0; font-weight: 500; color: #333; border-bottom: 1px solid #f1f1f1; }
.site-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.site-overlay.is-visible { opacity: 1; visibility: visible; }

/* --- KB Search Box (Unified Style) --- */
.kb-header { background: linear-gradient(135deg, #4e73df 0%, #1cc88a 100%); padding: 20px 20px; text-align: center; color: white; }
.kb-header.with-radius { border-radius: 12px; margin: 5px 0; }
.kb-header.no-radius { margin-bottom: 30px; }
.kb-header h1, .kb-header h2 { margin-top: 0; font-size: 2.8em; font-weight: 700; }
.kb-header p { font-size: 1.1em; opacity: 0.9; }
.kb-search-container { position: relative; max-width: 700px; margin: 0 auto; }
.kb-header .kb-search-container { margin-top: 5px; }
.kb-search-form { position: relative; }
.kb-search-form .search-icon { position: absolute; left: 25px; top: 50%; transform: translateY(-50%); color: #aaa; font-size: 1.2em; pointer-events: none; }
.kb-search-form input[type="search"] { width: 100%; padding: 18px 20px 18px 60px; font-size: 1.1em; border-radius: 50px; border: none; box-shadow: 0 10px 30px rgba(0,0,0,0.15); -webkit-appearance: none; }
.kb-search-form input[type="search"]:focus { outline: none; box-shadow: 0 10px 30px rgba(0,0,0,0.2), 0 0 0 4px rgba(78, 115, 223, 0.25); }
.kb-search-spinner { position: absolute; right: 25px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; display: none; }
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }
.kb-ajax-search-results-container { position: absolute; top: 100%; left: 0; right: 0; background: #fff; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); margin-top: 10px; z-index: 1000; max-height: 400px; overflow-y: auto; text-align: left; }
.kb-ajax-search-results-container ul { list-style: none; padding: 10px 0; margin: 0; }
.kb-ajax-search-results-container ul li a.result-item { display: flex; align-items: center; padding: 10px 15px; text-decoration: none; }
.kb-ajax-search-results-container ul li a.result-item:hover { background-color: #f5f5f5; }
.result-thumb { width: 40px; height: 40px; border-radius: 4px; margin-right: 15px; object-fit: cover; flex-shrink: 0; background-color: #e9ecef; }
.result-title { font-weight: 500; color: #333; line-height: 1.4; }

/* --- Content Layout --- */
.site-content { display: flex; flex-wrap: wrap; gap: 30px; margin-top: 30px; margin-bottom: 30px; }
.main-content { flex: 1; min-width: 0; overflow-wrap: break-word; word-wrap: break-word; }
.kb-sidebar { width: 100%; }

/* --- Homepage Content --- */
.kb-category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 25px; }
.kb-category-box { background-color: #fff; padding: 25px; border-radius: 8px; border: 1px solid #e9ecef; }
.kb-category-box h3 { margin-top: 0; font-size: 1.5em; color: #333; margin-bottom: 15px; }
.kb-category-box ul { list-style: none; padding: 0; margin: 0; }
.kb-category-box ul li { padding: 8px 0; border-bottom: 1px solid #f1f1f1; display: flex; align-items: baseline; gap: 10px; }
.kb-category-box ul li:last-child { border-bottom: none; }
.kb-category-box ul li .item-number { font-weight: 600; color: #007bff; font-size: 0.9em; }

/* --- Single Post & Page --- */
.kb-article, .page-content-container { background: #fff; padding: 30px; border-radius: 8px; border: 1px solid #e9ecef; }
.kb-breadcrumbs { margin-bottom: 20px; font-size: 0.9em; color: #6c757d; }
.entry-header h1.entry-title { font-size: 2.2em; margin-bottom: 8px; }
.entry-meta { font-size: 0.9em; color: #6c757d; margin-bottom: 25px; display: flex; flex-wrap: wrap; gap: 5px 10px; }
.entry-meta span { display: inline-flex; align-items: center; gap: 5px; }
.entry-meta .helpful-count svg { width: 14px; height: 14px; fill: #28a745; }
.entry-content { font-size: 1.05em; }
.entry-content img, .entry-content video, .entry-content iframe { max-width: 100%; height: auto !important; border-radius: 8px; }
.kb-feedback { margin-top: 40px; padding-top: 25px; border-top: 1px solid #e9ecef; text-align: center; }
.kb-feedback-btn.voted-yes { background-color: #28a745; color: white; border-color: #28a745; }
.kb-feedback-btn.voted-no { background-color: #dc3545; color: white; border-color: #dc3545; }

/* --- Table Styles --- */
.entry-content table { width: 100%; border-collapse: collapse; margin-bottom: 25px; border: 1px solid #e9ecef; }
.entry-content th, .entry-content td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #e9ecef; }
.entry-content th { background-color: #f8f9fa; font-weight: 600; }
.entry-content tr:nth-of-type(even) { background-color: #f8f9fa; }
.entry-content tr:hover { background-color: #f1f5f9; }

/* --- Category & Archive Pages --- */
.archive-main-content { background: #fff; padding: 30px; border-radius: 8px; border: 1px solid #e9ecef; }
.kb-archive-entry { padding: 20px 0; border-bottom: 1px solid #e9ecef; }
.kb-archive-entry.with-thumbnail { display: flex; gap: 25px; align-items: center; }
.kb-archive-entry .post-thumbnail { flex-shrink: 0; width: 150px; }
.kb-archive-entry .post-thumbnail img { width: 100%; border-radius: 8px; }
.kb-archive-entry .entry-wrapper { flex: 1; }
.kb-archive-entry .entry-title { margin-top: 0; font-size: 1.4em; }

/* --- Widgets --- */
.widget { background: #fff; padding: 25px; border-radius: 8px; border: 1px solid #e9ecef; margin-bottom: 25px; }
.widget-title { font-size: 1.3em; margin-top: 0; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid #e9ecef; }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget ul li { padding: 8px 0; }
.widget-post-item { display: flex; align-items: center; gap: 15px; text-decoration: none; }
.widget-post-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.widget-post-title { font-weight: 500; color: #333; line-height: 1.4; }
.widget-post-item:hover .widget-post-title { color: #007bff; }

/* --- Tag Cloud Widget (NEW) --- */
.widget_tag_cloud .tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.widget_tag_cloud .tagcloud a { background-color: #e9ecef; color: #495057; padding: 5px 12px; border-radius: 20px; text-decoration: none; transition: all 0.2s ease; }
.widget_tag_cloud .tagcloud a:hover { background-color: #007bff; color: #fff; }

/* --- Comments --- */
.comments-area { margin-top: 40px; padding-top: 30px; border-top: 1px solid #e9ecef; }
.comments-title, .comment-reply-title { font-size: 1.6em; margin-bottom: 20px; }
.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-list .comment { padding: 20px 0; border-bottom: 1px solid #e9ecef; }
.comment-list .children { list-style: none; padding-left: 40px; }
.comment-author .avatar { float: left; margin-right: 15px; border-radius: 50%; }
.comment-author .fn { font-weight: bold; font-style: normal; }
.comment-meta { font-size: 0.9em; color: #6c757d; }
.comment-content { clear: both; padding-top: 10px; }
.comment-reply-link { font-size: 0.9em; font-weight: bold; }
.comment-form p { margin-bottom: 15px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
.comment-form .form-submit input { background-color: #007bff; color: #fff; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; }
.comment-form .form-submit input:hover { background-color: #0056b3; }

/* --- Footer --- */
.footer-widgets-area { background-color: #343a40; color: #adb5bd; padding: 50px 0; }
.footer-widgets-area .container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; }
.footer-widgets-area .widget-title { color: #fff; }
.footer-widgets-area a { color: #fff; }
.footer-widgets-area a:hover { color: #dee2e6; }
.site-info { background-color: #212529; color: #6c757d; padding: 20px 0; text-align: center; font-size: 0.9em; }
.site-info a { color: #adb5bd; }

/* --- Responsive --- */
@media (min-width: 992px) { .desktop-navigation { display: block; } .kb-sidebar { width: 300px; } }
@media (max-width: 991px) { .site-content { flex-direction: column; } .kb-sidebar { width: 100%; margin-top: 0; } .mobile-menu-toggle { display: block; } .desktop-navigation { display: none; } .kb-category-grid { grid-template-columns: 1fr; } 
}
@media (max-width: 768px) {
    .kb-header h1, .kb-header h2 { font-size: 2.2em; }
    .main-content, .archive-main-content, .page-content-container {max-width: 96%; padding: 5px; }
    .entry-header h1.entry-title { font-size: 1.8em; }
    .kb-archive-entry.with-thumbnail { flex-direction: column; }
    .kb-archive-entry .post-thumbnail { width: 100%; margin-bottom: 15px; }
    .kb-archive-entry .entry-wrapper { padding-left: 0; }
    .entry-content img, .entry-content video, .entry-content iframe { max-width: 280px; height: auto !important; border-radius: 8px; }
    .entry-content table { border: 0; }
    .entry-content table thead { border: none; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
    .entry-content table tr { border-bottom: 3px solid #ddd; display: block; margin-bottom: .625em; }
    .entry-content table td { border-bottom: 1px solid #ddd; display: block; font-size: .8em; text-align: right; }
    .entry-content table td::before { content: attr(data-label); float: left; font-weight: bold; text-transform: uppercase; }
    .entry-content table td:last-child { border-bottom: 0; }
    .widget-post-item { gap: 12px; }
    .widget-post-thumb { width: 50px; height: 50px; }
    .widget-post-title { font-size: 0.95em; }
}
