/**
 * Forum UI Components
 * Modals, pagination, search results, empty states
 */

/* ============================================
   MODALS (Report, Delete, etc.)
   ============================================ */

.forum-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 2vw, 1.5rem);
}

.forum-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.forum-modal__content {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: clamp(1.25rem, 2.5vw, 1.5rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

html.dark .forum-modal__content {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

html.light .forum-modal__content {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.forum-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(0.75rem, 1.5vw, 1rem);
}

.forum-modal__title {
    margin: 0;
    font-size: clamp(1.125rem, 1.75vw + 0.25rem, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
}

.forum-modal__close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    margin: -0.5rem;
}

.forum-modal__close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.forum-modal__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.forum-modal__close svg {
    width: 20px;
    height: 20px;
}

.forum-modal__body {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: clamp(1.25rem, 2.5vw, 1.5rem);
    font-size: clamp(0.9375rem, 1.25vw + 0.2rem, 1rem);
}

.forum-modal__actions {
    display: flex;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    justify-content: flex-end;
    align-items: center;
}

/* Modal action buttons - consistent height */
.forum-modal__actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 clamp(0.875rem, 1.5vw, 1.25rem);
    font-size: clamp(0.875rem, 1.25vw + 0.1rem, 0.9375rem);
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.forum-modal__actions .btn-secondary,
.forum-modal__actions .btn--secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.forum-modal__actions .btn-secondary:hover,
.forum-modal__actions .btn--secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.forum-modal__actions .btn-danger {
    background: var(--error);
    color: #fff;
    border: none;
}

.forum-modal__actions .btn-danger:hover {
    background: var(--error-hover);
}

.forum-modal__actions .btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
}

.forum-modal__actions .btn-primary:hover {
    background: var(--accent-hover);
}

/* ============================================
   PAGINATION
   ============================================ */

.forum-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(0.375rem, 0.75vw, 0.5rem);
    margin-top: clamp(1.5rem, 3vw, 2rem);
}

.pagination-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 clamp(0.625rem, 1vw, 0.75rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.pagination-button:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pagination-button--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 600;
}

.pagination-button--active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #000;
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-button:disabled:hover {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}

.pagination-button svg {
    width: 16px;
    height: 16px;
}

/* Pagination ellipsis */
.pagination-ellipsis {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    color: var(--text-muted);
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
}

/* ============================================
   SEARCH RESULTS
   ============================================ */

.forum-search-results {
    padding: clamp(1.5rem, 3vw, 2rem) 0;
}

.search-header {
    margin-bottom: clamp(1.5rem, 3vw, 2rem);
    padding-bottom: clamp(1rem, 2vw, 1.25rem);
    border-bottom: 2px solid var(--border);
}

.search-title {
    margin: 0 0 clamp(0.375rem, 0.75vw, 0.5rem) 0;
    font-size: clamp(1.25rem, 2.5vw + 0.25rem, 1.75rem);
    font-weight: 700;
    color: var(--text-primary);
}

.search-title .search-query {
    color: var(--accent);
}

.search-title .search-category {
    color: var(--accent);
}

.search-count {
    margin: 0;
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 1.25vw + 0.15rem, 0.9375rem);
}

.search-count strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Search suggestions in empty state */
.search-suggestions {
    margin-top: clamp(1.5rem, 3vw, 2rem);
    text-align: left;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: clamp(1.25rem, 2.5vw, 1.5rem);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.search-suggestions h3 {
    margin: 0 0 clamp(0.75rem, 1.5vw, 1rem) 0;
    font-size: clamp(0.9375rem, 1.5vw + 0.15rem, 1rem);
    font-weight: 600;
    color: var(--text-primary);
}

.search-suggestions ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style: disc;
}

.search-suggestions li {
    margin-bottom: clamp(0.375rem, 0.75vw, 0.5rem);
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 1.25vw + 0.15rem, 0.9375rem);
}

.search-suggestions li:last-child {
    margin-bottom: 0;
}

.search-suggestions a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

.search-suggestions a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.forum-empty {
    text-align: center;
    padding: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.forum-empty svg {
    width: clamp(48px, 8vw, 64px);
    height: clamp(48px, 8vw, 64px);
    color: var(--text-muted);
    margin-bottom: clamp(0.75rem, 1.5vw, 1rem);
}

.forum-empty h2,
.forum-empty h3 {
    margin: 0 0 clamp(0.375rem, 0.75vw, 0.5rem) 0;
    font-size: clamp(1.125rem, 2vw + 0.25rem, 1.25rem);
    font-weight: 600;
    color: var(--text-primary);
}

.forum-empty p {
    margin: 0 0 clamp(1.25rem, 2.5vw, 1.5rem) 0;
    color: var(--text-secondary);
    font-size: clamp(0.9375rem, 1.25vw + 0.2rem, 1rem);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.forum-empty .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 clamp(1.25rem, 2vw, 1.5rem);
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: clamp(0.9375rem, 1.25vw + 0.15rem, 1rem);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.forum-empty .btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.forum-empty .btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   LOADING STATES
   ============================================ */

.forum-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    color: var(--text-secondary);
}

.forum-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.forum-loading p {
    margin: 0;
    font-size: clamp(0.9375rem, 1.25vw + 0.15rem, 1rem);
}

/* ============================================
   LIGHT MODE ADJUSTMENTS
   ============================================ */

html.light .forum-category-card {
    box-shadow: var(--shadow-sm);
}

html.light .forum-category-card:hover {
    box-shadow: var(--shadow-md);
}

html.light .topic-card {
    box-shadow: var(--shadow-sm);
}

html.light .topic-card:hover {
    box-shadow: var(--shadow-md);
}

html.light .topic-stats {
    box-shadow: var(--shadow-sm);
}

html.light .reply-item {
    box-shadow: var(--shadow-sm);
}

html.light .reply-item--best-answer {
    box-shadow: 0 0 0 2px var(--success);
}

html.light .replies-empty,
html.light .reply-login-prompt {
    box-shadow: var(--shadow-sm);
}

html.light .topic-action-btn {
    box-shadow: var(--shadow-sm);
}

html.light .topic-action-btn:hover {
    box-shadow: var(--shadow-sm);
}

html.light .forum-empty {
    box-shadow: var(--shadow-sm);
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-secondary) 50%,
        var(--bg-tertiary) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-text--title {
    height: 1.5em;
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    padding: clamp(1rem, 2vw, 1.25rem);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
