/**
 * Knowledge Base Widget Styles (Improved)
 * 
 * @package Instant_Knowledge_Base
 * @since 1.0.5
 */

 .ikbase-widget-container {
    width: 100%;
    background: #ffffff;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.ikbase-widget-inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.ikbase-widget-header { margin-bottom: 8px; }
.ikbase-widget-title { font-size: 24px; font-weight: 700; color: #111827; margin: 0 0 8px; }
.ikbase-widget-subtitle { color: #6b7280; font-size: 15px; margin: 0 0 20px; line-height: 1.5; }

/* Layout: align help card with bottom of left column */
.ikbase-widget-layout { 
    display: flex; 
    gap: 30px; 
    align-items: flex-end; 
}

/* Main Content */
.ikbase-widget-main { flex: 1; }

/* Search */
.ikbase-widget-search { margin-bottom: 25px; position: relative; }
.ikbase-widget-search-form { display: flex; gap: 10px; width: 100%; }
.ikbase-widget-search-input { 
    flex: 1; 
    padding: 12px 14px; 
    border: 1px solid #e5e7eb; 
    border-radius: 8px; 
    font-size: 14px; 
    color: #111827; 
    background: #fff; 
    outline: none; 
    transition: all 0.2s ease; 
    min-width: 0; 
    height: 44px; 
}
.ikbase-widget-search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ikbase-widget-search-input::placeholder { color: #9ca3af; }

.ikbase-widget-search-button { 
    padding: 12px 20px; 
    background: #2563eb; 
    color: #fff; 
    border: none; 
    border-radius: 8px; 
    font-size: 14px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: background 0.2s; 
    white-space: nowrap; 
    min-width: 90px; 
    height: 44px; 
}
.ikbase-widget-search-button:hover { background: #1e40af; }

/* Search Results Dropdown */
.ikbase-widget-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}
.ikbase-widget-search-result {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.ikbase-widget-search-result:hover { background: #f9fafb; }
.ikbase-widget-search-result:last-child { border-bottom: none; }
.ikbase-widget-search-result-title { font-weight: 600; color: #1a1a1a; margin: 0 0 4px; font-size: 0.875rem; }
.ikbase-widget-search-result-excerpt { color: #6b7280; margin: 0; font-size: 0.75rem; line-height: 1.4; }

/* Categories */
.ikbase-widget-categories-grid { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 12px; 
    max-width: 100%;
}

/* For 4+ cards, use 2x2 grid */
.ikbase-widget-categories-grid:has(.ikbase-widget-category-card:nth-child(3)) {
    grid-template-columns: repeat(2, 1fr);
}
.ikbase-widget-category-card { 
    background: #fff; 
    border: 1px solid #e5e7eb; 
    border-radius: 8px; 
    padding: 14px 16px; 
    transition: all 0.2s ease; 
    cursor: pointer; 
    text-align: left; 
}
.ikbase-widget-category-card:hover { 
    border-color: #2563eb; 
    color: #2563eb; 
    background: #f9fafb; 
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
}
.ikbase-widget-category-link { text-decoration: none; color: inherit; display: block; }
.ikbase-widget-category-title { font-size: 14px; font-weight: 500; color: #111827; margin: 0; line-height: 1.4; }
.ikbase-widget-category-description { color: #6b7280; margin: 0; font-size: 0.875rem; line-height: 1.5; }
.ikbase-widget-no-categories { text-align: center; padding: 40px 20px; color: #6b7280; }

/* Help Card */
.ikbase-widget-sidebar { 
    background: #f9fafb; 
    border-radius: 12px; 
    padding: 24px; 
    border: 1px solid #e5e7eb; 
    width: 280px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); 
}
.ikbase-widget-help-section { text-align: left; }
.ikbase-widget-help-title { font-size: 15px; font-weight: 600; color: #111827; margin: 0 0 6px; }
.ikbase-widget-help-description { color: #4b5563; margin: 0 0 16px; line-height: 1.5; font-size: 14px; }
.ikbase-widget-help-button { 
    display: inline-block; 
    padding: 10px 20px; 
    background: #2563eb; 
    color: #fff; 
    text-decoration: none; 
    border-radius: 8px; 
    font-weight: 600; 
    font-size: 14px; 
    transition: background 0.2s; 
}
.ikbase-widget-help-button:hover { background: #1e40af; }

/* Responsive */
@media (max-width: 768px) {
    .ikbase-widget-layout { flex-direction: column; gap: 20px; align-items: stretch; }
    .ikbase-widget-categories-grid { grid-template-columns: 1fr; gap: 16px; }
    .ikbase-widget-search-form { flex-direction: column; }
    .ikbase-widget-search-input { border-radius: 8px; margin-bottom: 8px; }
    .ikbase-widget-search-button { border-radius: 8px; width: 100%; }
    .ikbase-widget-sidebar { width: 100%; }
}

/* Loading State */
.ikbase-widget-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}
.ikbase-widget-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f4f6;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: ikbase-widget-spin 1s linear infinite;
}
@keyframes ikbase-widget-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error and no results states */
.ikbase-widget-search-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 8px;
}

.ikbase-widget-search-no-results {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

