/* Blog Container and Layout */
.blog-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

.blog-header {
    text-align: center;
    margin-bottom: 3rem;
}

.blog-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: #333;
}

.blog-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

/* Filters */
.blog-filters {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #555;
}

.filter-select, .filter-input {
    padding: 0.5rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Blog Card */
.blog-card {
    perspective: 1000px;
    height: 400px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.blog-card.flipped .card-inner {
    transform: rotateY(180deg);
}

/* Card Faces */
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.blog-card:hover .card-front {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.card-back {
    background: white;
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
}

/* Card Front Content */
.card-image {
    height: 200px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.card-image.default-image {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.card-content {
    padding: 1.5rem;
    background: white;
    height: 200px;
    display: flex;
    flex-direction: column;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.card-category {
    color: #007bff;
    font-weight: 600;
}

.card-date {
    color: #666;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #333;
    flex-grow: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-excerpt {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #888;
    margin-top: auto;
}

/* Hover hint */
.card-hover-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 0.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.blog-card:hover .card-hover-hint {
    transform: translateY(0);
}

/* Card Back Content */
.card-back-header {
    padding: 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    text-align: right;
}

.close-fullscreen {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #666;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-fullscreen:hover {
    background: #e9ecef;
    color: #333;
}

.card-back-content {
    padding: 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* Fullscreen Mode */
.blog-card.fullscreen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 1000px;
    height: 90vh;
    z-index: 1000;
    animation: expandToFullscreen 0.5s ease-out;
}

.blog-card.fullscreen .card-inner {
    height: 100%;
}

.blog-card.fullscreen .card-back {
    height: 100%;
}

@keyframes expandToFullscreen {
    from {
        width: 320px;
        height: 400px;
    }
    to {
        width: 90vw;
        height: 90vh;
    }
}

/* Overlay for fullscreen */
.blog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.blog-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

.page-link {
    padding: 0.5rem 1rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: #0056b3;
    transform: translateY(-2px);
}

.page-current {
    color: #666;
}

/* Tag Cloud */
.blog-sidebar {
    margin-top: 3rem;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 12px;
}

.blog-sidebar h3 {
    margin-bottom: 1rem;
    color: #333;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 20px;
    text-decoration: none;
    color: #555;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.tag-link:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: translateY(-2px);
}

.tag-count {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Loading Spinner */
.blog-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .blog-container {
        padding: 1rem;
    }
    
    .blog-header h1 {
        font-size: 2rem;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .blog-card.fullscreen {
        width: 100vw;
        height: 100vh;
        max-width: none;
    }
    
    .blog-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select, .filter-input {
        width: 100%;
    }
}

/* Blog post content styling */
.blog-post-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.blog-post-content h1 {
    font-size: 2.5rem;
    margin: 2rem 0 1rem;
}

.blog-post-content h2 {
    font-size: 2rem;
    margin: 2rem 0 1rem;
}

.blog-post-content h3 {
    font-size: 1.5rem;
    margin: 1.5rem 0 0.75rem;
}

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

.blog-post-content code {
    background: #f4f4f4;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.blog-post-content pre {
    background: #282c34;
    color: #abb2bf;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.blog-post-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #666;
}

.blog-post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.blog-post-content ul, .blog-post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.blog-post-content li {
    margin-bottom: 0.5rem;
}