/* ===================================
   ThriftMaal Community Forum Styles
   Mobile-First, SEO Optimized
   =================================== */

/* CSS Variables - Matching ThriftMaal Theme */
:root {
    /* Colors */
    --primary-color: #FF6B35;
    --primary-dark: #E55A28;
    --primary-light: #FF8555;
    --secondary-color: #F59E0B;
    --accent-color: #EF4444;
    
    /* Text Colors */
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    
    /* Background Colors */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --bg-dark: #1F2937;
    
    /* Border & Shadow */
    --border-color: #E5E7EB;
    --border-radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    
    /* Spacing */
    --container-width: 1280px;
    --header-height: 70px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===================================
   Base Styles & Reset
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================
   Container & Layout
   =================================== */

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ===================================
   Header Styles
   =================================== */

.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 20px;
}

.logo-img {
    height: 40px;
    width: auto;
}

.nav-menu {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* ===================================
   Buttons
   =================================== */

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 107, 53, 0.4);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-new-post {
    width: 100%;
    justify-content: center;
    padding: 14px 24px;
    font-size: 15px;
}

/* ===================================
   Community Hero Section
   =================================== */

.community-hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 50%, var(--accent-color) 100%);
    padding: 60px 0;
    color: white;
    text-align: center;
    margin-bottom: 40px;
}

.hero-title {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
    font-size: 20px;
    font-weight: 400;
    opacity: 0.95;
    margin-bottom: 30px;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
    margin-top: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

/* ===================================
   Community Main Layout
   =================================== */

.community-main {
    padding: 40px 0 80px;
}

.community-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
}

/* ===================================
   Sidebar Styles
   =================================== */

.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-widget {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.widget-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Category Navigation */
.category-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.category-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.category-link.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.category-link i {
    font-size: 16px;
    width: 20px;
}

.category-link span:nth-child(2) {
    flex: 1;
}

.category-count {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.category-link.active .category-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* ===================================
   Content Area
   =================================== */

.community-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Content Header - Search & Filters */
.content-header {
    display: flex;
    gap: 15px;
    align-items: center;
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.search-bar {
    flex: 1;
    display: flex;
    gap: 10px;
    position: relative;
}

.search-bar input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    transition: border-color 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-bar button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-bar button:hover {
    background: var(--primary-dark);
}

.filter-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#sort-select {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    background: var(--bg-primary);
    color: var(--text-primary);
}

#sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.view-toggle {
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.view-toggle:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ===================================
   Posts Grid
   =================================== */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Post Card */
.post-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.post-card.pinned {
    border-color: var(--secondary-color);
    background: linear-gradient(to bottom, rgba(245, 158, 11, 0.05), var(--bg-primary));
}

.post-card.pinned::before {
    content: '\f08d';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--secondary-color);
    font-size: 16px;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.post-meta {
    flex: 1;
}

.post-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    display: block;
}

.post-time {
    font-size: 12px;
    color: var(--text-light);
}

.post-category-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.post-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.post-tag {
    padding: 4px 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.post-footer {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-light);
}

.post-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-stat i {
    font-size: 14px;
}

/* ===================================
   Load More Section
   =================================== */

.load-more-section {
    text-align: center;
    padding: 30px 0;
}

#load-more-btn {
    padding: 14px 40px;
    font-size: 15px;
}

/* ===================================
   Modal Styles
   =================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

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

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

.modal-large {
    max-width: 900px;
}

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

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

.modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-light);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

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

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

/* ===================================
   Post Detail Modal
   =================================== */

.post-detail-header {
    margin-bottom: 20px;
}

.post-detail-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text-primary);
    line-height: 1.3;
}

.post-detail-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.post-detail-author-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.post-detail-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 20px;
}

.post-detail-author-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.post-detail-time {
    font-size: 13px;
    color: var(--text-light);
}

.post-detail-stats {
    display: flex;
    gap: 25px;
    font-size: 14px;
    color: var(--text-secondary);
}

.post-detail-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-detail-content {
    padding: 25px 0;
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.post-detail-actions {
    display: flex;
    gap: 15px;
    padding: 20px 0;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.action-btn {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

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

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

/* Comments Section */
.comments-section {
    margin-top: 30px;
}

.comments-header {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.comment-form {
    margin-bottom: 30px;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--border-radius);
}

.comment-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    font-family: var(--font-family);
    resize: vertical;
    min-height: 80px;
    margin-bottom: 12px;
}

.comment-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.comment-submit {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-item {
    background: var(--bg-secondary);
    padding: 18px;
    border-radius: var(--border-radius);
    border-left: 3px solid var(--primary-color);
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.comment-author {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.comment-time {
    font-size: 12px;
    color: var(--text-light);
    margin-left: auto;
}

.comment-content {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.comment-actions {
    display: flex;
    gap: 15px;
    font-size: 13px;
}

.comment-action {
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s ease;
}

.comment-action:hover {
    color: var(--primary-color);
}

/* Replies */
.comment-replies {
    margin-top: 15px;
    margin-left: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.reply-item {
    background: var(--bg-primary);
    padding: 15px;
    border-radius: var(--border-radius);
    border-left: 2px solid var(--secondary-color);
}

/* ===================================
   Footer Styles
   =================================== */

.footer {
    background: var(--bg-dark);
    color: white;
    padding: 50px 0 20px;
    margin-top: 80px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h4 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 15px;
    color: white;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.6;
}

.footer-section a {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--primary-color);
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.social-links a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

/* ===================================
   Loading & Empty States
   =================================== */

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    font-size: 16px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

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

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

.empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* ===================================
   Responsive Design
   =================================== */

/* Tablet */
@media (max-width: 768px) {
    .community-layout {
        grid-template-columns: 1fr;
    }
    
    .community-sidebar {
        order: 2;
    }
    
    .community-content {
        order: 1;
    }
    
    .sidebar-widget {
        padding: 15px;
    }
    
    .hero-title {
        font-size: 32px;
    }
    
    .hero-subtitle {
        font-size: 16px;
    }
    
    .hero-stats {
        gap: 30px;
    }
    
    .stat-number {
        font-size: 24px;
    }
    
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
    }
    
    .content-header {
        flex-direction: column;
    }
    
    .search-bar {
        width: 100%;
    }
    
    .filter-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    #sort-select {
        flex: 1;
    }
    
    .nav-menu {
        display: none;
    }
}

/* Mobile */
@media (max-width: 480px) {
    :root {
        --header-height: 60px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .community-hero {
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: 26px;
    }
    
    .hero-subtitle {
        font-size: 14px;
    }
    
    .hero-stats {
        gap: 20px;
    }
    
    .stat-number {
        font-size: 20px;
    }
    
    .stat-label {
        font-size: 12px;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .post-card {
        padding: 15px;
    }
    
    .post-title {
        font-size: 16px;
    }
    
    .post-excerpt {
        font-size: 13px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .post-detail-title {
        font-size: 22px;
    }
    
    .comment-replies {
        margin-left: 20px;
    }
    
    .btn-new-post {
        padding: 12px 20px;
    }
}

/* ===================================
   Utility Classes
   =================================== */

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 10px;
}

.mt-2 {
    margin-top: 20px;
}

.mb-1 {
    margin-bottom: 10px;
}

.mb-2 {
    margin-bottom: 20px;
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
