/**
 * フォーム拡張スタイル
 * プログレスバー、オプション項目、モダンなデザイン
 */

/* ====================================
   プログレスバー（固定表示）
   ==================================== */
.form-progress-container {
    position: sticky;
    top: calc(var(--nav-height, 60px) + 1rem);
    z-index: 50;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: rgba(18, 18, 18, 0.95);
    border-radius: 10px;
    border: 1px solid rgba(0, 122, 255, 0.15);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.form-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 0.6rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.form-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007aff, #0095ff);
    border-radius: 100px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.4);
    position: relative;
    overflow: hidden;
}

.form-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    animation: shimmer 2.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.form-progress-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.progress-percentage {
    color: var(--color-accent);
    font-size: 1.05em;
    font-weight: 600;
}

/* ====================================
   オプション項目のスタイル
   ==================================== */
.option-group {
    margin-top: 1.2rem;
    padding: 1.2rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.008));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: slideDown 0.3s ease;
    backdrop-filter: blur(5px);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.option-items {
    display: grid;
    gap: 0.65rem;
}

.option-items.multiple-select {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.option-items.single-select {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.option-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(0, 122, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 122, 255, 0.12);
}

.option-item input[type="checkbox"],
.option-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-item input[type="checkbox"]:checked ~ .checkbox-label,
.option-item input[type="radio"]:checked ~ .radio-label {
    color: var(--color-accent);
    font-weight: 600;
}

.option-item input[type="checkbox"]:checked,
.option-item input[type="radio"]:checked {
    & ~ * {
        color: var(--color-accent);
    }
}

.option-item:has(input:checked) {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(0, 81, 255, 0.1));
    border-color: var(--color-accent);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.option-item .checkbox-label,
.option-item .radio-label {
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    flex: 1;
}

/* チェックマークのカスタムスタイル */
.option-item input[type="checkbox"]:checked::before,
.option-item input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--color-accent);
    border-radius: 4px;
    opacity: 1;
}

.option-item input[type="radio"]:checked::before {
    border-radius: 50%;
}

/* ====================================
   カテゴリーボタンの改善
   ==================================== */
.category-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.category-btn {
    position: relative;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--color-text);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.category-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.08), rgba(0, 81, 255, 0.04));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-btn:hover {
    border-color: rgba(0, 122, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.15);
}

.category-btn:hover::before {
    opacity: 1;
}

.category-btn.active {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.2), rgba(0, 81, 255, 0.12));
    border-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.category-btn.active::before {
    opacity: 0;
}

.category-btn.active:hover {
    opacity: 0.85;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2);
}

.category-btn.active::after {
    content: '✕';
    position: absolute;
    top: 0.3rem;
    right: 0.5rem;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-btn.active:hover::after {
    opacity: 0.6;
}

/* サブカテゴリーボタン */
.sub-category-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.65rem;
    margin: 1rem 0;
}

.sub-category-btn {
    position: relative;
    padding: 0.75rem 1.1rem;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sub-category-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(0, 122, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 122, 255, 0.12);
}

.sub-category-btn.active {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.15), rgba(0, 81, 255, 0.08));
    border-color: var(--color-accent);
    color: var(--color-accent);
    box-shadow: 0 3px 12px rgba(0, 122, 255, 0.2);
}

.sub-category-btn.active:hover {
    opacity: 0.85;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.15);
}

.sub-category-btn.active::after {
    content: '✕';
    position: absolute;
    top: 0.3rem;
    right: 0.4rem;
    font-size: 0.65rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sub-category-btn.active:hover::after {
    opacity: 0.6;
}

/* ====================================
   フォーム入力の改善
   ==================================== */
.contact-form input[type="text"]:not(.contact-input),
.contact-form input[type="email"],
.contact-form input[type="number"],
.contact-form input[type="date"],
.contact-form textarea,
.contact-form select {
    position: relative;
}

.contact-form input:focus:not(.contact-input),
.contact-form textarea:focus,
.contact-form select:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* テキストエリアのスタイリング */
.contact-form textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

/* ====================================
   ボタンの改善
   ==================================== */
.submit-btn,
.preview-btn {
    position: relative;
    padding: 0.95rem 2.2rem;
    background: linear-gradient(135deg, #007aff, #0051ff);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.25);
    letter-spacing: 0.02em;
}

.submit-btn::before,
.preview-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.submit-btn:hover,
.preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.35);
}

.submit-btn:hover::before,
.preview-btn:hover::before {
    opacity: 1;
}

.submit-btn:active,
.preview-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 12px rgba(0, 122, 255, 0.25);
}

.preview-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    color: var(--color-text);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border-color: rgba(0, 122, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.12);
}

/* ====================================
   連絡方法ボタンの改善
   ==================================== */
