/* 控除額編集機能のCSS追加スタイル */

/* 控除編集アイコンの基本スタイル */
.deduction-edit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    vertical-align: middle;
}

.deduction-edit-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

/* 数次相続控除アイコン（青色） */
.deduction-edit-icon.successive-deduction {
    color: #0d6efd !important; /* Bootstrap primary blue */
}

.deduction-edit-icon.successive-deduction:hover {
    color: #0b5ed7 !important; /* Darker blue on hover */
    background-color: rgba(13, 110, 253, 0.1);
}

/* 配偶者控除等アイコン（緑色） */
.deduction-edit-icon.spouse-deduction {
    color: #198754 !important; /* Bootstrap success green */
}

.deduction-edit-icon.spouse-deduction:hover {
    color: #157347 !important; /* Darker green on hover */
    background-color: rgba(25, 135, 84, 0.1);
}

/* ペンマークアイコンの Bootstrap Icons 強制適用 */
.deduction-edit-icon .bi-pencil-square::before {
    font-family: "Bootstrap Icons" !important;
    content: "\f4ca" !important;
    font-size: 16px;
    line-height: 1;
}

/* ツールチップのスタイル調整 */
.deduction-edit-icon[data-bs-toggle="tooltip"] {
    position: relative;
}

/* 相続税テーブル内での控除編集アイコンの配置 */
.tax-table .heir-column .deduction-edit-icon {
    margin-left: 12px;
    vertical-align: top;
    margin-top: 2px;
}

/* 控除項目行のハイライト */
.tax-table tr.deduction-item {
    background-color: rgba(248, 249, 250, 0.5);
}

.tax-table tr.deduction-item:hover {
    background-color: rgba(248, 249, 250, 0.8);
}

/* 控除編集モーダルのスタイル */
.deduction-modal .modal-dialog {
    max-width: 600px;
}

.deduction-modal .modal-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.deduction-modal .modal-title {
    font-weight: 600;
    color: #212529;
}

/* 数次相続控除モーダルのタイトル色 */
#successiveDeductionModal .modal-title {
    color: #0d6efd;
}

/* 配偶者控除等モーダルのタイトル色 */
#spouseDeductionModal .modal-title {
    color: #198754;
}

/* 自動計算セクションのスタイル */
.deduction-modal .card {
    border: 1px solid #e3f2fd;
    background-color: #f8fcff;
}

.deduction-modal .card-header {
    background-color: #e3f2fd;
    border-bottom: 1px solid #bbdefb;
    font-weight: 600;
}

/* 計算結果表示エリア */
.deduction-modal #calculationResult {
    margin-top: 16px;
}

.deduction-modal #calculationResult .alert {
    border-left: 4px solid #198754;
    padding-left: 20px;
}

/* 入力フィールドのスタイル */
.deduction-modal .form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.deduction-modal .input-group-text {
    background-color: #f8f9fa;
    border-color: #ced4da;
    font-weight: 500;
}

/* バリデーションエラーのスタイル */
.deduction-modal .is-invalid {
    border-color: #dc3545;
}

.deduction-modal .invalid-feedback {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* ボタンのスタイル */
.deduction-modal .btn {
    font-weight: 500;
    border-radius: 6px;
    padding: 8px 16px;
}

.deduction-modal .btn-info {
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

.deduction-modal .btn-info:hover {
    background-color: #31d2f2;
    border-color: #25cff2;
}

/* 情報アラートのスタイル */
.deduction-modal .alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
    padding-left: 20px;
}

/* モーダル内のアイコン */
.deduction-modal .bi {
    vertical-align: baseline;
    margin-right: 8px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .deduction-modal .modal-dialog {
        max-width: 95%;
        margin: 1rem auto;
    }
    
    .deduction-edit-icon {
        width: 20px;
        height: 20px;
        margin-left: 6px;
    }
    
    .deduction-edit-icon .bi-pencil-square::before {
        font-size: 14px;
    }
}

/* タブレット対応 */
@media (max-width: 992px) {
    .tax-table .heir-column .deduction-edit-icon {
        margin-left: 8px;
    }
    
    .deduction-modal .modal-dialog {
        max-width: 90%;
    }
}

/* アニメーション効果 */
@keyframes deductionIconPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.deduction-edit-icon.active {
    animation: deductionIconPulse 0.6s ease-in-out;
}

/* Toast通知のスタイル */
.toast-container .toast.deduction-success {
    border-left: 4px solid #198754;
}

.toast-container .toast.deduction-error {
    border-left: 4px solid #dc3545;
}

/* ローディング状態の表示 */
.deduction-modal .loading {
    opacity: 0.6;
    pointer-events: none;
}

.deduction-modal .loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0d6efd;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 高コントラストモード対応 */
@media (prefers-contrast: high) {
    .deduction-edit-icon {
        border: 1px solid currentColor;
    }
    
    .deduction-edit-icon:hover {
        background-color: rgba(0, 0, 0, 0.1);
    }
}

/* ダークモード対応（将来対応） */
@media (prefers-color-scheme: dark) {
    .deduction-modal .modal-content {
        background-color: #212529;
        color: #fff;
    }
    
    .deduction-modal .form-control {
        background-color: #343a40;
        border-color: #495057;
        color: #fff;
    }
    
    .deduction-edit-icon:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}
