/* ==================== FORUM STYLES ====================
   Consistent with Nalanda platform design system.
   Uses CSS variables from theme.css for theming + dark mode.
   ==================== */

/* ===================================
   FORUM HEADER
   =================================== */
.forum-header {
    background: linear-gradient(135deg, #3da829 0%, #349422 30%, #2f8a1e 60%, #2a7d1a 100%);
    border-radius: clamp(8px, 1.5vw, 16px);
    padding: clamp(1.25rem, 3vw, 2rem);
    margin-bottom: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(58, 158, 40, 0.25), 0 4px 8px rgba(0, 0, 0, 0.1);
}
.forum-header > * {
    position: relative;
    z-index: 1;
}
.forum-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    pointer-events: none;
}
.forum-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}
.forum-header h4,
[data-theme="light"] .forum-header h4,
[data-theme="dark"] .forum-header h4 {
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.forum-header h4 i,
[data-theme="light"] .forum-header h4 i,
[data-theme="dark"] .forum-header h4 i {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff;
}
.forum-header p,
[data-theme="light"] .forum-header p,
[data-theme="dark"] .forum-header p {
    color: rgba(255,255,255,0.95) !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    margin-bottom: 0;
    font-size: 0.9rem;
}
.forum-header .btn-light,
[data-theme="dark"] .forum-header .btn-light {
    position: relative;
    z-index: 1;
    background-color: #ffffff !important;
    border-color: #ffffff !important;
    color: #2D7E1F !important;
}
.forum-header .btn-light:hover,
[data-theme="dark"] .forum-header .btn-light:hover {
    background-color: #f0f8f0 !important;
    border-color: #f0f8f0 !important;
    color: #216118 !important;
}

/* ===================================
   SEARCH BAR
   =================================== */
.forum-search {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: clamp(8px, 1.5vw, 12px);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}
.forum-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: stretch;
}
.forum-search-input {
    flex: 1 1 240px;
    min-width: 0;
}
.forum-search-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 140px;
}
.forum-search-submit,
.forum-search-clear {
    flex: 0 0 auto;
}
.forum-search .form-control {
    border: none;
    box-shadow: none;
    font-size: 0.95rem;
    background: transparent;
    color: var(--text-primary);
}
.forum-search .form-control:focus {
    box-shadow: none;
}
.forum-search .form-control::placeholder {
    color: var(--text-muted);
}
.forum-search .input-group-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
}
.forum-search .form-select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}
.forum-search .form-select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 0.2rem var(--input-focus-shadow);
}

/* ===================================
   TOPIC PILLS
   =================================== */
.topic-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.topic-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: var(--bg-hover);
    color: var(--text-primary);
    cursor: pointer;
}
.topic-pill i {
    font-size: 0.75rem;
}
.topic-pill.active {
    color: #fff;
    border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
    .topic-pill:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-sm);
        background: var(--olive-tint-20);
        color: var(--olive-darker);
    }
}

/* ===================================
   SORT TABS
   =================================== */
.sort-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.25rem;
    margin-bottom: 1.25rem;
}
.sort-tab {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.sort-tab.active {
    background: var(--bg-card);
    color: var(--olive-primary);
    box-shadow: var(--shadow-sm);
}

@media (hover: hover) and (pointer: fine) {
    .sort-tab:hover {
        color: var(--text-primary);
        background: rgba(255,255,255,0.5);
    }
}

[data-theme="dark"] .sort-tab:hover {
    background: rgba(255,255,255,0.05);
}

/* ===================================
   QUESTION CARD
   =================================== */
.question-card {
    background: var(--bg-card);
    border-radius: clamp(8px, 1.5vw, 12px);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
    display: flex;
    gap: 1rem;
    border: 1px solid var(--border-color);
}

@media (hover: hover) and (pointer: fine) {
    .question-card:hover {
        box-shadow: var(--shadow-olive);
        border-color: var(--border-dark);
    }
}

/* Vote column in card */
.question-vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    padding-top: 0.25rem;
}
.question-vote-col .vote-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.question-vote-col .vote-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stats column */
.question-stats-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    padding-top: 0.25rem;
}
.question-stats-col.has-accepted {
    background: var(--olive-alpha-10);
    border-radius: 8px;
    padding: 0.35rem 0.5rem;
}
.question-stats-col .stat-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.question-stats-col .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.question-stats-col.has-accepted .stat-count,
.question-stats-col.has-accepted .stat-label {
    color: var(--olive-primary);
}

/* Question content */
.question-content {
    flex: 1;
    min-width: 0;
}
.question-content .question-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    margin-bottom: 0.35rem;
    line-height: 1.4;
}
.question-content .question-excerpt {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (hover: hover) and (pointer: fine) {
    .question-content .question-title:hover {
        color: var(--olive-primary);
    }
}

/* Question meta */
.question-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}
.question-meta .author-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.question-meta .author-info .author-name {
    white-space: nowrap;
}
.question-meta .author-info img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}
.question-meta .author-name {
    color: var(--text-primary);
    font-weight: 500;
    text-decoration: none;
}
.question-meta .topic-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
}
.question-meta .view-count {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

@media (hover: hover) and (pointer: fine) {
    .question-meta .author-name:hover {
        color: var(--olive-primary);
    }
}

/* ===================================
   FORUM VOTE COMPONENT (Livewire)
   =================================== */
.forum-vote-container button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.15rem 0.5rem;
    line-height: 1;
    transition: all 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
    .forum-vote-container button:hover {
        transform: scale(1.15);
    }
}

