/* KhaboonForum - Main Stylesheet */

:root {
    /* Light theme colors */
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #7c3aed;
    --accent-color: #8b5cf6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.3s ease;
}

/* Dark theme */
.dark-theme {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #a78bfa;
    --text-color: #f9fafb;
    --text-light: #d1d5db;
    --bg-color: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --border-color: #4b5563;
    --success-color: #34d399;
    --error-color: #f87171;
    --warning-color: #fbbf24;
}

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

body {
    font-family: 'Poppins', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-secondary);
    line-height: 1.6;
    transition: var(--transition);
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* Text links within post/comment content */
.text-link {
    color: var(--primary-color);
    text-decoration: underline;
    word-break: break-all;
    overflow-wrap: break-word;
}

.text-link:hover {
    color: var(--primary-dark);
    text-decoration: none;
}

.dark-theme .text-link {
    color: var(--accent-color);
}

.dark-theme .text-link:hover {
    color: #a78bfa;
}
}

/* PWA Install Button */
.pwa-install-btn { 
    position: fixed; 
    bottom: 20px; 
    right: 20px; 
    z-index: 1000;
    display: none; /* Hidden by default, shown by JS */
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 1.25rem;
    font-weight: 500;
}

/* Header */
.main-header {
    background: var(--primary-color); /* Solid color fallback */
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none;
}

.logo a:hover {
    color: white;
    opacity: 0.9;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 1.75rem;
    margin-bottom: 0;
}

.tagline {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.25rem;
    margin-left: 3.25rem;
}

.main-nav ul {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.main-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
    background: rgba(255, 255, 255, 0.1);
}

/* Timezone Indicator */
.timezone-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    margin-left: 1rem;
}

.timezone-info i {
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .timezone-info {
        display: none;
    }
}

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

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

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

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

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 350px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    transition: var(--transition);
}

.toast-notification:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toast-content i {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-color: rgba(16, 185, 129, 0.2);
}

.toast-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border-color: rgba(239, 68, 68, 0.2);
}

.toast-info {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.2);
}

.toast-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-color: rgba(245, 158, 11, 0.2);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
}

.dark-theme .toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

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

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

.post-card {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

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

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

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

.avatar.small {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.avatar.large {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-info strong {
    font-size: 1rem;
}

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

.post-stats {
    display: flex;
    gap: 1rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.post-content {
    margin-bottom: 1rem;
}

.post-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.post-image {
    margin-top: 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.post-image img:hover {
    transform: scale(1.02);
}

/* Reactions */
.post-reactions {
    margin: 1rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.reaction-counts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.reaction-count {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.reaction-count.large {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
}

.reaction-count .count {
    font-weight: 600;
    color: var(--text-color);
}

.reaction-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.reaction-btn {
    background: var(--bg-tertiary);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-size: 1.125rem;
    cursor: pointer;
    transition: var(--transition);
}

.reaction-btn:hover {
    background: var(--border-color);
    transform: scale(1.1);
}

.reaction-btn.reacted {
    background: var(--primary-color);
    color: white;
    animation: bounce 0.3s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Post Actions */
.post-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Forms */
.create-post-form,
.add-comment {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

.form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* File Upload */
.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-label:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.image-preview {
    position: relative;
    margin-top: 1rem;
    max-width: 300px;
}

.image-preview img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.btn-remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--error-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-remove-image:hover {
    transform: scale(1.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Post Detail */
.post-detail {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-card {
    margin-bottom: 2rem;
    padding: 2rem;
}

.detail-image img {
    max-height: 500px;
}

.detail-stats {
    display: flex;
    gap: 2rem;
    margin: 1rem 0;
}

.detail-reactions {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin: 1.5rem 0;
}

/* Comments */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.comments-list {
    margin-top: 2rem;
}

.comment-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment-content p {
    margin-bottom: 0;
    line-height: 1.7;
}

.empty-comments {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-comments i {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Load More */
.load-more {
    text-align: center;
    margin: 3rem 0;
}

/* Footer */
.main-footer {
    background: var(--bg-tertiary);
    color: var(--text-color);
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

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

.footer-section h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section p {
    color: var(--text-light);
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.875rem;
}

.stats {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .logo a {
        justify-content: center;
    }
    
    .tagline {
        margin-left: 0;
    }
    
    .main-nav ul {
        justify-content: center;
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .detail-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .main-nav a {
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .post-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .reaction-buttons {
        justify-content: center;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.post-card,
.comment-card {
    animation: fadeIn 0.3s ease-out;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 2rem; }

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Selection */
::selection {
    background: rgba(79, 70, 229, 0.3);
    color: var(--text-color);
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .main-header,
    .main-footer,
    .form-actions,
    .reaction-buttons,
    .post-actions {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .post-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}