/**
 * Forum Enhanced CSS
 * Location: /assets/css/forum-enhanced.css
 * Consolidated styling for all forum pages with theme support
 */

/* ======================
   CSS VARIABLES FOR THEME SUPPORT
   ====================== */

:root {
    /* Base forum styling variables */
    --forum-icon-size: 18px;
    --forum-card-border-radius: 0.375rem;
    --forum-thread-hover-bg: rgba(var(--bs-primary-rgb), 0.05);
    --forum-badge-font-size: 0.75rem;
    --forum-online-animation-duration: 2s;
    --forum-border-color: #e9ecef;
    --forum-author-bg: #f8f9fa;
    --forum-content-font-size: 1rem;
    --forum-meta-font-size: 0.875rem;
    --forum-signature-border: #dee2e6;
    
    /* Category-specific variables */
    --category-sticky-bg: rgba(255, 193, 7, 0.1);
    --category-locked-color: #dc3545;
    --category-icon-size: 20px;
    
    /* Thread-specific variables */
    --thread-border-color: #e9ecef;
    --thread-author-bg: #f8f9fa;
    --thread-content-font-size: 1rem;
    --thread-meta-font-size: 0.875rem;
    --thread-signature-border: #dee2e6;
    
    /* Theme-specific variables (will be overridden by theme files) */
    --forum-category-sticky-bg: rgba(255, 193, 7, 0.1);
    --forum-category-locked-color: #dc3545;
    --forum-buysell-primary: #ffc107;
    --forum-search-highlight: rgba(var(--bs-success-rgb), 0.1);
}

/* ======================
   GENERAL FORUM STYLING
   ====================== */

/* Thread status icons */
.forum-icon,
.thread-status-icons img {
    width: var(--forum-icon-size);
    height: var(--forum-icon-size);
    object-fit: contain;
}

/* Enhanced thread status icons container */
.thread-status-icons {
    width: var(--category-icon-size);
    min-width: var(--category-icon-size);
}

/* Table hover effects */
.table-hover tbody tr:hover {
    background-color: var(--forum-thread-hover-bg);
    transition: background-color 0.15s ease-in-out;
}

/* Enhanced table row interactions */
.table tbody tr {
    transition: transform 0.2s ease, background-color 0.15s ease-in-out;
}

.table tbody tr:hover {
    transform: scale(1.01);
}

/* Sticky positioning for sidebar */
.sticky-top {
    z-index: 1020;
}

/* Badge styling */
.badge.fs-6 {
    font-size: var(--forum-badge-font-size) !important;
}

