/* Blog Page Specific Styles */

/* Blog Header */
.blog-header {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.blog-header .nav-brand h2 {
    color: #4A90E2;
}

/* Blog Main */
.blog-main {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem 0;
}

/* Blog Intro */
.blog-intro {
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 2rem;
}

.blog-intro h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #4A90E2;
    margin-bottom: 1rem;
}

.blog-intro p {
    font-size: 1.2rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Blog Controls */
.blog-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.blog-search {
    display: flex;
    gap: 1rem;
    flex: 1;
    max-width: 500px;
}

.search-box {
    position: relative;
    flex: 2;
}

.search-box input {
    width: 100%;
    padding: 0.8rem 3rem 0.8rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #4A90E2;
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 35px;
    height: 35px;
    border: none;
    background: #4A90E2;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    background: #357ABD;
    transform: translateY(-50%) scale(1.05);
}

.filter-box {
    flex: 1;
}

.filter-box select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.filter-box select:focus {
    outline: none;
    border-color: #4A90E2;
}

.blog-actions {
    display: flex;
    gap: 1rem;
}

.btn-danger {
    background: #ff4757;
    color: white;
}

.btn-danger:hover {
    background: #ff3742;
    transform: translateY(-2px);
}

/* Blog Tabs */
.blog-tabs {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.tab-btn {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #4A90E2;
    background: white;
    border-bottom-color: #4A90E2;
}

.tab-btn:hover {
    color: #4A90E2;
    background: rgba(74, 144, 226, 0.05);
}

.tab-content {
    display: none;
    padding: 2rem;
    min-height: 400px;
}

.tab-content.active {
    display: block;
}

/* Posts Container */
.posts-container {
    min-height: 300px;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.posts-grid.list-view {
    grid-template-columns: 1fr;
}

.posts-grid.list-view .post-card {
    display: flex;
    max-height: 200px;
}

.posts-grid.list-view .post-card .post-image {
    flex: 0 0 200px;
    height: 100%;
}

.posts-grid.list-view .post-card .post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Post Card */
.post-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.post-image {
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-image .post-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #4A90E2;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.post-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #999;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #4A90E2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.8rem;
}

.post-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.8rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.post-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.post-tag {
    background: #f8f9fa;
    color: #4A90E2;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 500;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.post-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #999;
}

.post-actions {
    display: flex;
    gap: 0.5rem;
}

.post-actions button {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit {
    background: #4A90E2;
    color: white;
}

.btn-edit:hover {
    background: #357ABD;
    transform: scale(1.1);
}

.btn-delete {
    background: #ff4757;
    color: white;
}

.btn-delete:hover {
    background: #ff3742;
    transform: scale(1.1);
}

.btn-view {
    background: #2ed573;
    color: white;
}

.btn-view:hover {
    background: #27ae60;
    transform: scale(1.1);
}

/* Post Modal */
.post-modal {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.post-modal .form-group {
    margin-bottom: 1.5rem;
}

.post-modal label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: 500;
}

.post-modal input,
.post-modal select,
.post-modal textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    resize: vertical;
}

.post-modal input:focus,
.post-modal select:focus,
.post-modal textarea:focus {
    outline: none;
    border-color: #4A90E2;
}

.post-modal textarea {
    min-height: 150px;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

/* Post Detail Modal */
.post-detail-modal {
    max-width: 800px;
    max-height: 90vh;
}

.post-detail-content {
    padding: 0;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

.detail-header {
    padding: 2rem;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.detail-header h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.detail-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.detail-body {
    padding: 2rem;
}

.detail-content {
    line-height: 1.8;
    color: #333;
    font-size: 1.1rem;
}

.detail-content p {
    margin-bottom: 1.5rem;
}

.detail-tags {
    padding: 1rem 2rem 2rem;
    border-top: 1px solid #e9ecef;
}

.detail-tags h4 {
    margin-bottom: 0.8rem;
    color: #333;
}

/* Confirm Modal */
.confirm-modal {
    max-width: 400px;
}

.confirm-content {
    padding: 2rem;
    text-align: center;
}

.confirm-content p {
    margin-bottom: 2rem;
    color: #666;
    font-size: 1.1rem;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 3rem;
    color: #999;
}

.no-posts i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-posts p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

/* Loading */
.posts-loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.posts-loading .loading {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
    border-width: 4px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 2px solid #e9ecef;
    background: white;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pagination button:hover {
    border-color: #4A90E2;
    color: #4A90E2;
}

.pagination button.active {
    background: #4A90E2;
    color: white;
    border-color: #4A90E2;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 768px) {
    .blog-intro h1 {
        font-size: 2.5rem;
    }
    
    .blog-intro p {
        font-size: 1rem;
    }
    
    .blog-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .blog-search {
        max-width: none;
        width: 100%;
    }
    
    .blog-search {
        flex-direction: column;
    }
    
    .blog-actions {
        justify-content: center;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .posts-grid.list-view .post-card {
        flex-direction: column;
        max-height: none;
    }
    
    .posts-grid.list-view .post-card .post-image {
        flex: none;
        height: 200px;
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: left;
        border-bottom: 1px solid #e9ecef;
        border-right: none;
    }
    
    .tab-content {
        padding: 1.5rem;
    }
    
    .post-modal,
    .post-detail-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .detail-header {
        padding: 1.5rem;
    }
    
    .detail-header h1 {
        font-size: 1.5rem;
    }
    
    .detail-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .detail-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .blog-main {
        padding: 1rem 0;
    }
    
    .blog-intro {
        padding: 2rem 0;
    }
    
    .blog-intro h1 {
        font-size: 2rem;
    }
    
    .blog-controls {
        padding: 1rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
    
    .post-content {
        padding: 1rem;
    }
    
    .post-title {
        font-size: 1.1rem;
    }
    
    .confirm-content {
        padding: 1.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}

/* Custom Scrollbar */
.post-detail-content::-webkit-scrollbar {
    width: 6px;
}

.post-detail-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.post-detail-content::-webkit-scrollbar-thumb {
    background: #4A90E2;
    border-radius: 3px;
}

.post-detail-content::-webkit-scrollbar-thumb:hover {
    background: #357ABD;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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