/**
 * Fine Simulator Public CSS
 */

/* ============================================
   CSS カスタムプロパティ（デフォルト値）
   管理画面のデザイン設定で上書きされます
   ============================================ */
:root {
    --fs-primary:          #4a90e2;
    --fs-primary-dark:     #357abd;
    --fs-secondary:        #5f6b78;
    --fs-secondary-dark:   #4e5965;
    --fs-bg:               #ffffff;
    --fs-surface:          #f5f5f5;
    --fs-surface-alt:      #f9f9f9;
    --fs-border:           #dddddd;
    --fs-border-light:     #eeeeee;
    --fs-text:             #333333;
    --fs-text-muted:       #666666;
    --fs-error:            #cc0000;
    --fs-error-bg:         #ffeeee;
    --fs-error-border:     #ffcccc;
    --fs-success:          #2e7d32;
    --fs-warning:          #e65100;
    --fs-total-bg:         #333333;
    --fs-total-text:       #ffffff;
    --fs-focus-ring:       rgba(74, 144, 226, 0.25);
}

.fine-simulator {
    max-width: var(--fs-max-width, auto);
    margin: 2rem auto;
    padding: var(--fs-box-padding, 0);
    background: var(--fs-bg);
    border: var(--fs-box-border-width, 0) solid var(--fs-box-border-color, transparent);
    border-radius: 8px;
    box-sizing: border-box;
}

.fine-simulator *,
.fine-simulator *:before,
.fine-simulator *:after {
    box-sizing: border-box;
}

.fine-simulator h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--fs-text);
    font-size: 1.25rem;
}

/* Profile section */
.fs-profile-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--fs-surface-alt);
    border-radius: 4px;
}

/* Form groups */
.fs-form-group {
    margin-bottom: 2rem;
}

.fs-form-group label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--fs-text);
}

.fs-required {
    color: var(--fs-error);
    margin-left: .25rem;
}

.fs-field-description {
    margin: 0 0 1rem !important;
    font-size: .875rem;
    color: var(--fs-text-muted);
}

/* Input fields */
.fs-input {
    width: 100%;
    padding: .5rem;
    border: 1px solid var(--fs-border);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
    background: var(--fs-bg);
    color: var(--fs-text);
}

.fs-input:focus {
    outline: none;
    border-color: var(--fs-primary);
    box-shadow: 0 0 0 3px var(--fs-focus-ring);
}

.fs-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: var(--fs-bg);
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right .5rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2.5rem;
}

/* Radio buttons */
.fs-radio-group {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.fs-radio-label {
    display: flex;
    align-items: center;
    padding: .5rem;
    border: 1px solid var(--fs-border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 !important;
}

.fs-radio-label:hover {
    background: var(--fs-surface);
    border-color: var(--fs-primary);
}

.fs-radio-label input[type="radio"] {
    margin-right: .5rem;
    width: auto;
}

.fs-radio-label input[type="radio"]:checked {
    accent-color: var(--fs-primary);
}

/* Checkbox */
.fs-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.fs-checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.fs-checkbox-label input[type="checkbox"] {
    margin-right: .5rem;
    width: auto;
}

/* Result section */
.fs-result-section {
    margin: 2rem 0;
    padding: 1rem;
    background: var(--fs-surface);
    border-radius: 4px;
    position: relative;
}

.fs-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 245, 245, 0.9);
    border-radius: 4px;
    z-index: 10;
    font-size: .875rem;
    color: var(--fs-text-muted);
}

.fs-error {
    padding: 1rem;
    background: var(--fs-error-bg);
    border: 1px solid var(--fs-error-border);
    border-radius: 4px;
    color: var(--fs-error);
}

/* Breakdown */
.fs-breakdown {
    margin-bottom: 1rem;
}

.fs-breakdown-list {
    background: var(--fs-bg);
    border-radius: 4px;
    overflow: hidden;
}

.fs-breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: .5rem 1rem;
    border-bottom: 1px solid var(--fs-border-light);
}

.fs-breakdown-item:last-child {
    border-bottom: none;
}

.fs-breakdown-label {
    color: var(--fs-text-muted);
}

