/* KCSE Manager Pro - Frontend Styles */

:root {
    --kcse-primary: #0073aa;
    --kcse-secondary: #005a87;
    --kcse-light: #f8f9fa;
    --kcse-border: #ddd;
    --kcse-success: #28a745;
    --kcse-danger: #dc3545;
    --kcse-warning: #ffc107;
    --kcse-difficulty-easy: #28a745;
    --kcse-difficulty-medium: #ffc107;
    --kcse-difficulty-hard: #dc3545;
}

/* Search Container */
.kcse-search-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.kcse-search-box {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 15px;
}

.kcse-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--kcse-border);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.kcse-search-input:focus {
    outline: none;
    border-color: var(--kcse-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.kcse-search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.kcse-filter-select {
    padding: 10px;
    border: 1px solid var(--kcse-border);
    border-radius: 4px;
    font-size: 14px;
}

/* Search Results */
.kcse-search-results {
    background: var(--kcse-light);
    border-radius: 6px;
    overflow: hidden;
}

.kcse-search-count {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--kcse-border);
    font-size: 14px;
    font-weight: 500;
}

.kcse-results-list {
    display: grid;
    gap: 12px;
    padding: 12px;
}

.kcse-result-item {
    background: white;
    padding: 16px;
    border-radius: 6px;
    border-left: 4px solid var(--kcse-primary);
    transition: all 0.3s ease;
}

.kcse-result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.kcse-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.kcse-result-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kcse-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--kcse-light);
    color: #333;
}

.kcse-badge.year {
    background: var(--kcse-primary);
    color: white;
}

.kcse-badge.subject {
    background: var(--kcse-secondary);
    color: white;
}

.kcse-badge.difficulty {
    background: var(--kcse-difficulty-medium);
    color: white;
}

.kcse-badge.premium {
    background: var(--kcse-danger);
    color: white;
}

.kcse-result-badges {
    display: flex;
    gap: 6px;
}

.kcse-result-title {
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0;
    color: #333;
}

.kcse-result-excerpt {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 10px;
}

.kcse-result-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.kcse-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.kcse-btn-preview {
    background: var(--kcse-primary);
    color: white;
}

.kcse-btn-preview:hover {
    background: var(--kcse-secondary);
}

.kcse-btn-view {
    background: var(--kcse-light);
    color: var(--kcse-primary);
    border: 1px solid var(--kcse-primary);
}

.kcse-btn-view:hover {
    background: var(--kcse-primary);
    color: white;
}

/* Modal */
.kcse-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.5);
}

.kcse-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.kcse-modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 700px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.kcse-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    padding: 0;
}

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

/* Difficulty Indicator */
.kcse-difficulty-easy { color: var(--kcse-difficulty-easy); }
.kcse-difficulty-medium { color: var(--kcse-difficulty-medium); }
.kcse-difficulty-hard { color: var(--kcse-difficulty-hard); }

/* Loading State */
.kcse-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--kcse-primary);
}

.kcse-spinner {
    border: 3px solid var(--kcse-light);
    border-top: 3px solid var(--kcse-primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.kcse-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.kcse-no-results svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.3;
}

/* Responsive */
@media (max-width: 768px) {
    .kcse-search-filters {
        grid-template-columns: 1fr;
    }
    
    .kcse-result-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .kcse-result-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .kcse-btn {
        width: 100%;
        justify-content: center;
    }
    
    .kcse-modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Question Page */
.kcse-question-header {
    background: var(--kcse-light);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.kcse-question-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.kcse-question-meta-item {
    display: flex;
    flex-direction: column;
}

.kcse-question-meta-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    font-weight: 600;
}

.kcse-question-meta-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-top: 4px;
}

/* Table */
.kcse-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.kcse-table th,
.kcse-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--kcse-border);
}

.kcse-table th {
    background: var(--kcse-light);
    font-weight: 600;
}

.kcse-table tbody tr:hover {
    background: var(--kcse-light);
}
