/* ============================================
   LW Support Widget
   スコープ: #lw-support-widget
   ============================================ */

/* フローティングボタン */
/* #14: safe-area-inset-bottom は bottom に適用 */
#lw-support-widget #lw-sw-trigger {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #4A90D9;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
    transition: background 0.2s, transform 0.2s;
}

#lw-support-widget #lw-sw-trigger:hover {
    background: #3a7bc8;
    transform: scale(1.05);
}

#lw-support-widget #lw-sw-trigger svg {
    width: 24px;
    height: 24px;
}

/* オーバーレイ */
#lw-support-widget #lw-sw-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99999;
}

/* ダイアログ */
#lw-support-widget #lw-sw-dialog {
    position: fixed;
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    right: 24px;
    width: 380px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    padding: 24px;
    box-sizing: border-box;
}

/* 閉じるボタン */
#lw-support-widget #lw-sw-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    line-height: 1;
}

#lw-support-widget #lw-sw-close:hover {
    background: #f0f0f0;
}

/* タイトル */
#lw-support-widget #lw-sw-title {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* カテゴリ選択 */
#lw-support-widget #lw-sw-categories {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

#lw-support-widget .lw-sw-cat-option {
    position: relative;
    cursor: pointer;
}

#lw-support-widget .lw-sw-cat-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

#lw-support-widget .lw-sw-cat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s;
    font-size: 14px;
    color: #333;
}

#lw-support-widget .lw-sw-cat-option input[type="radio"]:checked + .lw-sw-cat-label {
    border-color: #4A90D9;
    background: #f0f7ff;
}

#lw-support-widget .lw-sw-cat-option:not(.lw-sw-disabled):hover .lw-sw-cat-label {
    border-color: #b0b0b0;
}

#lw-support-widget .lw-sw-cat-icon {
    font-size: 18px;
    flex-shrink: 0;
}

#lw-support-widget .lw-sw-cat-text {
    font-weight: 500;
}

/* グレーアウト（無料ユーザー） */
#lw-support-widget .lw-sw-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#lw-support-widget .lw-sw-disabled .lw-sw-cat-label {
    background: #f5f5f5;
}

#lw-support-widget .lw-sw-premium-note {
    display: block;
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    padding-left: 12px;
}

#lw-support-widget .lw-sw-premium-note a {
    color: #4A90D9;
    text-decoration: none;
}

#lw-support-widget .lw-sw-premium-note a:hover {
    text-decoration: underline;
}

/* フォームフィールド */
#lw-support-widget .lw-sw-field {
    margin-bottom: 14px;
}

#lw-support-widget .lw-sw-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    margin-bottom: 4px;
}

#lw-support-widget .lw-sw-required {
    color: #e74c3c;
}

#lw-support-widget .lw-sw-field input[type="email"],
#lw-support-widget .lw-sw-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
    color: #333;
    background: #fff;
}

#lw-support-widget .lw-sw-field input[type="email"]:focus,
#lw-support-widget .lw-sw-field textarea:focus {
    outline: none;
    border-color: #4A90D9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.15);
}

#lw-support-widget .lw-sw-field textarea {
    resize: vertical;
    min-height: 100px;
}

#lw-support-widget #lw-sw-char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* エラーメッセージ */
#lw-support-widget #lw-sw-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* 送信ボタン */
#lw-support-widget #lw-sw-submit {
    width: 100%;
    padding: 12px;
    background: #4A90D9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#lw-support-widget #lw-sw-submit:hover {
    background: #3a7bc8;
}

#lw-support-widget #lw-sw-submit:disabled {
    background: #b0b0b0;
    cursor: not-allowed;
}

/* 送信完了 */
#lw-support-widget #lw-sw-success {
    text-align: center;
    padding: 20px 0;
}

#lw-support-widget .lw-sw-success-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #ecfdf5;
    color: #10b981;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

#lw-support-widget .lw-sw-success-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px;
}

#lw-support-widget .lw-sw-success-desc {
    font-size: 13px;
    color: #666;
    margin: 0 0 20px;
}

#lw-support-widget #lw-sw-done {
    padding: 10px 32px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

#lw-support-widget #lw-sw-done:hover {
    background: #e0e0e0;
}

/* モバイル対応 */
@media (max-width: 480px) {
    #lw-support-widget #lw-sw-dialog {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        padding: 20px 16px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    }

    #lw-support-widget #lw-sw-trigger {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: 16px;
        width: 48px;
        height: 48px;
    }

    #lw-support-widget #lw-sw-trigger svg {
        width: 20px;
        height: 20px;
    }
}
