/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-menu a:hover {
    opacity: 0.8;
}

.username {
    color: #ffd700;
    font-weight: bold;
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 1rem;
}

.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 4rem 0;
    background: white;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.hero-section h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #667eea;
}

.lead {
    font-size: 1.25rem;
    color: #666;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Stats Section */
.stats-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 1rem;
}

.stat-card {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Posts */
.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.posts-grid, .posts-list {
    display: grid;
    gap: 1.5rem;
}

.post-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

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

.post-card h2, .post-card h3 {
    margin-bottom: 0.5rem;
}

.post-card a {
    color: #667eea;
    text-decoration: none;
}

.post-card a:hover {
    text-decoration: underline;
}

.post-meta {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.post-excerpt {
    color: #555;
    line-height: 1.8;
}

/* Forms */
.auth-container, .form-container {
    max-width: 500px;
    margin: 2rem auto;
}

.auth-card {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    display: block;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
}

.auth-link a {
    color: #667eea;
    text-decoration: none;
}

/* Dashboard */
.dashboard-header {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.dashboard-section {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Tasks */
.task-form {
    margin-bottom: 2rem;
}

.task-form input,
.task-form textarea {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.task-content {
    flex: 1;
}

.task-content h4 {
    margin-bottom: 0.25rem;
}

.task-content h4.completed {
    text-decoration: line-through;
    color: #999;
}

/* Post View */
.post-view {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.post-view h1 {
    margin-bottom: 1rem;
    color: #667eea;
}

.post-content {
    margin: 2rem 0;
    line-height: 1.8;
    font-size: 1.1rem;
}

.post-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

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

/* About Page */
.about-page {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.about-content ul {
    margin-left: 2rem;
    margin-top: 1rem;
}

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

/* Error Pages */
.error-page {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.error-page h1 {
    font-size: 5rem;
    color: #667eea;
    margin-bottom: 1rem;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Avatar size limits - apply everywhere */
img[class*="avatar"],
img[src*="avatar"],
.user-avatar-small,
.comment-avatar,
.comment-avatar-small,
.profile-avatar,
.user-avatar-tiny {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: cover;
}

.user-avatar-small {
    max-width: 60px;
    max-height: 60px;
}

.comment-avatar {
    max-width: 40px;
    max-height: 40px;
}

.comment-avatar-small {
    max-width: 32px;
    max-height: 32px;
}

.user-avatar-tiny {
    max-width: 32px;
    max-height: 32px;
}

.profile-avatar {
    max-width: 120px;
    max-height: 120px;
}

/* Banner Slideshow */
.banner-slideshow {
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.slideshow-container {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.slide {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    transform: translateX(0);
}

.slide.active {
    display: block;
    opacity: 1;
    z-index: 1;
    animation: slideIn 0.8s ease-in-out;
}

.slide.prev {
    transform: translateX(-100%);
    opacity: 0;
}

.slide.next {
    transform: translateX(100%);
    opacity: 0;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slide-nav {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
}

.slide-prev, .slide-next {
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 0;
    transition: all 0.3s;
    pointer-events: auto;
}

.slide-prev:hover, .slide-next:hover {
    background: rgba(0,0,0,0.8);
}

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

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


.slide-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active, .dot:hover {
    background: white;
}

/* Homepage Layout with Sidebar */
.homepage-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    margin-top: 1rem;
}

.main-content {
    min-width: 0; /* Prevent overflow */
}

.sidebar-right {
    position: relative;
}

.sticky-sidebar {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* Top Users Sidebar */
.top-users-section {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.top-users-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.top-users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-card-sidebar {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.user-card-sidebar:hover {
    background: #e9ecef;
    transform: translateX(5px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.user-card-sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.user-info-sidebar {
    flex: 1;
    min-width: 0;
}

.user-info-sidebar strong {
    display: block;
    color: #333;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-stats {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 500;
}

/* Modern Post Cards */
.post-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
}

.post-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.post-card h3 {
    margin-bottom: 0.75rem;
    font-size: 1.3rem;
}

.post-card h3 a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.post-card h3 a:hover {
    color: #667eea;
}

.post-meta {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.post-meta a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.post-meta a:hover {
    text-decoration: underline;
}

.post-excerpt {
    color: #555;
    line-height: 1.6;
}

.premium-badge-small {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* Stats Section - Moved to bottom */
.stats-section {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.stats-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #667eea;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.05);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.stats-total {
    text-align: center;
    color: #6c757d;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
}

/* Recent Posts Section */
.recent-posts {
    margin-bottom: 2rem;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.recent-posts h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #333;
    font-weight: 600;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.75rem;
}

.posts-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Responsive */
/* Premium Content Styles */
.premium-lock {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-top: 1.5rem;
    text-align: center;
}

.premium-lock p {
    margin: 0.5rem 0;
}

.premium-warning {
    font-size: 1.1rem;
    margin: 1rem 0;
    font-weight: 500;
}

.premium-preview {
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.premium-preview h3 {
    color: #667eea;
    margin-bottom: 1rem;
}

.purchase-info {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #c3e6cb;
}

@media (max-width: 1024px) {
    .homepage-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-right {
        order: -1;
    }
    
    .sticky-sidebar {
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        gap: 1rem;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .posts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .homepage-layout {
        grid-template-columns: 1fr;
    }
}


