/**
 * Additional Styles for Forum Theme
 * JavaScript-enhanced components and animations
 * 
 * @package Forum_Theme
 */

/* ==========================================================================
   Scroll to Top Button
   ========================================================================== */

.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    box-shadow: var(--shadow-hover);
    z-index: 999;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--secondary-color);
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ==========================================================================
   Notification
   ========================================================================== */

.notification {
    position: fixed;
    top: 90px;
    right: 20px;
    background: var(--card-background);
    color: var(--text-color);
    padding: 15px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    z-index: 9999;
    opacity: 0;
    transform: translateX(400px);
    transition: var(--transition);
    max-width: 350px;
    border-left: 4px solid var(--primary-color);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification-success {
    border-left-color: var(--success-color);
}

.notification-error {
    border-left-color: var(--danger-color);
}

.notification-warning {
    border-left-color: var(--warning-color);
}

@media (max-width: 768px) {
    .notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */

.reading-progress {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 999;
}

.reading-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.1s ease;
}

/* ==========================================================================
   Animations
   ========================================================================== */

.forum-post-item,
.widget,
.comment {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.forum-post-item.animated,
.widget.animated,
.comment.animated {
    opacity: 1;
    transform: translateY(0);
}

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

.post-share {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-share span {
    color: var(--text-light);
    font-size: 14px;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--hover-color);
    color: var(--text-color);
    transition: var(--transition);
}

.share-button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.share-button.twitter:hover {
    background: #1DA1F2;
    color: #ffffff;
}

.share-button.facebook:hover {
    background: #1877F2;
    color: #ffffff;
}

.share-button.copy:hover {
    background: var(--secondary-color);
    color: #ffffff;
}

/* ==========================================================================
   Character Counter
   ========================================================================== */

.character-counter {
    text-align: right;
    font-size: 13px;
    color: var(--text-light);
    margin-top: 5px;
}

.character-counter.warning {
    color: var(--warning-color);
}

/* ==========================================================================
   Table Responsive Wrapper
   ========================================================================== */

.table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.table-wrapper table {
    margin: 0;
    min-width: 600px;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */

.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Widget Collapse (Mobile)
   ========================================================================== */

.widget-collapsed .widget-title::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    float: right;
    transition: var(--transition);
}

.widget-collapsed.widget-collapsed .widget-title::after {
    transform: rotate(-180deg);
}

@media (max-width: 768px) {
    .widget-title {
        cursor: pointer;
        user-select: none;
    }
    
    .widget-title::after {
        content: '\f107';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        float: right;
        transition: var(--transition);
    }
    
    .widget-collapsed .widget-title::after {
        transform: rotate(-180deg);
    }
    
    .widget-collapsed > *:not(.widget-title) {
        display: none;
    }
}

/* 导航栏特效已删除 */

/* ==========================================================================
   Search Form Focus State
   ========================================================================== */

.search-form.focused {
    transform: scale(1.02);
    transition: var(--transition);
}

.search-form input[type="search"]:focus {
    transform: none;
}

/* ==========================================================================
   Footer Widgets Layout
   ========================================================================== */

.footer-widgets {
    margin-bottom: 30px;
}

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

.footer-widget-column .widget {
    background: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.8);
}

.footer-widget-column .widget-title {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.footer-widget-column .widget a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-widget-column .widget a:hover {
    color: #ffffff;
}

.footer-navigation {
    display: inline-block;
}

.footer-navigation ul {
    display: flex;
    list-style: none;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.site-info {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

.site-info p {
    margin: 5px 0;
}

.site-info a {
    color: #ffffff;
    text-decoration: underline;
}

.site-info a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .site-header,
    .site-footer,
    .widget-area,
    .comment-respond,
    .post-navigation,
    .scroll-to-top,
    .notification,
    .reading-progress {
        display: none !important;
    }
    
    .main-content {
        max-width: 100%;
        padding: 0;
    }
    
    .single-post-container {
        box-shadow: none;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: var(--text-light);
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

.screen-reader-text:focus {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    clip: auto !important;
    clip-path: none;
    color: var(--text-color);
    display: block;
    font-size: 14px;
    font-weight: 600;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Focus visible for keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ==========================================================================
   Image Lightbox
   ========================================================================== */

.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-lightbox.active {
    opacity: 1;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ==========================================================================
   Swipe Indicator (Mobile)
   ========================================================================== */

.swipe-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 20px 30px;
    border-radius: var(--border-radius);
    font-size: 18px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.swipe-indicator.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* ==========================================================================
   Scroll Hint for Tables
   ========================================================================== */

.scroll-hint {
    text-align: center;
    padding: 10px;
    background: var(--hover-color);
    color: var(--text-light);
    font-size: 14px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.tooltip {
    position: fixed;
    background: var(--secondary-color);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: var(--border-radius);
    font-size: 14px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--secondary-color);
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Input Focus States
   ========================================================================== */

.input-focused {
    position: relative;
}

.input-focused::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    animation: input-focus-line 0.3s ease;
}

@keyframes input-focus-line {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

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

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

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

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--background-color);
}

