/**
 * FAQ Admin Module Styles
 * Dashboard panel for managing FAQ categories & items
 * v20260310-etap3
 */

/* ═══════════════════════════════════════════
   SECTION WRAPPER
   ═══════════════════════════════════════════ */
.faq-admin-section {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.faq-admin-section .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.faq-admin-section .section-header h2 {
    font-size: 1.8rem;
    color: #fff;
    margin: 0;
}

.faq-admin-section .header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════ */
.faq-admin-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid rgba(127, 255, 0, 0.15);
    margin-bottom: 2rem;
}

.faq-admin-tab {
    padding: 0.85rem 1.5rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color 0.3s, background 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.faq-admin-tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(127, 255, 0, 0.03);
}

.faq-admin-tab.active {
    color: #7FFF00;
    border-bottom-color: #7FFF00;
    background: rgba(127, 255, 0, 0.05);
}

.faq-admin-tab .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: rgba(127, 255, 0, 0.15);
    color: #7FFF00;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.faq-admin-panel {
    display: none;
}

.faq-admin-panel.active {
    display: block;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.faq-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
}

.faq-btn-primary {
    background: linear-gradient(135deg, #7FFF00, #6DE800);
    color: #0a1a1a;
}

.faq-btn-primary:hover {
    background: linear-gradient(135deg, #8FFF33, #7FFF00);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(127, 255, 0, 0.3);
}

.faq-btn-secondary {
    background: rgba(127, 255, 0, 0.1);
    color: #7FFF00;
    border: 1px solid rgba(127, 255, 0, 0.2);
}

.faq-btn-secondary:hover {
    background: rgba(127, 255, 0, 0.18);
    border-color: rgba(127, 255, 0, 0.35);
}

.faq-btn-danger {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
}

.faq-btn-danger:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: rgba(255, 68, 68, 0.4);
}

.faq-btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.faq-btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.faq-btn-icon:hover {
    background: rgba(127, 255, 0, 0.15);
    color: #7FFF00;
}

.faq-btn-icon.danger:hover {
    background: rgba(255, 68, 68, 0.15);
    color: #ff4444;
}

/* ═══════════════════════════════════════════
   STATS GRID
   ═══════════════════════════════════════════ */
.faq-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.faq-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(127, 255, 0, 0.1);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    transition: border-color 0.3s;
}

.faq-stat-card:hover {
    border-color: rgba(127, 255, 0, 0.25);
}

.faq-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #7FFF00;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.faq-stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════
   CATEGORIES GRID (Tab 1)
   ═══════════════════════════════════════════ */
.faq-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
}

.faq-cat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(127, 255, 0, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s;
    position: relative;
    cursor: grab;
}