/* Thread pages badges */
.badge.bg-secondary {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* ======================
   FORUM CATEGORY STYLING
   ====================== */

/* Sticky thread highlighting */
.table-warning {
    background-color: var(--category-sticky-bg) !important;
}

/* Sticky threads i dark mode - sørg for læsbar tekst */
[data-bs-theme="dark"] .table-warning,
[data-theme="dark"] .table-warning {
    --bs-table-color: #e0e0e0 !important;
    --bs-table-bg: rgba(255, 193, 7, 0.15) !important;
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .table-warning a,
[data-theme="dark"] .table-warning a {
    color: #e0e0e0 !important;
}

[data-bs-theme="dark"] .table-warning a:hover,
[data-theme="dark"] .table-warning a:hover {
    color: #ffc107 !important;
}

/* Category cards hover effect */
.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

/* Thread read indicator animation */
.thread-read-indicator {
    position: relative;
}

.thread-read-indicator::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background-color: var(--bs-primary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.table-hover tbody tr:hover .thread-read-indicator::after {
    opacity: 1;
}

/* Latest post button animation */
.btn-outline-primary.btn-sm {
    transition: all 0.2s ease;
}

.btn-outline-primary.btn-sm:hover {
    transform: translateX(2px);
}

/* ======================
   FORUM THREAD STYLING
   ====================== */

/* Content formatting */
.content-formatting {
    font-size: var(--thread-content-font-size);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.content-formatting p {
    margin-bottom: 1rem;
}

.content-formatting h1,
.content-formatting h2,
.content-formatting h3,
.content-formatting h4,
.content-formatting h5,
.content-formatting h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.content-formatting ul,
.content-formatting ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.content-formatting blockquote {
    background-color: #1a1a2e;
    color: #ffffff;
    border-left: 4px solid #0d6efd;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.content-formatting img {
    max-width: 100%;
    height: auto;
    border-radius: 0.375rem;
    margin: 0.5rem 0;
}

.content-formatting code {
    background-color: rgba(var(--bs-gray-500-rgb), 0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

/* Responsive content container */
.responsive-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Make all iframes responsive (YouTube, Vimeo, etc.) */
.responsive-content iframe {
    max-width: 100% !important;
    height: auto;
    min-height: 200px;
}

/* Specific styling for YouTube embeds */
.responsive-content iframe[src*="youtube.com"],
.responsive-content iframe[src*="youtu.be"] {
    aspect-ratio: 16/9;
    width: 100%;
    min-height: 315px;
}

/* Other video platforms */
.responsive-content iframe[src*="vimeo.com"],
.responsive-content iframe[src*="twitch.tv"] {
    aspect-ratio: 16/9;
    width: 100%;
    min-height: 315px;
}

/* Twitter/X embeds - lad Twitter's widget.js bestemme hoejden */
.responsive-content .twitter-tweet,
.responsive-content .twitter-tweet-rendered {
    max-width: 550px !important;
    overflow: visible !important;
}

.responsive-content .twitter-tweet-rendered iframe {
    min-height: auto !important;
}

/* Make other media elements responsive */
.responsive-content img,
.responsive-content video,
.responsive-content embed,
.responsive-content object {
    max-width: 100% !important;
    height: auto !important;
}

/* Author sidebar border */
.border-end {
    border-color: var(--thread-border-color) !important;
}

/* Post anchors for smooth scrolling */
[id^="p"] {
    scroll-margin-top: 100px;
}

/* Signature styling */
.signature {
    font-size: var(--thread-meta-font-size);
    border-top: 1px solid var(--thread-signature-border);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

/* ======================
   FORUM OVERVIEW STYLING
   ====================== */

/* Online indicator animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.online-indicator {
    animation: pulse var(--forum-online-animation-duration) infinite;
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #28a745;
    border-radius: 50%;
    margin-right: 0.25rem;
}

/* Search results styling */
.search-results .table tbody tr:hover {
    background-color: var(--forum-search-highlight);
}

/* Enhanced form styling */
#forumSearchForm .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

#forumSearchForm .btn:hover {
    transform: translateY(-1px);
    transition: transform 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

/* ======================
   RATING SYSTEM
   ====================== */

/* Rating buttons */
.button_1up,
.button_1up_grey {
    transition: all 0.2s ease;
}

.button_1up:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

/* ======================
   BBCODE EDITOR STYLING
   ====================== */

.bbedit-toolbar {
    border-radius: 0.375rem 0.375rem 0 0;
    background-color: var(--bs-light);
    border: 1px solid var(--bs-border-color);
    border-bottom: none;
}

.bbedit-textarea {
    border-radius: 0 0 0.375rem 0.375rem;
}

/* ======================
   ANIMATIONS & EFFECTS
   ====================== */

/* Thread highlight animation */
@keyframes highlight {
    from { background-color: rgba(var(--bs-warning-rgb), 0.3); }
    to { background-color: transparent; }
}

.highlight-post {
    animation: highlight 3s ease-out;
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--bs-primary);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Notification slide-in animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ======================
   PAGINATION STYLING
   ====================== */

.pagination-wrapper .pagination {
    margin-bottom: 0;
}

.pagination .page-link:hover {
    transform: translateY(-1px);
    transition: transform 0.15s ease-in-out;
}

/* ======================
   UTILITY CLASSES
   ====================== */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.position-fixed {
    position: fixed !important;
}

/* ======================
   RESPONSIVE DESIGN
   ====================== */

@media (max-width: 991.98px) {
    .border-end {
        border-end: none !important;
        border-bottom: 1px solid var(--thread-border-color) !important;
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .content-formatting {
        font-size: 0.95rem;
    }
    
    .small {
        font-size: 0.8rem !important;
    }
    
    .responsive-content iframe {
        min-height: 250px;
    }
    
    .responsive-content iframe[src*="youtube.com"],
    .responsive-content iframe[src*="youtu.be"],
    .responsive-content iframe[src*="vimeo.com"],
    .responsive-content iframe[src*="twitch.tv"] {
        min-height: 200px;
    }
}

@media (max-width: 767.98px) {
    .table td {
        padding: 1rem 0.5rem;
    }
    
    .display-5 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .table-responsive {
        border: none;
    }
    
    .table td {
        border: none;
        padding: 0.75rem 0.5rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .display-5,
    .display-6 {
        font-size: 1.5rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .card-header h4,
    .card-header h5 {
        font-size: 1.1rem;
    }
    
    .badge.fs-6 {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }
    
    .btn-group .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .content-formatting {
        font-size: 0.9rem;
    }
    
    .responsive-content iframe {
        min-height: 200px;
    }
    
    .responsive-content iframe[src*="youtube.com"],
    .responsive-content iframe[src*="youtu.be"],
    .responsive-content iframe[src*="vimeo.com"],
    .responsive-content iframe[src*="twitch.tv"] {
        min-height: 180px;
    }
    
    .thread-content,
    .post-content {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .signature {
        font-size: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* ======================
   DARK MODE SUPPORT
   ====================== */

[data-bs-theme="dark"],
[data-theme="dark"] {
    --forum-thread-hover-bg: rgba(255, 255, 255, 0.05);
    --forum-border-color: #495057;
    --forum-author-bg: #343a40;
    --forum-signature-border: #495057;
    --forum-category-sticky-bg: rgba(255, 193, 7, 0.2);
    --thread-border-color: #495057;
    --thread-author-bg: #343a40;
    --thread-signature-border: #495057;
    --category-sticky-bg: rgba(255, 193, 7, 0.2);
}

[data-bs-theme="dark"] .category-card,
[data-theme="dark"] .category-card {
    background-color: var(--bs-dark) !important;
}

[data-bs-theme="dark"] .table-light,
[data-theme="dark"] .table-light {
    background-color: var(--bs-gray-800) !important;
    border-color: var(--bs-gray-700) !important;
}

[data-bs-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light {
    background-color: var(--bs-dark) !important;
}

/* ======================
   ACCESSIBILITY
   ====================== */

.card:focus-within {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

a:focus,
button:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.table th,
.table td {
    vertical-align: middle;
}

/* ======================
   PRINT STYLES
   ====================== */

@media print {
    .sticky-top,
    .btn,
    .pagination,
    .breadcrumb,
    .card-header,
    .online-indicator,
    .card:last-child,
    #reply-form {
        display: none !important;
    }
    
    .card {
        border: 1px solid #dee2e6;
        break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .table td {
        padding: 0.5rem !important;
    }
}

/* ======================
   THEME PLACEHOLDER CLASSES
   ====================== */

/* These classes will be expanded by theme-specific CSS files */
.theme-mario {
    /* Mario theme overrides will be loaded from mario-theme.css */
}

.theme-zelda {
    /* Zelda theme overrides will be loaded from zelda-theme.css */
}

.theme-pokemon {
    /* Pokemon theme overrides will be loaded from pokemon-theme.css */
}

/* ======================
   PWA ENHANCEMENTS
   ====================== */

/* Offline state styling */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #ffc107;
    color: #000;
    text-align: center;
    padding: 0.5rem;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

/* Install prompt styling */
.install-prompt {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bs-primary);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 9998;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.install-prompt.show {
    transform: translateY(0);
    opacity: 1;
}