/* ==========================================================================
   全局 Toast 悬浮提示框样式
   ========================================================================== */
.toast {
    position: fixed;
    top: 90px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 12px 30px rgba(15, 36, 64, 0.22);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: min(420px, calc(100vw - 32px));
    line-height: 1.5;
    animation: toastSlide 0.4s ease;
}

.toast.success { background: linear-gradient(135deg, var(--success-color, #48bb78) 0%, #38a169 100%); }
.toast.error { background: linear-gradient(135deg, var(--error-color, #fc8181) 0%, #e53e3e 100%); }
.toast.info { background: linear-gradient(135deg, var(--primary-color, #1a365d) 0%, var(--primary-light, #2c5282) 100%); }

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

@media (max-width: 768px) {
    .toast {
        top: 78px;
        right: 16px;
        left: 16px;
        max-width: none;
    }
}

body.feedback-widget-open {
    overflow: hidden;
}

.feedback-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9500;
}

.feedback-widget__fab {
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color, #1a365d) 0%, var(--primary-light, #2c5282) 100%);
    box-shadow: 0 18px 36px rgba(15, 36, 64, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feedback-widget__fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 42px rgba(15, 36, 64, 0.32);
}

.feedback-widget__fab:focus-visible,
.feedback-widget__close:focus-visible,
.feedback-widget__submit:focus-visible,
.feedback-widget__type-option:focus-within {
    outline: 3px solid rgba(44, 82, 130, 0.24);
    outline-offset: 2px;
}

.feedback-widget__fab svg {
    width: 28px;
    height: 28px;
}

.feedback-widget__overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 36, 64, 0.34);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
}

.feedback-widget__panel {
    position: fixed;
    right: 24px;
    bottom: 98px;
    width: min(380px, calc(100vw - 32px));
    max-height: min(76vh, 720px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    border: 1px solid rgba(15, 36, 64, 0.08);
    border-radius: 22px;
    color: var(--text-dark, #1a202c);
    background:
        radial-gradient(circle at top right, rgba(212, 165, 74, 0.12), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: 0 24px 54px rgba(15, 36, 64, 0.22);
    opacity: 0;
    transform: translateY(20px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.feedback-widget__panel[hidden] {
    display: none;
}

.feedback-widget.is-open .feedback-widget__overlay {
    opacity: 1;
    pointer-events: auto;
}

.feedback-widget.is-open .feedback-widget__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.feedback-widget__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.feedback-widget__title {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    color: var(--primary-color, #1a365d);
}

.feedback-widget__subtitle {
    margin: 6px 0 0;
    color: var(--text-medium, #4a5568);
    font-size: 13px;
    line-height: 1.6;
}

.feedback-widget__close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-medium, #4a5568);
    background: rgba(15, 36, 64, 0.06);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.feedback-widget__close:hover {
    color: var(--error-color, #fc8181);
    background: rgba(252, 129, 129, 0.12);
    transform: rotate(90deg);
}

.feedback-widget__form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-widget__group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.feedback-widget__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-medium, #4a5568);
}

.feedback-widget__required {
    color: var(--error-color, #fc8181);
}

.feedback-widget__types {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.feedback-widget__type-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px 12px;
    border: 1px solid rgba(15, 36, 64, 0.1);
    border-radius: 12px;
    background: #fff;
    color: var(--text-medium, #4a5568);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-widget__type-option input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.feedback-widget__type-option.is-selected {
    border-color: rgba(44, 82, 130, 0.45);
    color: var(--primary-color, #1a365d);
    background: rgba(44, 82, 130, 0.08);
    box-shadow: inset 0 0 0 1px rgba(44, 82, 130, 0.12);
}

.feedback-widget__input,
.feedback-widget__textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid rgba(15, 36, 64, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    color: var(--text-dark, #1a202c);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.feedback-widget__input::placeholder,
.feedback-widget__textarea::placeholder {
    color: var(--text-light, #718096);
}

.feedback-widget__input:focus,
.feedback-widget__textarea:focus {
    outline: none;
    border-color: rgba(44, 82, 130, 0.5);
    box-shadow: 0 0 0 4px rgba(44, 82, 130, 0.12);
    background: #fff;
}

.feedback-widget__textarea {
    min-height: 138px;
    resize: vertical;
}

.feedback-widget__meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--text-light, #718096);
    font-size: 12px;
}

.feedback-widget__counter.is-limit {
    color: var(--error-color, #fc8181);
}

.feedback-widget__actions {
    display: flex;
    justify-content: flex-end;
}

.feedback-widget__submit {
    min-width: 144px;
    height: 46px;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color, #1a365d) 0%, var(--primary-light, #2c5282) 100%);
    box-shadow: 0 10px 24px rgba(15, 36, 64, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.feedback-widget__submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15, 36, 64, 0.24);
}

.feedback-widget__submit:disabled {
    cursor: not-allowed;
    opacity: 0.68;
}

.feedback-widget__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: feedbackWidgetSpin 0.7s linear infinite;
}

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

@media (max-width: 768px) {
    .feedback-widget {
        right: 16px;
        bottom: 16px;
    }

    .feedback-widget__fab {
        width: 58px;
        height: 58px;
    }

    .feedback-widget__panel {
        right: 10px;
        left: 10px;
        bottom: 86px;
        width: auto;
        max-height: min(80vh, 680px);
        padding: 20px 18px;
        border-radius: 20px;
    }
}

@media (max-width: 540px) {
    .feedback-widget__panel {
        right: 0;
        left: 0;
        bottom: 0;
        max-height: min(82vh, 680px);
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
        border-radius: 22px 22px 0 0;
    }

    .feedback-widget__types {
        grid-template-columns: 1fr;
    }
}