.faq-cat-card:hover {
    border-color: rgba(127, 255, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.faq-cat-card.dragging {
    opacity: 0.5;
    border-color: #7FFF00;
    cursor: grabbing;
}

.faq-cat-card.drag-over {
    border-color: #7FFF00;
    background: rgba(127, 255, 0, 0.08);
}

.faq-cat-card.inactive {
    opacity: 0.5;
    border-style: dashed;
}

.faq-cat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.faq-cat-info {
    flex: 1;
}

.faq-cat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.faq-cat-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.faq-cat-slug {
    font-size: 0.75rem;
    color: rgba(127, 255, 0, 0.5);
    font-family: monospace;
}

.faq-cat-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0.5rem 0;
    line-height: 1.4;
}

.faq-cat-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.faq-cat-meta span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

.faq-cat-meta .count {
    color: #7FFF00;
    font-weight: 600;
}

.faq-cat-actions {
    display: flex;
    gap: 0.4rem;
}

.faq-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.faq-badge-active {
    background: rgba(127, 255, 0, 0.15);
    color: #7FFF00;
}

.faq-badge-inactive {
    background: rgba(255, 68, 68, 0.15);
    color: #ff6666;
}

.faq-badge-featured {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

/* ═══════════════════════════════════════════
   ITEMS TABLE (Tab 2)
   ═══════════════════════════════════════════ */
.faq-filters-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

.faq-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faq-filter-group label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.faq-filter-select,
.faq-filter-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #fff;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.faq-filter-select:focus,
.faq-filter-input:focus {
    border-color: rgba(127, 255, 0, 0.4);
}

.faq-filter-select option {
    background: #0f2a2a;
    color: #fff;
}

.faq-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.faq-table {
    width: 100%;
    border-collapse: collapse;
}

.faq-table thead {
    background: rgba(127, 255, 0, 0.05);
}

.faq-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.faq-table td {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

.faq-table tr {
    transition: background 0.2s;
    cursor: grab;
}

.faq-table tr:hover {
    background: rgba(127, 255, 0, 0.03);
}

.faq-table tr.dragging {
    opacity: 0.4;
    background: rgba(127, 255, 0, 0.08);
}

.faq-table tr.drag-over td {
    border-top: 2px solid #7FFF00;
}

.faq-question-cell {
    max-width: 350px;
}

.faq-question-text {
    font-weight: 500;
    color: #fff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.faq-answer-preview {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.faq-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border-radius: 100px;
    background: rgba(127, 255, 0, 0.1);
    color: #7FFF00;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.faq-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    padding: 0;
}

.faq-toggle.on {
    background: rgba(127, 255, 0, 0.4);
}

.faq-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.3s;
}

.faq-toggle.on::after {
    transform: translateX(18px);
}

.faq-actions-cell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════
   ANALYTICS TAB (Tab 3)
   ═══════════════════════════════════════════ */
.faq-analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.faq-analytics-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(127, 255, 0, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
}

.faq-analytics-card.full-width {
    grid-column: 1 / -1;
}

.faq-analytics-card h3 {
    font-size: 1rem;
    color: #fff;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faq-top-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.faq-top-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.faq-top-list li:last-child {
    border-bottom: none;
}

.faq-top-rank {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(127, 255, 0, 0.1);
    color: #7FFF00;
    font-size: 0.75rem;
    font-weight: 700;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.faq-top-question {
    flex: 1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.faq-top-views {
    font-size: 0.8rem;
    color: #7FFF00;
    font-weight: 600;
    white-space: nowrap;
    margin-left: 1rem;
}

.faq-breakdown-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.faq-breakdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.faq-breakdown-item:last-child {
    border-bottom: none;
}

.faq-breakdown-name {
    flex: 1;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.faq-breakdown-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    overflow: hidden;
}

.faq-breakdown-fill {
    height: 100%;
    background: linear-gradient(90deg, #7FFF00, #6DE800);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.faq-breakdown-count {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    min-width: 40px;
    text-align: right;
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */
.faq-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.faq-modal-overlay.visible {
    display: flex;
}

.faq-modal {
    background: #0f2a2a;
    border: 1px solid rgba(127, 255, 0, 0.2);
    border-radius: 16px;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.faq-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #fff;
}

.faq-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.faq-modal-close:hover {
    color: #ff4444;
}

.faq-modal-body {
    padding: 1.5rem;
}

.faq-form-group {
    margin-bottom: 1.25rem;
}

.faq-form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.4rem;
}

.faq-form-group label .required {
    color: #ff4444;
}

.faq-form-input,
.faq-form-select,
.faq-form-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #fff;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.faq-form-input:focus,
.faq-form-select:focus,
.faq-form-textarea:focus {
    border-color: rgba(127, 255, 0, 0.5);
}

.faq-form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.faq-form-select option {
    background: #0f2a2a;
    color: #fff;
}

.faq-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.faq-form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.faq-form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #7FFF00;
    cursor: pointer;
}

.faq-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ═══════════════════════════════════════════
   EMPTY STATE & LOADING
   ═══════════════════════════════════════════ */
.faq-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: rgba(255, 255, 255, 0.4);
}

.faq-empty-state .emoji {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.faq-empty-state p {
    font-size: 1rem;
    margin: 0;
}

.faq-loading-state {
    text-align: center;
    padding: 3rem;
}

.faq-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(127, 255, 0, 0.15);
    border-top-color: #7FFF00;
    border-radius: 50%;
    animation: faqAdminSpin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

/* ═══════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════ */
.faq-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.85rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    z-index: 100000;
    animation: faqToastIn 0.35s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.faq-toast.success {
    background: linear-gradient(135deg, #1a3a1a, #0f2a0f);
    border: 1px solid rgba(127, 255, 0, 0.3);
}

.faq-toast.error {
    background: linear-gradient(135deg, #3a1a1a, #2a0f0f);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.faq-toast.info {
    background: linear-gradient(135deg, #1a2a3a, #0f1a2a);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes faqToastIn {
    from { opacity: 0; transform: translateX(60px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════ */
.faq-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.faq-pagination button {
    min-width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.faq-pagination button:hover:not(:disabled) {
    border-color: rgba(127, 255, 0, 0.3);
    color: #7FFF00;
}

.faq-pagination button.active {
    background: rgba(127, 255, 0, 0.15);
    border-color: #7FFF00;
    color: #7FFF00;
    font-weight: 700;
}

.faq-pagination button:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ═══════════════════════════════════════════
   CONFIRM DIALOG
   ═══════════════════════════════════════════ */
.faq-confirm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.faq-confirm-overlay.visible {
    display: flex;
}

.faq-confirm-box {
    background: #0f2a2a;
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    text-align: center;
}

.faq-confirm-box .emoji {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.faq-confirm-box h4 {
    color: #fff;
    margin: 0 0 0.5rem 0;
}

.faq-confirm-box p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
    margin: 0 0 1.5rem 0;
}

.faq-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .faq-admin-section {
        padding: 1rem;
    }

    .faq-admin-tabs {
        overflow-x: auto;
    }

    .faq-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .faq-categories-grid {
        grid-template-columns: 1fr;
    }

    .faq-analytics-grid {
        grid-template-columns: 1fr;
    }

    .faq-filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .faq-form-row {
        grid-template-columns: 1fr;
    }

    .faq-modal {
        width: 98%;
        max-height: 95vh;
    }
}
