/* ============================================
   FK Form - Public Styles (BEM)
   ============================================ */

/* === ブロック: フォーム全体 === */
.fkform {
    max-width: 640px;
    margin: 0 auto;
    font-family: inherit;
}

.fkform__form {
    position: relative;
}

/* === フィールドラッパー === */
.fkform__field {
    margin-bottom: 1.5em;
}

/* === ラベル === */
.fkform__label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4em;
    font-size: 0.95em;
    color: #333;
}

.fkform__required {
    color: #d63638;
    font-weight: 700;
}

/* === 入力フィールド共通 === */
.fkform__input {
    display: block;
    width: 100%;
    padding: 0.7em 0.9em;
    font-size: 1em;
    line-height: 1.5;
    color: #333;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.fkform__input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.15);
}

.fkform__input::placeholder {
    color: #aaa;
}

/* === テキストエリア === */
.fkform__input--textarea {
    resize: vertical;
    min-height: 120px;
}

/* === セレクトボックス === */
.fkform__input--select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23666' d='M5 8l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7em center;
    background-size: 1.2em;
    padding-right: 2.5em;
}

/* === ラジオ・チェックボックス === */
.fkform__options {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.fkform__option {
    display: flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
    font-size: 0.95em;
}

.fkform__input--checkbox,
.fkform__input--radio {
    width: auto;
    display: inline;
    margin: 0;
    -webkit-appearance: auto;
    appearance: auto;
}

/* === ファイル入力 === */
.fkform__input--file {
    padding: 0.5em;
    border-style: dashed;
    background: #fafafa;
    cursor: pointer;
}

/* === 同意チェック === */
.fkform__acceptance {
    display: flex;
    align-items: flex-start;
    gap: 0.5em;
    font-size: 0.9em;
    line-height: 1.5;
    cursor: pointer;
}
.fkform__acceptance input {
    margin-top: 0.2em;
    flex-shrink: 0;
}

/* === 送信ボタン === */
.fkform__submit {
    display: inline-block;
    padding: 0.8em 2.5em;
    font-size: 1em;
    font-weight: 600;
    color: #fff;
    background: #2271b1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    -webkit-appearance: none;
    appearance: none;
}

.fkform__submit:hover {
    background: #135e96;
}

.fkform__submit:active {
    transform: scale(0.98);
}

.fkform__submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* === 送信中アニメーション === */
.fkform__submit--loading {
    position: relative;
    color: transparent;
}
.fkform__submit--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fkform-spin 0.6s linear infinite;
}

@keyframes fkform-spin {
    to { transform: rotate(360deg); }
}

/* === エラー表示 === */
.fkform__field--error .fkform__input {
    border-color: #d63638;
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.15);
}

.fkform__error {
    display: block;
    color: #d63638;
    font-size: 0.85em;
    margin-top: 0.3em;
    line-height: 1.4;
}

/* === グローバルメッセージ === */
.fkform__message {
    padding: 1em 1.2em;
    border-radius: 6px;
    margin-top: 1em;
    font-size: 0.95em;
    line-height: 1.5;
}

.fkform__message--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.fkform__message--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

/* === 完了画面 === */
.fkform__thankyou {
    text-align: center;
    padding: 2em 1em;
}

.fkform__thankyou h3 {
    font-size: 1.4em;
    margin-bottom: 0.5em;
    color: #166534;
}

.fkform__thankyou p {
    color: #555;
    line-height: 1.8;
}

/* === ハニーポット（非表示） === */
.fkform__hp {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* === レスポンシブ === */
@media (max-width: 600px) {
    .fkform {
        max-width: 100%;
        padding: 0 1em;
    }

    .fkform__submit {
        width: 100%;
        text-align: center;
    }

    .fkform__options--horizontal {
        flex-direction: column;
    }
}

/* =============================================
   スロットセレクター
   ============================================= */
.fkform__slots {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fkform__slots--empty {
    padding: 1em;
    background: #f9f9f9;
    border-radius: 6px;
    text-align: center;
    color: #666;
}
.fkform__slots--error {
    border: 2px solid #d63638;
    border-radius: 6px;
    padding: 8px;
}
.fkform__slots > .fkform__error {
    display: block;
    margin-top: 4px;
}

.fkform__slot {
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
    overflow: hidden;
}
.fkform__slot:hover:not(.fkform__slot--full):not(.fkform__slot--closed):not(.fkform__slot--not-open) {
    border-color: #2271b1;
    background: #f0f6fc;
}

.fkform__slot-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

.fkform__slot-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #2271b1;
}
.fkform__slot-radio:checked + .fkform__slot-info {
    font-weight: 600;
}

.fkform__slot-info {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.fkform__slot-name {
    flex: 1;
    font-size: 15px;
    min-width: 150px;
}

.fkform__slot-datetime {
    font-size: 13px;
    color: #666;
}

.fkform__slot-remaining {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
.fkform__slot-remaining--available {
    background: #e8f5e9;
    color: #2e7d32;
}
.fkform__slot-remaining--few {
    background: #fff3e0;
    color: #e65100;
    animation: fkform-pulse 2s infinite;
}
.fkform__slot-remaining--full {
    background: #fce4ec;
    color: #c62828;
}
.fkform__slot-remaining--closed,
.fkform__slot-remaining--not-open {
    background: #f5f5f5;
    color: #999;
}

@keyframes fkform-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* 選択中 */
.fkform__slot:has(.fkform__slot-radio:checked) {
    border-color: #2271b1;
    background: #f0f6fc;
    box-shadow: 0 0 0 1px #2271b1;
}

/* 無効状態 */
.fkform__slot--full,
.fkform__slot--closed,
.fkform__slot--not-open {
    opacity: 0.6;
}
.fkform__slot--full .fkform__slot-label,
.fkform__slot--closed .fkform__slot-label,
.fkform__slot--not-open .fkform__slot-label {
    cursor: not-allowed;
}
.fkform__slot--full .fkform__slot-name,
.fkform__slot--closed .fkform__slot-name {
    text-decoration: line-through;
}

@media (max-width: 600px) {
    .fkform__slot-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .fkform__slot-label {
        padding: 12px;
    }
}
