/**
 * モーダルCSS
 * 無料相談フォーム用モーダル
 *
 * @package Yorisou
 */

/* ===================================================================
   モーダル基本スタイル
   =================================================================== */

#consultation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999; /* 最上位に配置 */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#consultation-modal.visible {
    opacity: 1;
    visibility: visible;
}

/* モーダルコンテンツ */
.modal-content {
    position: relative;
    background: #fff;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 2rem;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

#consultation-modal.visible .modal-content {
    transform: translateY(0);
}

/* モーダル表示時はbodyのスクロールを無効化 */
body.modal-open {
    overflow: hidden;
}

/* ===================================================================
   閉じるボタン
   =================================================================== */

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease, color 0.3s ease;
    position: static;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

/* ===================================================================
   モーダル内のフォームスタイル
   =================================================================== */

.modal-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--color-primary, #2C5F2D);
}

.modal-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* フォームグループ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text, #333);
}

.form-group label .required {
    color: #dc3545;
    margin-left: 0.25rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary, #2C5F2D);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* エラーメッセージ */
.form-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* ローディング */
.form-loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-primary, #2C5F2D);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* 送信ボタン */
.form-submit {
    text-align: center;
    margin-top: 2rem;
}

.form-submit button {
    padding: 0.875rem 2.5rem;
    background: var(--color-primary, #2C5F2D);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

.form-submit button:hover {
    background: var(--color-primary-dark, #1f4520);
    transform: translateY(-2px);
}

.form-submit button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===================================================================
   サンクス画面
   =================================================================== */

.thanks-content {
    text-align: center;
    padding: 2rem 1rem;
}

.thanks-icon {
    font-size: 4rem;
    color: #28a745;
    margin-bottom: 1.5rem;
}

.thanks-content h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-primary, #2C5F2D);
}

.thanks-content p {
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.thanks-content .btn {
    margin-top: 1rem;
}

/* ===================================================================
   レスポンシブ
   =================================================================== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 95vh;
    }

    .modal-content h2 {
        font-size: 1.5rem;
    }

    .modal-close {
        top: 0.5rem;
        right: 0.5rem;
    }

    .thanks-icon {
        font-size: 3rem;
    }

    .thanks-content h2 {
        font-size: 1.5rem;
    }

    .thanks-content p {
        font-size: 1rem;
    }
}
