/* =========================================================================
   AskSphere — Answers
   ========================================================================= */

/* ---------- Answer form ---------- */
.as-answer-form {
    margin: 32px 0 40px;
    padding: 22px;
    background: #fff;
    border: 1px solid #e8ecf3;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 12px 28px -18px rgba(15,23,42,.15);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: #0f172a;
}
.as-answer-form__head {
    margin: 0 0 16px;
}
.as-answer-form__author {
    display: flex;
    align-items: center;
    gap: 12px;
}
.as-answer-form__avatar {
    border-radius: 50%;
    flex-shrink: 0;
}
.as-answer-form__author strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.as-answer-form__author small {
    display: block;
    margin-top: 2px;
    color: #7a8699;
    font-size: 12px;
}

.as-answer-form__editor {
    border: 1px solid #dfe3ec;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.as-answer-form__editor:focus-within {
    border-color: #315cf5;
    box-shadow: 0 0 0 3px rgba(49,92,245,.12);
}

.as-editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 6px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #edf0f5;
}
.as-editor-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
.as-editor-btn:hover {
    background: #eef2f7;
    color: #315cf5;
}
.as-editor-divider {
    width: 1px;
    height: 18px;
    background: #e2e8f0;
    margin: 0 6px;
}
.as-editor-area {
    min-height: 140px;
    max-height: 400px;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 15px;
    line-height: 1.65;
    color: #0f172a;
    outline: none;
}
.as-editor-area:empty::before {
    content: attr(data-placeholder);
    color: #9aa2b1;
    pointer-events: none;
}
.as-editor-area blockquote {
    margin: 8px 0;
    padding: 10px 14px;
    border-left: 3px solid #315cf5;
    background: #f7f9ff;
    border-radius: 0 6px 6px 0;
}
.as-editor-area pre {
    padding: 12px 14px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 8px;
    overflow-x: auto;
    font-family: ui-monospace, monospace;
    font-size: 13px;
}
.as-editor-area a {
    color: #315cf5;
    text-decoration: underline;
}

.as-answer-form__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 0;
}
.as-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e8ecf3;
    background: #f8fafc;
}
.as-thumb img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.as-thumb__remove {
    position: absolute;
    top: 2px; right: 2px;
    width: 20px; height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(15,23,42,.75);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}
.as-thumb__remove:hover { background: #dc2626; }

.as-answer-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 0;
}
.as-answer-form__hint {
    margin: 0;
    color: #7a8699;
    font-size: 12px;
}
.as-answer-form__alert {
    margin: 12px 0 0;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid transparent;
}
.as-answer-form__alert.is-error {
    background: #fff5f5;
    border-color: #ffd9dd;
    color: #8f1d2a;
}
.as-answer-form__alert.is-success {
    background: #eefaf1;
    border-color: #b6ebc5;
    color: #15794a;
}

.as-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
    font-family: inherit;
}
.as-btn--primary {
    background: #315cf5;
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(49,92,245,.55);
}
.as-btn--primary:hover { background: #2547c9; transform: translateY(-1px); }
.as-btn:disabled { opacity: .65; cursor: wait; transform: none; }

/* ---------- Answers list ---------- */
.as-answers-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 0 24px;
}
.as-answers-empty {
    padding: 32px 24px;
    background: #f8fafc;
    border: 1px dashed #d8dfeb;
    border-radius: 14px;
    text-align: center;
    color: #7a8699;
    font-size: 14px;
}
.as-answers-empty p { margin: 0; }

/* ---------- Answer card ---------- */
.as-answer-card {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 16px;
    padding: 20px 22px;
    background: #fff;
    border: 1px solid #e8ecf3;
    border-radius: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.as-answer-card:hover {
    border-color: #d8dfeb;
    box-shadow: 0 8px 22px -12px rgba(15,23,42,.2);
}

.as-answer-card__votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.as-vote-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #e8ecf3;
    border-radius: 9px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: background .12s ease, border-color .12s ease, color .12s ease, transform .12s ease;
}
.as-vote-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #315cf5;
    border-color: #d5deea;
}
.as-vote-btn:disabled { opacity: .4; cursor: not-allowed; }
.as-vote-btn.is-active-up {
    background: #eef2ff;
    border-color: #b6c4ff;
    color: #315cf5;
}
.as-vote-btn.is-active-down {
    background: #fff0f1;
    border-color: #ffc9ce;
    color: #b42332;
}
.as-answer-card__score {
    color: #0f172a;
    font-size: 15px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    line-height: 1;
}

.as-answer-card__main { min-width: 0; }
.as-answer-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 12px;
}
.as-answer-card__author {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.as-answer-card__avatar {
    border-radius: 50%;
    flex-shrink: 0;
}
.as-answer-card__author strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}
.as-answer-card__author small {
    display: block;
    margin-top: 2px;
    color: #7a8699;
    font-size: 12px;
}
.as-answer-card__admin { flex-shrink: 0; }
.as-admin-remove-btn {
    padding: 4px 10px;
    border: 1px solid #ffd9dd;
    border-radius: 7px;
    background: #fff5f5;
    color: #b42332;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.as-admin-remove-btn:hover { background: #ffe4e6; }

.as-answer-card__content {
    color: #1e293b;
    font-size: 15px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}
.as-answer-card__content p { margin: 0 0 14px; }
.as-answer-card__content p:last-child { margin-bottom: 0; }
.as-answer-card__content blockquote {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-left: 3px solid #315cf5;
    background: #f7f9ff;
    border-radius: 0 6px 6px 0;
}
.as-answer-card__content code {
    padding: 2px 6px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: .9em;
    font-family: ui-monospace, monospace;
}
.as-answer-card__content pre {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13px;
}
.as-answer-card__content pre code { background: transparent; padding: 0; color: inherit; }
.as-answer-card__content a { color: #315cf5; text-decoration: underline; }

.as-answer-card__foot {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 16px 0 0;
    padding: 12px 0 0;
    border-top: 1px solid #f1f5f9;
}
.as-answer-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
    font-family: inherit;
}
.as-answer-action:hover {
    background: #f1f5f9;
    color: #315cf5;
}
.as-answer-action__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #eef2f7;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

/* ---------- Image grid ---------- */
.as-image-grid {
    display: grid;
    gap: 6px;
    margin: 14px 0 0;
}
.as-image-grid--single { grid-template-columns: 1fr; max-width: 520px; }
.as-image-grid--duo    { grid-template-columns: repeat(2, 1fr); }
.as-image-grid--multi  { grid-template-columns: repeat(3, 1fr); }

.as-image-grid__item {
    position: relative;
    padding: 0;
    border: 1px solid #e8ecf3;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    cursor: zoom-in;
    transition: transform .12s ease, border-color .12s ease;
}
.as-image-grid__item:hover {
    transform: scale(1.01);
    border-color: #d8dfeb;
}
.as-image-grid__item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 4 / 3;
}
.as-image-grid--single .as-image-grid__item img {
    aspect-ratio: 16 / 9;
}
.as-image-grid--duo .as-image-grid__item img {
    aspect-ratio: 1 / 1;
}

@media (max-width: 640px) {
    .as-answer-card {
        grid-template-columns: 44px minmax(0, 1fr);
        padding: 16px;
        gap: 12px;
    }
    .as-vote-btn { width: 30px; height: 30px; }
    .as-answer-form__footer {
        flex-direction: column;
        align-items: stretch;
    }
    .as-answer-form__footer .as-btn { width: 100%; }
    .as-image-grid--multi { grid-template-columns: repeat(2, 1fr); }
}