/* ===================================
歪み補正ツール専用スタイル v4
リセットボタンのhover制御改善版
=================================== */

/* ===================================
キャンバスコンテナ
=================================== */
.canvas-container {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 20px auto;
    border: 2px solid var(--gray-300);
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-100);
    text-align: center;
}

#baseCanvas,
#overlayCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

#baseCanvas {
    z-index: 1;
}

#overlayCanvas {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 2;
    pointer-events: none;
    cursor: default;
}

#overlayCanvas.draggable {
    cursor: move;
}

#overlayCanvas.dragging {
    cursor: grabbing;
}

/* 精密調整インジケータ */
.adjustment-indicator {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 12px;
    display: none;
    z-index: 10;
}

/* ===================================
検出感度コントロール
=================================== */
.sensitivity-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px auto;
    padding: 10px 20px;
    background: var(--gray-100);
    border-radius: 8px;
    max-width: 400px;
    justify-content: center;
}

.sensitivity-label {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 600;
}

.sensitivity-slider {
    flex: 1;
    max-width: 200px;
    height: 6px;
    background: var(--gray-300);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.sensitivity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all 0.3s;
}

.sensitivity-slider::-webkit-slider-thumb:hover {
    background: var(--accent-dark);
    transform: scale(1.2);
}

.sensitivity-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.sensitivity-value {
    font-size: 14px;
    color: var(--text-primary);
    min-width: 30px;
    text-align: right;
    font-weight: 600;
}

/* ===================================
アクションバー
=================================== */
.action-bar {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0 30px 0;
}

.action-bar-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.action-buttons {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.action-btn {
    padding: 12px 24px;
    border-radius: 6px;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 自動検出ボタン */
.auto-detect-btn {
    background: var(--accent);
    color: var(--primary);
}

.auto-detect-btn:hover:not(:disabled) {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.3);
}

/* 補正実行ボタン */
.correct-btn {
    background: var(--success);
    color: white;
}

.correct-btn:hover:not(:disabled) {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* ダウンロードボタン */
.download-btn {
    background: var(--info);
    color: white;
}

.download-btn:hover:not(:disabled) {
    background: var(--info-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 160, 133, 0.3);
}

/* リセットボタン - v4改善版 */
.reset-btn {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    transition: all 0.3s;
}

.reset-btn:hover:not(:disabled) {
    background: rgba(243, 156, 18, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.3);
}

.reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    border-color: var(--gray-500);
    color: var(--gray-500);
}

/* 全ボタン共通の無効状態 */
.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* 塗りつぶし系ボタンの無効状態 */
.auto-detect-btn:disabled,
.correct-btn:disabled,
.download-btn:disabled {
    background: var(--gray-500);
    color: var(--gray-300);
}

/* ===================================
出力設定コントロール
=================================== */
.output-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.control-group label i {
    font-size: 16px;
}

.output-select,
.quality-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s;
    min-width: 160px;
}

.output-select:focus,
.quality-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(243, 156, 18, 0.25);
}

/* ===================================
ステータス情報
=================================== */
.status-info {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    font-size: 14px;
    color: #856404;
}

.status-ready {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.status-processing {
    background: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

/* ===================================
処理中オーバーレイ
=================================== */
.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.processing-modal {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
}

.processing-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--gray-100);
    border-top: 5px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.processing-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.processing-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.processing-progress {
    width: 100%;
    height: 6px;
    background: var(--gray-300);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.processing-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s;
}

/* ===================================
レスポンシブ対応
=================================== */
@media (max-width: 768px) {
    .action-bar-content {
        flex-direction: column;
    }

    .action-buttons {
        width: 100%;
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .output-controls {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .control-group {
        width: 100%;
    }

    .output-select,
    .quality-select {
        width: 100%;
    }

    .canvas-container {
        width: 100%;
        max-width: 100%;
    }

    #baseCanvas,
    #overlayCanvas {
        width: 100%;
    }

    .sensitivity-control {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
    }

    .sensitivity-slider {
        max-width: none;
        width: 100%;
    }
}