/* Articles Page Specific Styles */

/* Articles Hero Section */
.articles-hero {
    padding: 120px 0 80px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    position: relative;
    overflow: hidden;
}

.articles-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="%23e2e8f0" opacity="0.3"/><circle cx="80" cy="40" r="1" fill="%23e2e8f0" opacity="0.3"/><circle cx="40" cy="80" r="1" fill="%23e2e8f0" opacity="0.3"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.5;
}

.articles-hero .hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.articles-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.articles-hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid var(--border-light);
    border-radius: 25px;
    padding: 12px 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    min-width: 300px;
}

.search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.search-box i {
    color: var(--text-light);
    margin-right: 12px;
    font-size: 1.1rem;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    width: 100%;
    color: var(--text-primary);
}

.search-box input::placeholder {
    color: var(--text-light);
}

/* Filter Section */
.filter-section {
    padding: 60px 0;
    background: white;
    border-bottom: 1px solid var(--border-light);
}

.filter-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-tab {
    background: transparent;
    border: 2px solid var(--border-light);
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.filter-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
}

.filter-tab.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.sort-controls select {
    background: white;
    border: 2px solid var(--border-light);
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    min-width: 180px;
}

.sort-controls select:hover,
.sort-controls select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Articles Grid */
.articles-grid-section {
    padding: 80px 0;
    background: var(--bg-secondary);
    min-height: 60vh;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 40px;
    margin-bottom: 60px;
}

.article-card {
    background: white;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    height: fit-content;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

/* Article Image */
.article-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.article-card:hover .article-image img {
    transform: scale(1.05);
}

.article-category {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 102, 204, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.article-category.book {
    background: rgba(16, 185, 129, 0.9);
}

.article-category.research {
    background: rgba(99, 102, 241, 0.9);
}

.article-category.tutorial {
    background: rgba(245, 158, 11, 0.9);
}

/* Article Content */
.article-content {
    padding: 30px;
}

.article-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Article Meta */
.article-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.article-meta i {
    font-size: 0.8rem;
}

/* Article Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 25px;
}

.tag {
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-color);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(0, 102, 204, 0.2);
}

/* Article Actions */
.article-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.btn-icon:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
    transform: scale(1.1);
}

.btn-icon.bookmarked {
    color: var(--accent-color);
    background: rgba(16, 185, 129, 0.1);
}

/* Load More Section */
.load-more-section {
    text-align: center;
    padding: 40px 0;
}

/* Upload Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(50px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Upload Form */
.upload-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* File Upload */
.file-upload {
    position: relative;
    margin-bottom: 15px;
}

.file-upload input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background: rgba(0, 102, 204, 0.05);
    color: var(--primary-color);
}

.file-upload-label i {
    font-size: 1.2rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Loading Animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* RTL Adjustments */
html[lang="fa"] .search-box i {
    margin-left: 12px;
    margin-right: 0;
}

html[lang="fa"] .article-category {
    right: 15px;
    left: auto;
}

html[lang="fa"] .article-actions {
    flex-direction: row-reverse;
}

html[lang="fa"] .form-actions {
    justify-content: flex-start;
}

/* Responsive Design */
@media (max-width: 768px) {
    .articles-hero {
        padding: 100px 0 60px;
    }
    
    .articles-hero h1 {
        font-size: 2.2rem;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 20px;
    }
    
    .search-box {
        min-width: 100%;
        max-width: 100%;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }
    
    .filter-tabs {
        justify-content: center;
    }
    
    .sort-controls {
        align-self: center;
    }
    
    .sort-controls select {
        min-width: 200px;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .article-meta {
        gap: 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
    
    .modal-header,
    .upload-form {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .articles-hero h1 {
        font-size: 1.8rem;
    }
    
    .articles-hero p {
        font-size: 1rem;
    }
    
    .filter-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-tab {
        width: 200px;
        text-align: center;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .article-actions {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .btn-sm {
        width: 100%;
        justify-content: center;
    }
    
    .modal-header h2 {
        font-size: 1.2rem;
    }
}

/* Print Styles */
@media print {
    .nav,
    .hero-actions,
    .filter-section,
    .article-actions,
    .load-more-section,
    .modal,
    .footer {
        display: none;
    }
    
    .articles-hero {
        padding: 20px 0;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .article-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
    .articles-hero {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }
    
    .search-box {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    .article-card {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    .modal-content {
        background: var(--bg-secondary);
    }
}