/* 戻るボタンコンポーネント CSS */

.back-button-container {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.back-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    border: none;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.back-button:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.back-button:active {
    transform: translateY(1px);
}

/* プライマリ variant */
.back-button.bg-blue-600 {
    background-color: #2563eb;
    color: white;
}

.back-button.bg-blue-600:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.back-button.bg-blue-600:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* セカンダリ variant */
.back-button.bg-gray-600 {
    background-color: #4b5563;
    color: white;
}

.back-button.bg-gray-600:hover {
    background-color: #374151;
    box-shadow: 0 4px 12px rgba(75, 85, 99, 0.3);
}

.back-button.bg-gray-600:focus {
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.5);
}

/* アウトライン variant */
.back-button.border-blue-600 {
    border: 2px solid #2563eb;
    background-color: white;
    color: #2563eb;
}

.back-button.border-blue-600:hover {
    background-color: #eff6ff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.back-button.border-blue-600:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* ゴースト variant */
.back-button.text-blue-600 {
    background-color: transparent;
    color: #2563eb;
}

.back-button.text-blue-600:hover {
    background-color: #eff6ff;
}

.back-button.text-blue-600:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* 履歴戻るボタン */
.back-button-history {
    border: 2px solid #d1d5db;
    background-color: white;
    color: #4b5563;
}

.back-button-history:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.15);
}

.back-button-history:focus {
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.5);
}

.back-button-history:active {
    background-color: #f3f4f6;
}

/* アイコンとテキストのスペーシング */
.back-button svg {
    flex-shrink: 0;
    transition: transform 0.2s ease-in-out;
}

.back-button:hover svg {
    transform: translateX(-2px);
}

.back-button-history:hover svg {
    transform: translateX(-3px);
}

.back-button-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* スクリーンリーダー専用テキスト */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* サイズバリエーション */
.back-button.px-3 {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.back-button.px-4 {
    padding: 0.625rem 1rem;
    font-size: 1rem;
}

.back-button.px-6 {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

/* レスポンシブ対応 */
@media (max-width: 640px) {
    .back-button-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .back-button,
    .back-button-history {
        width: 100%;
        justify-content: center;
    }
    
    .back-button-history {
        margin-left: 0;
    }
    
    .back-button-text {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .back-button-container {
        position: sticky;
        top: 0;
        z-index: 10;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(8px);
        padding: 0.5rem;
        margin: -0.5rem -1rem 1rem -1rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .back-button,
    .back-button-history {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .back-button-container {
        background-color: rgba(17, 24, 39, 0.95);
    }
    
    .back-button.border-blue-600 {
        background-color: #111827;
        border-color: #3b82f6;
        color: #60a5fa;
    }
    
    .back-button.border-blue-600:hover {
        background-color: #1e3a8a;
    }
    
    .back-button.text-blue-600 {
        color: #60a5fa;
    }
    
    .back-button.text-blue-600:hover {
        background-color: #1e3a8a;
    }
    
    .back-button-history {
        background-color: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .back-button-history:hover {
        background-color: #4b5563;
        border-color: #6b7280;
    }
}

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .back-button {
        border-width: 2px;
    }
    
    .back-button:focus {
        outline: 3px solid currentColor;
        outline-offset: 2px;
    }
}

/* アニメーション軽減設定対応 */
@media (prefers-reduced-motion: reduce) {
    .back-button,
    .back-button svg,
    .back-button-history {
        transition: none;
    }
    
    .back-button:active {
        transform: none;
    }
    
    .back-button:hover svg,
    .back-button-history:hover svg {
        transform: none;
    }
}

/* フォーカス表示の向上 */
.back-button:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.back-button-history:focus-visible {
    outline: 2px solid #6b7280;
    outline-offset: 2px;
}

/* 読み込み状態 */
.back-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.back-button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}