.fs-breakdown-amount {
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "游ゴシック Medium", "Yu Gothic Medium", Meiryo, sans-serif;
}

/* Total display */
.fs-total {
    background: var(--fs-bg);
    border-radius: 4px;
    overflow: hidden;
}

.fs-subtotal-row,
.fs-tax-row,
.fs-total-row {
    display: flex;
    justify-content: space-between;
    padding: .5rem 1rem;
    border-bottom: 1px solid var(--fs-border-light);
}

.fs-total-row {
    background: var(--fs-total-bg);
    color: var(--fs-total-text);
    font-size: 1.2rem;
    font-weight: bold;
    border-bottom: none;
}

.fs-amount {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "游ゴシック Medium", "Yu Gothic Medium", Meiryo, sans-serif;
}

/* Actions */
.fs-actions {
    margin-top: 2rem;
    display: flex;
    gap: .5rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.fs-button {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--fs-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.fs-button:hover:not(:disabled) {
    background: var(--fs-primary-dark);
}

.fs-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.fs-mail-button {
    background: var(--fs-secondary);
}

.fs-mail-button:hover:not(:disabled) {
    background: var(--fs-secondary-dark);
}

/* Button Group */
.fs-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.fs-button-group-label {
    display: inline-block;
    padding: .5rem 1rem;
    border: 1px solid var(--fs-border);
    border-radius: 4px;
    font-size: .875rem;
    color: var(--fs-text);
    background: var(--fs-bg);
    transition: all 0.2s;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    margin: 0 !important;
}

.fs-button-group-label input[type="radio"],
.fs-button-group-label input[type="checkbox"] {
    display: none;
}

.fs-button-group-label:hover {
    border-color: var(--fs-primary);
    background: var(--fs-surface);
}

.fs-button-group-label:has(input:checked) {
    border-color: var(--fs-primary);
    background: var(--fs-primary);
    color: #fff;
    font-weight: 600;
}

@media (max-width: 768px) {
    .fs-button-group {
        flex-direction: column;
    }

    .fs-button-group-label {
        width: 100%;
        text-align: center;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .fine-simulator {
        width: 100%;
        max-width: 100%;
        padding: var(--fs-box-padding-mobile, 0);
        margin: 1rem 0;
    }

    .fs-breakdown-item,
    .fs-subtotal-row,
    .fs-tax-row,
    .fs-total-row {
        font-size: .875rem;
    }

    .fs-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .fs-actions .fs-button {
        width: 100%;
    }
}

/* ============================================
   Image Select Field
   ============================================ */
.fs-image-select-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.fs-image-select-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: .5rem;
    border: 2px solid var(--fs-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--fs-bg);
    min-width: 100px;
    max-width: 160px;
    text-align: center;
    position: relative;
    user-select: none;
}

.fs-image-select-label:hover {
    border-color: var(--fs-primary);
    background: var(--fs-surface);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--fs-focus-ring);
}

/* Hide the actual radio input */
.fs-image-select-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.fs-image-select-img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    margin-bottom: .25rem;
}

.fs-image-select-placeholder {
    width: 100%;
    height: 80px;
    background: var(--fs-surface);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fs-text-muted);
    font-size: .875rem;
}

.fs-image-select-caption {
    font-size: 0.75rem;
    color: var(--fs-text);
    font-weight: 500;
    line-height: 1.5;
}

/* Selected state */
.fs-image-select-label:has(.fs-image-select-input:checked) {
    border-color: var(--fs-primary);
    background: var(--fs-surface);
    box-shadow: 0 0 0 3px var(--fs-focus-ring);
}

.fs-image-select-label:has(.fs-image-select-input:checked)::after {
    content: '✓';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 22px;
    height: 22px;
    background: var(--fs-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 22px;
}

.fs-image-select-label:has(.fs-image-select-input:checked) .fs-image-select-caption {
    color: var(--fs-primary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .fs-image-select-group {
        gap: .5rem;
    }

    .fs-image-select-label {
        min-width: 80px;
        max-width: 120px;
        padding: .5rem;
    }

    .fs-image-select-img,
    .fs-image-select-placeholder {
        height: 60px;
    }
}