.contact-type-selector {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.contact-type-btn {
    padding: 0.8rem 1.3rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-type-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(0, 122, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 122, 255, 0.12);
}

.contact-type-btn.active {
    background: linear-gradient(135deg, #007aff, #0051ff);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
}

/* ====================================
   予算・納期フィールドの改善
   ==================================== */
.budget-group,
.deadline-group {
    margin-bottom: 1.5rem;
}

.budget-wrapper {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.deadline-inputs {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.budget-input-container {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 300px;
}

.budget-input-container input {
    width: 100%;
    padding-right: 3.5rem !important;
}

.deadline-inputs > input[type="date"] {
    flex: 0 1 auto;
    min-width: 200px;
    max-width: 300px;
}

.currency {
    position: absolute;
    right: 1rem;
    color: var(--color-accent);
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
}

.budget-options {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.deadline-options {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

/* ====================================
   フォームグループの統一スタイル
   ==================================== */
.form-group {
    margin-bottom: 1.8rem;
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.02em;
}

.form-group .required {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* 入力完了マーク */
.form-group.filled label::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    animation: checkmarkPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ヒントテキスト */
.field-hint {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.field-hint::before {
    content: 'ⓘ';
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
    color: var(--color-accent);
}

/* URL検証フィードバック */
.url-validation {
    margin-top: 0.4rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.url-validation.valid {
    color: #00d4aa;
}

.url-validation.invalid {
    color: #ef4444;
}

.url-validation::before {
    font-size: 0.9rem;
}

.url-validation.valid::before {
    content: '✓';
}

.url-validation.invalid::before {
    content: '✕';
}

/* ====================================
   オリジナル動画フィールド
   ==================================== */
.original-video-container {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.original-video-container .checkbox-container {
    flex-shrink: 0;
    margin-top: 0.5rem;
}

/* ====================================
   チェックボックス・ラジオボタンのスタイリング
   ==================================== */
.checkbox-container,
.radio-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.checkbox-container:hover,
.radio-container:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(0, 122, 255, 0.3);
}

.checkbox-container input[type="checkbox"],
.radio-container input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-accent);
    flex-shrink: 0;
}

.checkbox-label,
.radio-label {
    font-size: 0.9rem;
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}

/* 予算と納期のチェックボックス専用スタイル */
.budget-options .checkbox-container,
.deadline-options .checkbox-container {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
}

.budget-options .checkbox-container:hover,
.deadline-options .checkbox-container:hover {
    background: rgba(0, 122, 255, 0.1);
}

/* 必須フィールドの強調表示 */
.form-group.required-empty {
    animation: pulseRequired 2s infinite;
}

.form-group.required-empty label {
    color: #fca5a5;
}

.form-group.required-empty input,
.form-group.required-empty textarea,
.form-group.required-empty select {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.05);
}

@keyframes pulseRequired {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
    50% {
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }
}

/* ====================================
   エラー表示の改善
   ==================================== */
.error-summary {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.1));
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-summary-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #ef4444;
    font-size: 1.05rem;
}

.error-summary-header::before {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-weight: 700;
}

.error-summary ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.error-summary li {
    padding: 0.5rem 0;
    color: var(--color-text);
    padding-left: 1.5rem;
    position: relative;
}

.error-summary li::before {
    content: '×';
    position: absolute;
    left: 0;
    color: #ef4444;
    font-weight: 700;
}

.field-error {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
    border-radius: 4px;
    color: #fca5a5;
    font-size: 0.85rem;
    animation: slideDown 0.3s ease;
}

/* ====================================
   レスポンシブデザイン
   ==================================== */
@media (max-width: 768px) {
    .option-items.multiple-select,
    .option-items.single-select {
        grid-template-columns: 1fr;
    }
    
    .category-buttons {
        grid-template-columns: 1fr;
    }
    
    .sub-category-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-progress-container {
        padding: 1rem;
    }
    
    .original-video-container {
        flex-direction: column;
    }
    
    .budget-wrapper,
    .deadline-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .budget-input-container {
        width: 100%;
        min-width: unset;
    }
    
    .deadline-inputs > input[type="date"] {
        width: 100%;
        min-width: unset;
    }
    
    .budget-options,
    .deadline-options {
        justify-content: flex-start;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .sub-category-buttons {
        grid-template-columns: 1fr;
    }
    
    .option-item {
        padding: 0.8rem 1rem;
    }
    
    .contact-type-selector {
        flex-direction: column;
    }
    
    .contact-type-btn {
        width: 100%;
        justify-content: center;
    }
    
    .budget-options .checkbox-container,
    .deadline-options .checkbox-container {
        width: 100%;
        justify-content: flex-start;
    }
}

