/* Reset e base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    background: #f8fafc;
    min-height: 100vh;
}

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

/* Language Selector */
.language-selector-fixed {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    gap: 0;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lang-btn {
    background: transparent;
    border: none;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.lang-btn:hover,
.lang-btn.active {
    background: #3b82f6;
    color: white;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px 10px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 12px;
}

.header p {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 400;
}

/* Form Section */
.post-form-section {
    margin-bottom: 10px;
}

.form-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-toggle:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.form-toggle.active {
    border-color: #3b82f6;
    background: #eff6ff;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.form-icon {
    font-size: 1.3rem;
    margin-right: 12px;
}

.form-toggle-text {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e40af;
}

.form-arrow {
    font-size: 0.8rem;
    color: #64748b;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.form-toggle.active .form-arrow {
    transform: rotate(90deg);
    color: #3b82f6;
}

/* Cards */
.form-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 0 24px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
}

.form-card.expanded {
    max-height: 600px;
    padding: 24px;
    opacity: 1;
    border-color: #3b82f6;
    background: #f8fafc;
}

.form-card.collapsed {
    max-height: 0;
    padding: 0 24px;
    opacity: 0;
}

.search-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.form-card h2, .search-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e40af;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    color: #374151;
    font-size: 1rem;
    transition: all 0.2s ease;
    resize: vertical;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: #9ca3af;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.char-counter {
    position: absolute;
    bottom: -18px;
    right: 0;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Buttons */
.submit-btn, .search-btn, .reply-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.submit-btn:hover, .search-btn:hover, .reply-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.submit-btn:active, .search-btn:active, .reply-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Search Section */
.search-section {
    margin-bottom: 32px;
}

.search-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-toggle:hover {
    border-color: #06b6d4;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.1);
}

.search-toggle.active {
    border-color: #06b6d4;
    background: #ecfdf5;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.search-icon {
    font-size: 1.2rem;
    margin-right: 12px;
}

.search-toggle-text {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #0891b2;
}

.search-arrow {
    font-size: 0.8rem;
    color: #64748b;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.search-toggle.active .search-arrow {
    transform: rotate(90deg);
    color: #06b6d4;
}

.search-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    opacity: 0;
}

.search-card.expanded {
    max-height: 200px;
    padding: 20px;
    opacity: 1;
    border-color: #06b6d4;
    background: #f0fdfa;
}

.search-box {
    display: flex;
    gap: 12px;
    align-items: stretch;
    margin-top: 8px;
}

.search-box input {
    flex: 1;
    margin-bottom: 0;
}

.search-btn, .clear-btn {
    width: auto;
    padding: 12px 20px;
    min-width: 50px;
}

.search-btn {
    background: #06b6d4;
}

.search-btn:hover {
    background: #0891b2;
}

.clear-btn {
    background: #ef4444;
}

.clear-btn:hover {
    background: #dc2626;
}

/* Posts Section */
.posts-section {
    margin-top: 40px;
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    background: #ffffff;
    padding: 20px 24px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.posts-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
}

.posts-info {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Post Cards */
.post-card {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    padding: 24px;
    margin-bottom: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.post-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.1);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1e40af;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.post-meta {
    font-size: 0.8rem;
    color: #64748b;
    text-align: right;
    white-space: nowrap;
    margin-left: 20px;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
}

.post-content {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.95rem;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 2px solid #f1f5f9;
}

.post-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.read-more {
    color: #3b82f6;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #64748b;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Load More Button */
.load-more-btn {
    width: 100%;
    background: #ffffff;
    color: #3b82f6;
    border: 2px solid #3b82f6;
    padding: 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 24px 0;
}

.load-more-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.no-more-posts {
    text-align: center;
    padding: 24px;
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 20px;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
}

.modal-content {
    background: #ffffff;
    margin: 0 auto;
    padding: 0;
    border-radius: 16px;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    z-index: 2001;
    border: 2px solid #e2e8f0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid #f1f5f9;
    background: #f8fafc;
}

.modal-header h2 {
    margin: 0;
    color: #1e40af;
    font-size: 1.4rem;
    font-weight: 600;
}

.close {
    color: #64748b;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
}

.close:hover {
    color: #ef4444;
    background: #fee2e2;
}

.modal-post-content {
    padding: 24px;
    border-bottom: 2px solid #f1f5f9;
}

.modal-post-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 12px;
    line-height: 1.3;
}

.modal-post-meta {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 20px;
}

.modal-post-text {
    color: #374151;
    line-height: 1.7;
    white-space: pre-wrap;
    font-size: 1rem;
}

/* Replies Section */
.replies-section {
    max-height: 50vh;
    overflow-y: auto;
}

.replies-section h3 {
    padding: 20px 24px 12px;
    margin: 0;
    color: #1e40af;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 2px solid #f1f5f9;
}

.reply-form {
    padding: 20px 24px;
    border-bottom: 2px solid #f1f5f9;
    background: #f8fafc;
}

.reply-form textarea {
    width: 100%;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    color: #374151;
    resize: vertical;
    margin-bottom: 12px;
}

.reply-form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.replies-container {
    padding: 0 24px 24px;
}

.reply-item {
    padding: 16px 0;
    border-bottom: 1px solid #f1f5f9;
    border-left: 3px solid #3b82f6;
    padding-left: 16px;
}

.reply-item:last-child {
    border-bottom: none;
}

.reply-content {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 8px;
    white-space: pre-wrap;
}

.reply-meta {
    font-size: 0.8rem;
    color: #9ca3af;
}

/* Footer */
.main-footer {
    margin-top: 60px;
    padding: 32px 0;
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-support {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-support p {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
}

.footer-kofi-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 2px solid #3b82f6;
}

.footer-kofi-button:hover {
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.footer-kofi-button .coffee-icon {
    font-size: 1.1rem;
}

/* Messages */
.message-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 3000;
}

.message {
    padding: 12px 20px;
    margin-bottom: 8px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    border: 2px solid transparent;
}

.message.success {
    background: #10b981;
    border-color: #047857;
}

.message.error {
    background: #ef4444;
    border-color: #dc2626;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
    background: #ffffff;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    margin: 20px 0;
}

.empty-state::before {
    content: '💭';
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: #1e40af;
    font-weight: 600;
}

.empty-state p {
    font-size: 1rem;
    color: #64748b;
    font-weight: 400;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .language-selector-fixed {
        top: 15px;
        right: 15px;
    }
    
    .header {
        padding: 30px 20px;
        margin-bottom: 30px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .form-toggle, .search-toggle {
        padding: 16px 20px;
    }
    
    .form-card.expanded, .search-card.expanded {
        padding: 20px;
    }
    
    .search-box {
        flex-direction: column;
        gap: 8px;
    }
    
    .search-btn, .clear-btn {
        width: 100%;
    }
    
    .posts-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 16px 20px;
    }
    
    .post-card {
        padding: 20px;
        margin-bottom: 8px;
    }
    
    .post-header {
        flex-direction: column;
        gap: 8px;
    }
    
    .post-meta {
        text-align: left;
        margin-left: 0;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-post-content {
        padding: 20px;
    }
    
    .replies-section h3 {
        padding: 16px 20px 8px;
    }
    
    .reply-form {
        padding: 16px 20px;
    }
    
    .replies-container {
        padding: 0 20px 20px;
    }
    
    .message-container {
        top: 15px;
        right: 15px;
        left: 15px;
    }
    
    .message {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .form-card, .search-card {
        padding: 16px;
    }
    
    .post-card {
        padding: 16px;
        margin-bottom: 6px;
    }
    
    .modal-header, .modal-post-content {
        padding: 16px;
    }
}