/* Frontend Styles for Exam Papers Manager */

:root {
    --epm-primary: #1170b5;
    --epm-primary-light: #a855f7;
    --epm-primary-dark: #020111;
    --epm-secondary: #e5e7eb;
    --epm-accent: #3b82f6;
    --epm-text: #1f2937;
    --epm-text-light: #6b7280;
    --epm-text-muted: #9ca3af;
    --epm-bg: #f9fafb;
    --epm-card-bg: #ffffff;
    --epm-border: #e5e7eb;
    --epm-border-light: #f3f4f6;
    --epm-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --epm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --epm-radius: 8px;
    --epm-radius-lg: 12px;
}

/* Container */
.epm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Page Header */
.epm-page-header {
    text-align: center;
    margin-bottom: 3rem;
}

.epm-page-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--epm-text);
    margin: 0 0 1rem 0;
    background: linear-gradient(135deg, var(--epm-primary), var(--epm-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.epm-page-subtitle {
    font-size: 1.125rem;
    color: var(--epm-text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Content Wrapper */
.epm-content-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sidebar */
.epm-sidebar {
    background: var(--epm-card-bg);
    border-radius: var(--epm-radius-lg);
    box-shadow: var(--epm-shadow);
    padding: 1.5rem;
    position: sticky;
    top: 2rem;
    border: 1px solid var(--epm-border);
}

/* Filter Sections */
.epm-filter-section {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--epm-border-light);
    padding-bottom: 1.5rem;
}

.epm-filter-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.epm-filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 600;
    color: var(--epm-text);
    margin: 0 0 1rem 0;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--epm-radius);
    transition: background-color 0.2s ease;
}

.epm-filter-title:hover {
    background: var(--epm-bg);
}

.epm-filter-title.active {
    color: var(--epm-primary);
    background: rgba(124, 58, 237, 0.05);
}

.epm-filter-icon {
    margin-right: 0.5rem;
}

.epm-toggle {
    font-size: 1.25rem;
    color: var(--epm-text-light);
    transition: transform 0.2s ease;
}

.epm-filter-title.active .epm-toggle {
    transform: rotate(45deg);
}

.epm-filter-content {
    display: none;
    animation: slideDown 0.3s ease;
}

.epm-filter-content.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.epm-filter-subtitle {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--epm-text-light);
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.epm-filter-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Custom Checkboxes */
.epm-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--epm-radius);
    transition: background-color 0.2s ease;
    font-size: 0.875rem;
    color: var(--epm-text);
}

.epm-checkbox-label:hover {
    background: var(--epm-bg);
}

.epm-checkbox-label.checked {
    background: rgba(124, 58, 237, 0.1);
    color: var(--epm-primary);
}

.epm-checkbox {
    display: none;
}

.epm-checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--epm-border);
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s ease;
    background: white;
}

.epm-checkbox:checked + .epm-checkmark {
    background: var(--epm-primary);
    border-color: var(--epm-primary);
}

.epm-checkbox:checked + .epm-checkmark::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Filter Actions */
.epm-filter-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.epm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--epm-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
}

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

.epm-btn-primary:hover {
    background: var(--epm-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--epm-shadow-lg);
}

.epm-btn-secondary {
    background: var(--epm-secondary);
    color: var(--epm-text);
    border: 1px solid var(--epm-border);
}

.epm-btn-secondary:hover {
    background: #d1d5db;
}

/* Main Content */
.epm-main-content {
    min-width: 0;
}

/* Results Header */
.epm-results-header {
    background: var(--epm-card-bg);
    border-radius: var(--epm-radius-lg) var(--epm-radius-lg) 0 0;
    padding: 1.5rem;
    border: 1px solid var(--epm-border);
    border-bottom: none;
}

.epm-results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.epm-results-count {
    font-size: 0.875rem;
    color: var(--epm-text-light);
}

.epm-header-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.epm-pagination-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--epm-text-light);
}