/* ===================================
   SHOW PAGE — Question Detail
   =================================== */
.question-detail {
    background: var(--bg-card);
    border-radius: clamp(8px, 1.5vw, 12px);
    padding: clamp(1rem, 3vw, 1.5rem);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.question-detail .question-title-main {
    font-size: clamp(1.15rem, 3vw, 1.4rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}
.question-detail .question-body {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===================================
   ANSWER CARD
   =================================== */
.answer-card {
    background: var(--bg-card);
    border-radius: clamp(8px, 1.5vw, 12px);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 1rem;
}
.answer-card.accepted {
    border-color: var(--olive-primary);
    border-width: 2px;
    background: linear-gradient(135deg, var(--olive-alpha-05) 0%, var(--bg-card) 100%);
}
.answer-card .answer-body {
    font-size: 0.93rem;
    color: var(--text-primary);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Accepted badge */
.accepted-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--olive-alpha-15);
    color: var(--olive-primary);
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Reputation badge */
.reputation-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    font-weight: 600;
    color: #fff;
}

/* ===================================
   ANSWER FORM
   =================================== */
.answer-form {
    background: var(--bg-card);
    border-radius: clamp(8px, 1.5vw, 12px);
    padding: clamp(1rem, 3vw, 1.5rem);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}
.answer-form textarea {
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--input-text);
    resize: vertical;
}
.answer-form textarea:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 0.2rem var(--input-focus-shadow);
}

/* ===================================
   ASK QUESTION FORM
   =================================== */
.ask-form .form-control,
.ask-form .form-select {
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--input-text);
}
.ask-form .form-control:focus,
.ask-form .form-select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 0.2rem var(--input-focus-shadow);
}

/* ===================================
   EMPTY STATE
   =================================== */
.forum-empty {
    text-align: center;
    padding: clamp(3rem, 6vw, 4.5rem) 2rem;
    background: var(--bg-card);
    border-radius: clamp(8px, 1.5vw, 12px);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.forum-empty .forum-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--olive-alpha-10) 0%, rgba(58, 158, 40, 0.05) 100%);
    color: var(--olive-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    margin-bottom: 1.25rem;
    border: 2px dashed rgba(58, 158, 40, 0.2);
}
.forum-empty h5 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}
.forum-empty p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}
.forum-empty .forum-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.25rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #349422 0%, var(--olive-primary) 50%, #2D7E1F 100%);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(58, 158, 40, 0.25);
}

@media (hover: hover) and (pointer: fine) {
    .forum-empty .forum-empty-cta:hover {
        background: linear-gradient(135deg, var(--olive-primary) 0%, #2D7E1F 50%, #216118 100%);
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(58, 158, 40, 0.35);
    }
}

/* ===================================
   REPORT MODAL
   =================================== */
.report-reasons label {
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: background 0.15s;
}

@media (hover: hover) and (pointer: fine) {
    .report-reasons label:hover {
        background: var(--bg-hover);
    }
}

/* ===================================
   DARK MODE OVERRIDES
   =================================== */
[data-theme="dark"] .forum-header {
    background: linear-gradient(135deg, #2a3520 0%, #1f2a18 100%) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
[data-theme="dark"] .forum-header::before,
[data-theme="dark"] .forum-header::after {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 60%);
}

[data-theme="dark"] .question-card,
[data-theme="dark"] .answer-card,
[data-theme="dark"] .question-detail,
[data-theme="dark"] .answer-form {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@media (hover: hover) and (pointer: fine) {
    [data-theme="dark"] .question-card:hover {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        border-color: var(--border-dark);
    }
}

[data-theme="dark"] .answer-card.accepted {
    border-color: var(--olive-primary);
    background: linear-gradient(135deg, var(--olive-alpha-08) 0%, var(--bg-card) 100%);
}

[data-theme="dark"] .forum-search {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .sort-tabs {
    background: var(--bg-tertiary);
}
[data-theme="dark"] .sort-tab {
    color: var(--text-muted);
}
[data-theme="dark"] .sort-tab.active {
    background: var(--bg-card);
    color: var(--olive-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .topic-pill {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="dark"] .accepted-badge {
    background: var(--olive-alpha-20);
    color: var(--olive-light);
}

[data-theme="dark"] .forum-empty {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .forum-empty .forum-empty-icon {
    background: linear-gradient(135deg, rgba(58, 158, 40, 0.15) 0%, rgba(58, 158, 40, 0.06) 100%);
    border-color: rgba(58, 158, 40, 0.25);
}
[data-theme="dark"] .forum-empty .forum-empty-cta {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .forum-search .form-select {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .sort-tabs {
    border-color: var(--border-color);
}

/* ===================================
   MOBILE RESPONSIVENESS
   =================================== */
@media (max-width: 767.98px) {
    .forum-header {
        padding: 1.25rem;
    }
    .question-card {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }
    .question-vote-col,
    .question-stats-col {
        flex-direction: row;
        gap: 0.5rem;
        min-width: auto;
    }
    .sort-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .question-detail .question-title-main {
        font-size: 1.15rem;
    }
    .answer-card {
        gap: 0.75rem;
        padding: 1rem;
    }
    .answer-card > .d-flex.flex-column.align-items-center {
        min-width: 44px !important;
    }
    .question-meta {
        gap: 0.5rem;
    }
    .topic-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }
    .forum-search-form {
        flex-direction: column;
        gap: 0.625rem;
    }
    .forum-search-input,
    .forum-search-select,
    .forum-search-submit,
    .forum-search-clear {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }
}
