// ============================================
// ADMIN FAQ - Mobile-First Compact Design
// ============================================
@import '../admin-shared.scss';

.admin-faq {
    min-height: 100%;
    padding: $admin-space-md;
    padding-bottom: calc($admin-space-md + 80px);
    animation: pageEnter 0.4s ease-out;

    @media (min-width: 768px) {
        padding: $admin-space-lg;
        padding-bottom: $admin-space-lg;
    }

    .container {
        max-width: $admin-container-lg;
        margin: 0 auto;
    }
}

// ============================================
// HEADER
// ============================================
.admin-faq__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: $admin-space-sm;
    margin-bottom: $admin-space-md;
    animation: fadeIn 0.3s ease-out;

    @media (max-width: 480px) {
        flex-direction: column;
        align-items: stretch;
    }
}

.header-info {
    display: flex;
    gap: $admin-space-2xs;
    flex-wrap: wrap;
}

.badge {
    padding: 4px $admin-space-xs;
    border-radius: $radius-full;
    font-size: 0.6875rem;
    font-weight: 600;
    background: $color-gray-100;
    color: $color-text-secondary;

    &--success {
        background: rgba($accent-green, 0.1);
        color: $accent-green;
    }
}

.header-actions {
    display: flex;
    gap: $admin-space-2xs;
    flex-wrap: wrap;
}

// ============================================
// STATES
// ============================================
.loading-state,
.empty-state {
    text-align: center;
    padding: $admin-space-2xl;
    background: $glass-bg;
    border-radius: $radius-md;
    animation: fadeIn 0.3s ease-out;

    .material-symbols-outlined,
    app-icon {
        font-size: 2.5rem;
        color: $color-gray-300;
        margin-bottom: $admin-space-sm;
    }

    h3 {
        margin: 0 0 $admin-space-2xs;
        font-size: 1rem;
        color: $color-text-primary;
    }

    p {
        color: $color-text-tertiary;
        font-size: 0.8125rem;
        margin-bottom: $admin-space-sm;
    }
}

.empty-actions {
    display: flex;
    gap: $admin-space-xs;
    justify-content: center;
    flex-wrap: wrap;
}

// ============================================
// FAQ LIST
// ============================================
.faq-list {
    display: grid;
    gap: $admin-space-xs;
}

.faq-card {
    background: $glass-bg;
    border: 1px solid $glass-border;
    border-radius: $radius-md;
    padding: $admin-space-sm;
    transition: all 0.2s ease;
    animation: staggerFade 0.3s ease-out backwards;

    @for $i from 1 through 30 {
        &:nth-child(#{$i}) {
            animation-delay: #{$i * 30}ms;
        }
    }

    &:hover {
        box-shadow: $shadow-sm;
        border-color: rgba($color-brand-primary, 0.2);
    }

    &--editing {
        border-color: $color-brand-primary;
        box-shadow: 0 0 0 3px rgba($color-brand-primary, 0.1);
    }

    &--inactive {
        opacity: 0.6;
    }
}

.faq-card__header {
    display: flex;
    align-items: flex-start;
    gap: $admin-space-sm;
    margin-bottom: $admin-space-xs;

    @media (max-width: 480px) {
        flex-direction: column;
        gap: $admin-space-xs;
    }
}

.faq-card__drag {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: $color-text-tertiary;
    cursor: grab;
    flex-shrink: 0;

    &:active {
        cursor: grabbing;
    }

    app-icon {
        font-size: 1rem;
    }
}

.faq-card__content {
    flex: 1;
    min-width: 0;
}

.faq-card__question {
    font-size: 0.875rem;
    font-weight: 600;
    color: $color-text-primary;
    margin: 0 0 $admin-space-2xs;
    line-height: 1.4;
}

.faq-card__answer {
    font-size: 0.75rem;
    color: $color-text-secondary;
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.faq-card__meta {
    display: flex;
    align-items: center;
    gap: $admin-space-xs;
    margin-top: $admin-space-xs;
    flex-wrap: wrap;
}

.faq-card__category {
    padding: 3px 6px;
    background: rgba($color-brand-primary, 0.1);
    border-radius: $radius-sm;
    font-size: 0.625rem;
    font-weight: 600;
    color: $color-brand-primary;
}

.faq-card__status {
    padding: 3px 6px;
    border-radius: $radius-sm;
    font-size: 0.625rem;
    font-weight: 600;

    &--active {
        background: rgba($accent-green, 0.1);
        color: $accent-green;
    }

    &--inactive {
        background: rgba($color-gray-400, 0.1);
        color: $color-gray-500;
    }
}

.faq-card__actions {
    display: flex;
    gap: $admin-space-2xs;
    flex-shrink: 0;

    @media (max-width: 480px) {
        width: 100%;
        padding-top: $admin-space-xs;
        border-top: 1px solid $border-default;
        justify-content: flex-end;
    }
}

// ============================================
// ACTION BUTTONS
// ============================================
.btn-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: $radius-sm;
    color: $color-text-tertiary;
    cursor: pointer;
    transition: all 0.15s ease;

    app-icon {
        font-size: 0.9375rem;
    }

    &:hover {
        background: $color-gray-100;
        color: $color-text-primary;
    }

    &--edit:hover {
        background: rgba($accent-blue, 0.1);
        color: $accent-blue;
    }

    &--delete:hover {
        background: rgba($accent-red, 0.1);
        color: $accent-red;
    }

    &:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: $admin-space-xs $admin-space-sm;
    border-radius: $radius-sm;
    font-weight: 600;
    font-size: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;

    app-icon {
        font-size: 0.9375rem;
    }

    &--primary {
        background: $gradient-primary;
        color: white;

        &:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba($color-brand-primary, 0.3);
        }
    }

    &--secondary {
        background: $color-gray-100;
        color: $color-text-secondary;

        &:hover {
            background: $color-gray-200;
        }
    }

    &--ghost {
        background: transparent;
        color: $color-brand-primary;

        &:hover {
            background: rgba($color-brand-primary, 0.08);
        }
    }

    &--success {
        background: $accent-green;
        color: white;

        &:hover {
            background: darken($accent-green, 6%);
        }
    }

    &--danger {
        background: rgba($accent-red, 0.1);
        color: $accent-red;

        &:hover {
            background: rgba($accent-red, 0.15);
        }
    }
}