/* Top Pagination */
.epm-pagination-top {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.epm-pagination-top .epm-pagination-btn {
    min-width: 2rem;
    height: 2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--epm-border);
    background: white;
    color: var(--epm-text);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.epm-pagination-top .epm-pagination-btn:hover:not(:disabled) {
    background: var(--epm-primary);
    color: white;
    border-color: var(--epm-primary);
}

.epm-pagination-top .epm-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.epm-pagination-top .epm-pagination-btn.active {
    background: var(--epm-primary);
    color: white;
    border-color: var(--epm-primary);
}

.epm-items-per-page {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--epm-border);
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Results Container */
.epm-results-container {
    background: var(--epm-card-bg);
    border: 1px solid var(--epm-border);
    border-top: none;
    border-bottom: none;
    min-height: 400px;
}

/* Paper Results */
.epm-paper-result {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--epm-border-light);
    transition: background-color 0.2s ease;
}

.epm-paper-result:hover {
    background: var(--epm-bg);
}

.epm-paper-result:last-child {
    border-bottom: none;
}

.epm-paper-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    background: var(--epm-bg);
    border-radius: var(--epm-radius);
}

.epm-file-type-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--epm-primary);
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.epm-pdf-badge {
    background: #dc2626;
}

.epm-document-icon {
    font-size: 1.5rem;
}

.epm-paper-content {
    flex: 1;
    min-width: 0;
}

.epm-paper-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--epm-text);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.epm-paper-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.epm-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--epm-text-light);
}

.epm-meta-icon {
    font-size: 0.75rem;
}

.epm-meta-separator {
    color: var(--epm-text-muted);
    font-weight: 300;
}

.epm-paper-year {
    font-size: 1rem;
    font-weight: 700;
    color: var(--epm-primary);
}

/* Paper Actions */
.epm-paper-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.epm-btn-view {
    background: var(--epm-accent);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.epm-btn-download {
    background: var(--epm-primary);
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.epm-btn-icon {
    font-size: 0.875rem;
    margin-right: 0.25rem;
}

/* No Results */
.epm-no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--epm-text-light);
}

.epm-no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.epm-no-results h3 {
    font-size: 1.25rem;
    color: var(--epm-text);
    margin: 0 0 0.5rem 0;
}

.epm-no-results p {
    margin: 0;
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .epm-container {
        padding: 1rem;
    }
    
    .epm-page-title {
        font-size: 2rem;
    }
    
    .epm-content-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .epm-sidebar {
        position: static;
        order: 2;
    }
    
    .epm-paper-result {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .epm-paper-actions {
        width: 100%;
        justify-content: center;
    }
    
    .epm-results-header {
        padding: 1rem;
    }
    
    .epm-results-info {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .epm-header-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .epm-pagination-top {
        justify-content: center;
    }
    
    .epm-filter-actions {
        flex-direction: row;
    }
}

@media (max-width: 480px) {
    .epm-page-title {
        font-size: 1.75rem;
    }
    
    .epm-paper-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .epm-meta-separator {
        display: none;
    }
    
    .epm-paper-actions {
        flex-direction: column;
    }
    
    .epm-btn {
        width: 100%;
    }
}

/* Loading States */
.epm-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--epm-text-light);
}

.epm-spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--epm-border);
    border-top: 2px solid var(--epm-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.75rem;
}

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

/* Focus States */
.epm-btn:focus,
.epm-checkbox:focus + .epm-checkmark,
.epm-items-per-page:focus {
    outline: 2px solid var(--epm-primary);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .epm-sidebar,
    .epm-pagination,
    .epm-filter-actions,
    .epm-paper-actions {
        display: none;
    }
    
    .epm-content-wrapper {
        grid-template-columns: 1fr;
    }
    
    .epm-paper-result {
        break-inside: avoid;
        border: 1px solid var(--epm-border);
        margin-bottom: 1rem;
        border-radius: var(--epm-radius);
    }
}