/**
 * Gars Knowledge Base Frontend Styles
 */

/* Main wrapper */
.gkb-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Make form containers match the wrapper width instead of being constrained */
.gkb-wrapper .gkb-form-container {
    max-width: none !important;
    width: 100% !important;
}

/* Search bar */
.gkb-search-bar {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.gkb-search-form {
    max-width: 600px;
    margin: 0 auto;
}

.gkb-search-input-group {
    display: flex;
    gap: 10px;
}

.gkb-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.gkb-search-input:focus {
    outline: none;
    border-color: var(--gkb-primary, #0073aa);
}

.gkb-search-btn {
    padding: 12px 24px;
    background: var(--gkb-primary, #0073aa);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.gkb-search-btn:hover {
    background: var(--gkb-primary-dark, #005a87);
}

/* Breadcrumbs */
.gkb-breadcrumbs {
    margin-bottom: 20px;
    padding: 10px 0;
    font-size: 14px;
    color: #6c757d;
    border-bottom: 1px solid #e9ecef;
}

.gkb-breadcrumbs a {
    color: var(--gkb-primary, #0073aa);
    text-decoration: none;
}

.gkb-breadcrumbs a:hover {
    text-decoration: underline;
}

/* Sections */
.gkb-section {
    margin-bottom: 40px;
}

.gkb-section-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gkb-primary, #0073aa);
}

.gkb-section-header h2 {
    margin: 0;
    color: var(--gkb-primary, #0073aa);
    font-size: 24px;
}

/* Cards grid */
.gkb-cards-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.gkb-columns-1 { grid-template-columns: 1fr; }
.gkb-columns-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.gkb-columns-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.gkb-columns-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

@media (max-width: 768px) {
    .gkb-cards-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.gkb-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid #e9ecef;
}

.gkb-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.gkb-card-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.gkb-card:hover .gkb-card-actions {
    opacity: 1;
}

.gkb-card-edit {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 12px;
}

.gkb-card-icon {
    font-size: 32px;
    text-align: center;
    margin-bottom: 15px;
}

.gkb-card-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.gkb-card-description {
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
}

.gkb-card-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    font-size: 12px;
    color: #6c757d;
}

.gkb-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gkb-card-footer {
    text-align: right;
}

/* Buttons */
.gkb-btn {
    display: inline-block !important;
    padding: 8px 16px !important;
    border: none !important;
    border-radius: 6px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    text-align: center !important;
}

.gkb-btn-primary {
    background: var(--gkb-primary, #0073aa) !important;
    color: white !important;
}

.gkb-btn-primary:hover {
    background: var(--gkb-primary-dark, #005a87) !important;
    color: white !important;
}

.gkb-btn-secondary {
    background: #6c757d !important;
    color: white !important;
}

.gkb-btn-secondary:hover {
    background: #5a6268 !important;
    color: white !important;
}

.gkb-add-category,
.gkb-add-article {
    margin-left: 10px;
}

/* Category view */
.gkb-category-header {
    background: linear-gradient(135deg, var(--gkb-primary, #0073aa), var(--gkb-primary-dark, #005a87));
    color: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.gkb-category-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.gkb-category-description {
    margin-bottom: 20px;
    opacity: 0.9;
}

.gkb-category-actions {
    display: flex;
    gap: 10px;
}

/* Article view */
.gkb-article {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.gkb-article-header h1 {
    margin: 0 0 20px 0;
    font-size: 32px;
    color: #212529;
}

.gkb-article-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #6c757d;
}

.gkb-article-actions {
    margin-bottom: 30px;
}

.gkb-article-content {
    line-height: 1.8;
    font-size: 16px;
    color: #212529;
}

.gkb-article-content h1,
.gkb-article-content h2,
.gkb-article-content h3,
.gkb-article-content h4,
.gkb-article-content h5,
.gkb-article-content h6 {
    color: var(--gkb-primary, #0073aa);
    margin-top: 30px;
    margin-bottom: 15px;
}

.gkb-article-content p {
    margin-bottom: 16px;
}

.gkb-article-content ul,
.gkb-article-content ol {
    padding-left: 30px;
    margin-bottom: 16px;
}

.gkb-article-content li {
    margin-bottom: 8px;
}

.gkb-article-content blockquote {
    border-left: 4px solid var(--gkb-primary, #0073aa);
    padding-left: 20px;
    margin: 20px 0;
    font-style: italic;
    color: #6c757d;
}

.gkb-article-content code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 14px;
}

.gkb-article-content pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 20px 0;
}

/* Rating system */
.gkb-rating-system {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 30px;
}

.gkb-rating-question {
    margin-bottom: 15px;
    font-weight: 500;
    color: #212529;
}

.gkb-rating-stars {
    font-size: 24px;
    margin-bottom: 10px;
}

.gkb-star {
    cursor: pointer;
    margin: 0 2px;
    transition: transform 0.2s;
    filter: grayscale(100%);
}

.gkb-star:hover,
.gkb-star.filled {
    filter: none;
    transform: scale(1.1);
}

.gkb-star:hover {
    animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.1); }
}

.gkb-rating-info {
    font-size: 14px;
    color: #6c757d;
}

/* Search results */
.gkb-search-results {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.gkb-search-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.gkb-search-header h2 {
    margin: 0 0 10px 0;
    color: var(--gkb-primary, #0073aa);
}

.gkb-search-result {
    padding: 20px 0;
    border-bottom: 1px solid #e9ecef;
}

.gkb-search-result:last-child {
    border-bottom: none;
}

.gkb-search-result h3 {
    margin: 0 0 10px 0;
}

.gkb-search-result h3 a {
    color: var(--gkb-primary, #0073aa);
    text-decoration: none;
}

.gkb-search-result h3 a:hover {
    text-decoration: underline;
}

.gkb-search-excerpt {
    color: #6c757d;
    margin-bottom: 10px;
    line-height: 1.5;
}

.gkb-search-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #6c757d;
}

/* Empty states */
.gkb-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.gkb-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

/* Modal (for future inline editing) */
.gkb-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.gkb-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.gkb-modal-close {
    color: #999;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.gkb-modal-close:hover {
    color: #333;
}

/* Forms */
.gkb-form,
.gkb-form-container {
    max-width: 600px !important;
    background: white !important;
    padding: 30px !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
    margin: 20px auto !important;
}

/* Remove the old rule as it's now handled by the main wrapper rule above */

.gkb-form-container h2 {
    margin: -30px -30px 30px -30px !important;
    padding: 20px 30px !important;
    background: var(--gkb-primary, #0073aa) !important;
    color: white !important;
    border-radius: 8px 8px 0 0 !important;
    font-size: 1.4em !important;
    font-weight: 600 !important;
}

.gkb-form-group {
    margin-bottom: 20px !important;
}

.gkb-form-group label {
    display: block !important;
    margin-bottom: 5px !important;
    font-weight: 500 !important;
    color: #212529 !important;
}

.gkb-form-group input[type="text"],
.gkb-form-group textarea,
.gkb-form-group select {
    width: 100% !important;
    padding: 12px 16px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 6px !important;
    font-size: 16px !important;
    transition: border-color 0.3s !important;
    box-sizing: border-box !important;
}

.gkb-form-group input[type="file"] {
    width: 100% !important;
    padding: 12px !important;
    border: 2px solid #e9ecef !important;
    border-radius: 6px !important;
    background: white !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
}

.gkb-field-note {
    font-size: 12px !important;
    color: #666 !important;
    margin-top: 5px !important;
    margin-bottom: 0 !important;
}

.gkb-form-group input[type="text"]:focus,
.gkb-form-group textarea:focus,
.gkb-form-group select:focus {
    outline: none;
    border-color: var(--gkb-primary, #0073aa);
}

.gkb-form-actions {
    display: flex !important;
    gap: 10px !important;
    margin-top: 30px !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .gkb-wrapper {
        padding: 15px;
    }
    
    .gkb-search-input-group {
        flex-direction: column;
    }
    
    /* Article forms on tablets/phones should use more screen space */
    .gkb-form-container.gkb-article-form {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px !important;
        margin: 10px auto !important;
    }
}

@media (max-width: 480px) {
    /* On phones, use almost full width and reduce padding further */
    .gkb-form-container.gkb-article-form {
        width: 98% !important;
        max-width: 98% !important;
        padding: 15px !important;
        margin: 5px auto !important;
    }
    
    .gkb-form-container.gkb-article-form h2 {
        padding: 15px 15px !important;
        margin: -15px -15px 20px -15px !important;
        font-size: 1.2em !important;
    }
}
    
    .gkb-article {
        padding: 20px;
    }
    
    .gkb-article-header h1 {
        font-size: 24px;
    }
    
    .gkb-article-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .gkb-category-header {
        padding: 20px;
    }
    
    .gkb-category-header h1 {
        font-size: 22px;
    }
    
    .gkb-category-actions {
        flex-direction: column;
    }
    
    .gkb-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}