/* ============================================================
   BricksDash — Discussion Button + Slide-in Panel
   ============================================================ */

.bd-discussion-button {
    --bd-disc-icon-gap: 8px;
    --bd-disc-badge-bg: #4f46e5;
    --bd-disc-badge-color: #ffffff;
    display: inline-flex;
    align-items: center;
    position: relative;
    cursor: pointer;
}

/* Hidden until quiz is submitted — JS removes this class on completion */
.bd-discussion-button.bd-disc-pending {
    display: none !important;
}

/* Reveal animation when quiz is completed */
.bd-discussion-button.bd-disc-reveal {
    animation: bd-disc-revealBtn 0.4s ease-out;
}

@keyframes bd-disc-revealBtn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Button Inner ──────────────────────────────────────────── */

.bd-disc-btn-inner {
    display: inline-flex;
    align-items: center;
    gap: var(--bd-disc-icon-gap);
}

.bd-disc-icon {
    font-size: 1.1em;
    line-height: 1;
}

.bd-disc-btn-text {
    font-weight: 500;
}

/* ── Count Badge ───────────────────────────────────────────── */

.bd-disc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    margin-left: 8px;
    border-radius: 999px;
    background: var(--bd-disc-badge-bg);
    color: var(--bd-disc-badge-color);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1;
}

/* ── Slide-in Panel Overlay ────────────────────────────────── */

.bd-disc-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 999999;
    animation: bd-disc-fadeIn 0.2s ease-out;
}

@keyframes bd-disc-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Panel ─────────────────────────────────────────────────── */

.bd-disc-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    background: #fff;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    animation: bd-disc-slideIn 0.25s ease-out;
    z-index: 1000000;
}

@keyframes bd-disc-slideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.bd-disc-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.bd-disc-panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 12px;
}

.bd-disc-panel-close {
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.bd-disc-panel-close:hover {
    background: #f3f4f6;
    color: #111827;
}

/* ── Panel Body ────────────────────────────────────────────── */

.bd-disc-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ── Spinner ───────────────────────────────────────────────── */

.bd-disc-spinner {
    width: 32px;
    height: 32px;
    margin: 40px auto;
    border: 3px solid #e5e7eb;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: bd-disc-spin 0.6s linear infinite;
}

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

/* ── Answer Sections (AnswerWall layout) ──────────────────── */

.bd-disc-section {
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid #e5e7eb;
}

.bd-disc-my-answer {
    background: #eef2ff;
    border-color: #4f46e5;
}

.bd-disc-peer-answer {
    background: #fff;
}

.bd-disc-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
    padding: 8px 0 6px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bd-disc-answer-detail {
    padding: 10px 12px;
    margin-top: 8px;
    background: #f9fafb;
    border-radius: 8px;
}

.bd-disc-answer-q {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 4px;
}

.bd-disc-answer-a {
    font-size: 0.875rem;
    color: #111827;
    margin: 0;
    line-height: 1.5;
}

.bd-disc-answer-text {
    font-size: 0.875rem;
    color: #374151;
    margin: 8px 0 0;
    line-height: 1.5;
}

.bd-disc-instructor-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: #4f46e5;
    font-style: normal;
    margin-left: 4px;
}

.bd-disc-replies {
    margin-top: 8px;
    padding-left: 20px;
    border-left: 2px solid #e5e7eb;
}

.bd-disc-empty-inline {
    text-align: center;
    font-size: 0.8125rem;
    color: #9ca3af;
    padding: 12px 0;
    margin: 0;
}

/* ── Comment Thread (rendered by JS) ──────────────────────── */

.bd-disc-comment {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.bd-disc-comment:last-child {
    border-bottom: none;
}

.bd-disc-comment-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.bd-disc-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.bd-disc-comment-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #111827;
}

.bd-disc-comment-time {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-left: auto;
}

.bd-disc-comment-body {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.55;
    padding-left: 42px;
}

.bd-disc-comment-instructor {
    background: #f0f5ff;
    border-radius: 8px;
    padding: 12px;
    margin-left: 42px;
    border-left: 3px solid #4f46e5;
}

/* ── Reply Form ────────────────────────────────────────────── */

.bd-disc-reply-form {
    display: flex;
    gap: 8px;
    padding: 16px 0 0;
    border-top: 1px solid #e5e7eb;
    margin-top: 12px;
}

.bd-disc-reply-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.bd-disc-reply-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.bd-disc-reply-submit {
    padding: 10px 20px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.bd-disc-reply-submit:hover {
    background: #4338ca;
}

.bd-disc-reply-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Empty State ───────────────────────────────────────────── */

.bd-disc-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.bd-disc-empty i {
    font-size: 2rem;
    margin-bottom: 12px;
    display: block;
    color: #d1d5db;
}

/* ── Continue Bar (shown after quiz completion) ───────────── */

.bd-disc-continue-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    margin-top: 16px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    animation: bd-disc-revealBtn 0.4s ease-out;
}

.bd-disc-continue-msg {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #166534;
}

.bd-disc-continue-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 22px;
    background: #16a34a;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.bd-disc-continue-btn:hover {
    background: #15803d;
    color: #fff !important;
}

/* ── Floating Toast (sessionStorage fallback) ─────────────── */

.bd-disc-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
    z-index: 999999;
    animation: bd-disc-toastIn 0.35s ease-out;
}

@keyframes bd-disc-toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bd-disc-toast-btn {
    padding: 6px 16px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.bd-disc-toast-btn:hover {
    background: #4338ca;
}

.bd-disc-toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.bd-disc-toast-close:hover {
    color: #fff;
}