// ============================================
// EDIT FORM
// ============================================
.faq-edit-form {
    display: flex;
    flex-direction: column;
    gap: $admin-space-sm;
}

.form-group {
    label {
        display: block;
        font-size: 0.6875rem;
        font-weight: 600;
        color: $color-text-secondary;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        margin-bottom: 4px;
    }
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: $admin-space-xs $admin-space-sm;
    background: white;
    border: 1px solid $border-default;
    border-radius: $radius-sm;
    font-size: 0.8125rem;
    color: $color-text-primary;
    transition: all 0.15s ease;

    &:focus {
        outline: none;
        border-color: $color-brand-primary;
        box-shadow: 0 0 0 3px rgba($color-brand-primary, 0.1);
    }
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: $admin-space-sm;

    @media (max-width: 480px) {
        grid-template-columns: 1fr;
    }
}

.edit-actions {
    display: flex;
    gap: $admin-space-xs;
    justify-content: flex-end;
    padding-top: $admin-space-xs;
    border-top: 1px solid $border-default;
}

// ============================================
// ADD NEW CARD
// ============================================
.add-card {
    background: rgba($color-brand-primary, 0.03);
    border: 2px dashed rgba($color-brand-primary, 0.2);
    border-radius: $radius-md;
    padding: $admin-space-md;
    animation: fadeIn 0.3s ease-out;
}

.add-card__header {
    display: flex;
    align-items: center;
    gap: $admin-space-xs;
    margin-bottom: $admin-space-sm;

    app-icon {
        font-size: 1.25rem;
        color: $color-brand-primary;
    }

    h3 {
        font-size: 0.9375rem;
        font-weight: 600;
        color: $color-text-primary;
        margin: 0;
    }
}

// ============================================
// CATEGORY FILTER
// ============================================
.category-filter {
    display: flex;
    gap: $admin-space-2xs;
    margin-bottom: $admin-space-md;
    overflow-x: auto;
    padding-bottom: $admin-space-2xs;
    scrollbar-width: none;
    animation: fadeIn 0.3s ease-out 0.05s backwards;

    &::-webkit-scrollbar {
        display: none;
    }
}

.filter-btn {
    padding: $admin-space-xs $admin-space-sm;
    background: $glass-bg;
    border: 1px solid $glass-border;
    border-radius: $radius-sm;
    font-size: 0.75rem;
    font-weight: 600;
    color: $color-text-secondary;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;

    &:hover {
        border-color: $color-brand-primary;
        color: $color-brand-primary;
    }

    &--active {
        background: $gradient-primary;
        border-color: transparent;
        color: white;
    }
}

// ============================================
// MODAL
// ============================================
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(black, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: $admin-space-md;
    animation: fadeIn 0.2s ease-out;
}

.modal {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: white;
    border-radius: $radius-lg;
    box-shadow: $shadow-xl;
    overflow: hidden;
    animation: scaleIn 0.25s ease-out;

    &__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: $admin-space-sm $admin-space-md;
        border-bottom: 1px solid $border-default;

        h2 {
            font-size: 1rem;
            font-weight: 700;
            color: $color-text-primary;
            margin: 0;
        }
    }

    &__body {
        padding: $admin-space-md;
        overflow-y: auto;
        max-height: calc(90vh - 120px);
    }

    &__footer {
        display: flex;
        gap: $admin-space-xs;
        padding: $admin-space-sm $admin-space-md;
        border-top: 1px solid $border-default;
        justify-content: flex-end;
    }

    &__close {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        border-radius: $radius-sm;
        color: $color-text-tertiary;
        cursor: pointer;
        transition: all 0.15s ease;

        &:hover {
            background: $color-gray-100;
            color: $color-text-primary;
        }
    }
}

// ============================================
// TOAST
// ============================================
.toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: $admin-space-sm $admin-space-md;
    background: $color-gray-900;
    color: white;
    border-radius: $radius-md;
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: $shadow-lg;
    z-index: 1000;
    animation: popIn 0.3s ease-out;

    &--success {
        background: $accent-green;
    }

    &--error {
        background: $accent-red;
    }

    @media (min-width: 768px) {
        bottom: $admin-space-lg;
    }
}

// ============================================
// RESPONSIVE
// ============================================
@media (max-width: 640px) {
    .admin-faq {
        padding: $admin-space-sm;
        padding-bottom: calc($admin-space-sm + 80px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
