/**
 * Debt Simulator Styles
 * 債務整理シミュレーター専用のスタイル (Redesigned)
 */

:root {
    --sim-primary: #f97317;
    --sim-primary-hover: #ea580c;
    --sim-secondary: #6b7280;
    --sim-success: #10b981;
    --sim-danger: #ef4444;
    --sim-text-main: #1f2937;
    --sim-text-sub: #0e2039;
    --sim-bg-light: #f9fafb;
    --sim-border: #e5e7eb;
    --sim-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --sim-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sim-radius: 12px;
}

/* Base Layout */
.simulator-container {
    max-width: 800px;
    margin: 2rem auto;
    padding-bottom: 4rem;
}

/* Progress Bar */
.simulator-progress {
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.progress-track {
    background: #e5e7eb;
    height: 6px;
    border-radius: 3px;
    position: relative;
    margin-bottom: 1.5rem;
}

.progress-fill {
    background: var(--sim-primary);
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 33.333%;
    text-align: center;
}

.step-circle {
    width: 32px;
    height: 32px;
    background: #fff;
    border: 2px solid #d1d5db;
    color: #9ca3af;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.step-label {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
}

.step.active .step-circle {
    border-color: var(--sim-primary);
    background: var(--sim-primary);
    color: #fff;
}

.step.active .step-label {
    color: var(--sim-primary);
    font-weight: 700;
}

/* Mode Selection */
.section-heading {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sim-text-main);
    margin-bottom: 2rem;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 0 1rem;
}

.mode-card {
    background: #fff;
    border: 2px solid transparent;
    border-radius: var(--sim-radius);
    padding: 2rem;
    box-shadow: var(--sim-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
}

.mode-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sim-shadow-lg);
    border-color: var(--sim-primary);
}

.mode-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.bg-blue-100 {
    background-color: #ffedd5;
}

.bg-indigo-100 {
    background-color: #e0e7ff;
}

.mode-info {
    flex: 1;
    margin-bottom: 2rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tag-primary {
    background: #ffedd5;
    color: #c2410c;
}

.tag-secondary {
    background: #f3f4f6;
    color: #374151;
}

.mode-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--sim-text-main);
}

.mode-card p {
    color: var(--sim-text-sub);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.mode-meta {
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Form Styling */
.form-step {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--sim-text-main);
    margin-bottom: 0.5rem;
}

.form-header p {
    color: var(--sim-text-sub);
}

.form-card {
    background: #fff;
    border-radius: var(--sim-radius);
    padding: 2.5rem;
    box-shadow: var(--sim-shadow);
    margin-bottom: 2rem;
    border: 1px solid var(--sim-border);
}

.form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group.half {
    flex: 1;
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--sim-text-main);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.label-note {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--sim-text-sub);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-right: 3.5rem;
    /* Space for unit */
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 500;
    transition: all 0.2s;
}

.input-group input:focus {
    border-color: var(--sim-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group .unit {
    position: absolute;
    right: 1rem;
    color: #6b7280;
    font-weight: 600;
    pointer-events: none;
}

.form-help {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Range Slider */
.range-slider-container {
    padding: 1rem 0;
}

.range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.range-display {
    position: relative;
    width: 100px;
}

.range-display input {
    width: 100%;
    padding: 0.5rem;
    padding-right: 2.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    text-align: right;
    font-weight: bold;
    color: var(--sim-primary);
}

.range-display .unit {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 600;
    color: #6b7280;
}

.custom-range {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--sim-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid #fff;
    margin-top: -9px;
    /* adjust for center */
}

.custom-range::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
}

.range-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}

/* Dynamic List (Debts/Assets) */
.dynamic-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Dynamically added forms */
.debt-form,
.asset-form {
    background: #fdfdfd;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--sim-primary);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #e5e7eb;
}

.item-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #374151;
    margin: 0;
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.btn-remove:hover {
    background: #fef2f2;
}

/* Buttons */
.form-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.simulator-container .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
}

.simulator-container .btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.125rem;
}

.simulator-container .btn-block {
    display: flex;
    width: 100%;
}

.simulator-container .btn-primary {
    background: var(--sim-primary);
    color: white;
}

.simulator-container .btn-primary:hover {
    background: var(--sim-primary-hover);
    transform: translateY(-1px);
}

.simulator-container .btn-shadow {
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.4);
}

.simulator-container .btn-shadow:hover {
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.5);
}

.simulator-container .btn-secondary {
    background: #fff;
    border-color: #d1d5db;
    color: #374151;
}

.simulator-container .btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.simulator-container .btn-outline-primary {
    background: white;
    border-color: var(--sim-primary);
    color: var(--sim-primary);
}

.simulator-container .btn-outline-primary:hover {
    background: #eff6ff;
}

.simulator-container .btn-outline-secondary {
    background: white;
    border-color: #d1d5db;
    color: #374151;
}

.simulator-container .btn-outline-secondary:hover {
    background: #f3f4f6;
}

.simulator-container .btn-link {
    background: none;
    color: #6b7280;
    border-color: transparent;
}

.simulator-container .btn-link:hover {
    color: #111827;
    text-decoration: underline;
}

.simulator-container .btn-dashed {
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    color: #6b7280;
    padding: 1rem;
}

.simulator-container .btn-dashed:hover {
    background: #fff;
    border-color: var(--sim-primary);
    color: var(--sim-primary);
}

.plus-icon {
    margin-right: 0.5rem;
    font-weight: bold;
    font-size: 1.25rem;
}

/* Results */
.simulator-results {
    animation: fadeIn 0.5s ease-out;
}

.results-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .results-actions {
        flex-direction: column;
        gap: 1rem;
    }

    .simulator-container .results-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

.results-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.result-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--sim-shadow-lg);
    overflow: hidden;
    border: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
}

.result-card h3 {
    background: #f9fafb;
    padding: 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    margin: 0;
    color: var(--sim-text-main);
    text-align: center;
}

.result-values {
    padding: 1.5rem;
}

.result-total {
    background: #fff7ed;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 1rem;
}

.result-total p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.result-total strong {
    font-size: 1.75rem;
    color: var(--sim-primary);
    display: block;
}

.result-details {
    margin-bottom: 1rem;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
}

.result-row:last-child {
    border-bottom: none;
}

.reduction-highlight {
    color: var(--sim-success);
    font-weight: 700;
}

.chart-container {
    padding: 1.5rem;
    background: white;
    border-radius: 16px;
    box-shadow: var(--sim-shadow);
    margin-bottom: 2rem;
}

/* Custom Checkbox */
.custom-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkbox-box {
    height: 24px;
    width: 24px;
    background-color: #fff;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.custom-checkbox input:checked~.checkbox-box {
    background-color: var(--sim-primary);
    border-color: var(--sim-primary);
}

.checkbox-box:after {
    content: "";
    display: none;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked~.checkbox-box:after {
    display: block;
}

.checkbox-label {
    font-weight: 500;
    color: var(--sim-text-main);
}

/* Info Box */
.info-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 1rem;
    color: #166534;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Disclaimer */
.simulator-disclaimer {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 3rem;
}

.simulator-disclaimer h3 {
    font-size: 1rem;
    color: #4b5563;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.simulator-disclaimer ul {
    list-style: disc;
    padding-left: 1.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.simulator-disclaimer li {
    margin-bottom: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .header-image {
        display: none;
    }

    .btn-block {
        width: 100%;
    }

    .form-card {
        padding: 1.5rem;
    }

    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .desktop-only {
        display: none !important;
    }
}