/* 作成モーダルのスタイル */

/* モーダル共通スタイル */
.create-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.create-modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 10vh auto;
    max-width: 400px;
    max-height: 80vh;
    border-radius: 16px;
    transform: translateY(50px) scale(0.9);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.create-modal.show .modal-content {
    transform: translateY(0) scale(1);
}

/* 運動モーダルも中央表示に統一 */
#exerciseModal .modal-content,
#startModal .modal-content {
    margin: 5vh auto;
    max-width: 400px;
    max-height: 90vh;
    border-radius: 16px;
    transform: translateY(50px) scale(0.9);
}

#exerciseModal.show .modal-content,
#startModal.show .modal-content {
    transform: translateY(0) scale(1);
}


/* モーダルヘッダー */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #2196F3;
    color: white;
    position: relative;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-align: center;
    flex: 1;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    margin-right: 12px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: absolute;
    left: 8px;
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.modal-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    position: absolute;
    right: 8px;
    line-height: 1;
}

.modal-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* モーダルボディ */
.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

/* 作成オプション */
.create-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.create-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background-color: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.create-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.option-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border-radius: 50%;
    flex-shrink: 0;
}

.option-content {
    flex: 1;
}

.option-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
}

.option-description {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* フォーム共通スタイル */
.exercise-form,
.post-form,
.start-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.form-input,
.form-textarea {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background-color: white;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #2196F3;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* 日時入力 */
.datetime-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* 時間範囲入力 */
.time-range-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-range-inputs .form-input {
    flex: 1;
}

.time-range-separator {
    font-size: 16px;
    color: #666;
    font-weight: 500;
}

/* 運動タイプ選択 */
.exercise-type-options {
    display: flex;
    gap: 12px;
}

.exercise-type-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 8px;
}

.exercise-type-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
}

.exercise-type-option input[type="radio"] {
    display: none;
}

.exercise-type-option input[type="radio"]:checked + .type-icon {
    transform: scale(1.2);
}

.exercise-type-option input[type="radio"]:checked ~ .type-label {
    color: #2196F3;
    font-weight: 600;
}

.exercise-type-option:has(input[type="radio"]:checked) {
    border-color: #2196F3;
    background-color: #e3f2fd;
}

.exercise-type-option .type-icon {
    font-size: 24px;
    transition: all 0.3s ease;
}

.exercise-type-option .type-label {
    font-size: 12px;
    color: #666;
    transition: all 0.3s ease;
    font-weight: 500;
}

/* レベル選択 */
.level-options {
    display: flex;
    gap: 12px;
}

.level-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
}

.level-option input[type="radio"] {
    display: none;
}

.level-option input[type="radio"]:checked + .level-label {
    color: #2196F3;
    font-weight: 600;
}

.level-option:has(input[type="radio"]:checked) {
    border-color: #2196F3;
    background-color: #e3f2fd;
}

.level-label {
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

/* 公開範囲選択 */
.visibility-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.visibility-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 4px;
}

.visibility-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
}

.visibility-option input[type="radio"] {
    display: none;
}

.visibility-option input[type="radio"]:checked ~ .visibility-label {
    color: #2196F3;
    font-weight: 600;
}

.visibility-option:has(input[type="radio"]:checked) {
    border-color: #2196F3;
    background-color: #e3f2fd;
}

.visibility-icon {
    font-size: 24px;
    transition: all 0.3s ease;
}

.visibility-label {
    font-size: 12px;
    color: #666;
    transition: all 0.3s ease;
    font-weight: 500;
}

/* 投稿タイプ選択 */
.post-type-options {
    display: flex;
    gap: 12px;
}

.post-type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.post-type-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
}

.post-type-option input[type="radio"] {
    display: none;
}

.post-type-option input[type="radio"]:checked + .type-label {
    color: #2196F3;
    font-weight: 600;
}

.post-type-option:has(input[type="radio"]:checked) {
    border-color: #2196F3;
    background-color: #e3f2fd;
}

.type-label {
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

/* 運動データ入力 */
.stats-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

/* ファイルアップロード */
.file-upload {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: #f5f5f5;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #666;
}

.upload-btn:hover {
    background-color: #e9ecef;
    border-color: #2196F3;
    color: #2196F3;
}

.file-name {
    font-size: 12px;
    color: #666;
    padding-left: 4px;
}

/* 目標オプション */
.goal-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.goal-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
}

.goal-option:has(input[type="radio"]:checked) {
    border-color: #2196F3;
    background-color: #e3f2fd;
}

.goal-type {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    min-width: 80px;
}

.goal-type input[type="radio"] {
    margin: 0;
}

.goal-type span {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.goal-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.goal-input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

.goal-input:not(:disabled):focus {
    outline: none;
    border-color: #2196F3;
    background-color: white;
}

/* 動画ギャラリー */
.video-gallery {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.video-gallery::-webkit-scrollbar {
    height: 4px;
}

.video-gallery::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.video-gallery::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.video-gallery::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.video-option {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: white;
    min-width: 140px;
    flex-shrink: 0;
}

.video-option:hover {
    border-color: #2196F3;
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.2);
}

.video-option.selected {
    border-color: #2196F3;
    background-color: #e3f2fd;
}

.video-thumbnail {
    position: relative;
    background: linear-gradient(135deg, #f5f5f5 0%, #e9ecef 100%);
    border-radius: 8px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
}

.video-preview {
    font-size: 24px;
    z-index: 1;
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.video-option:hover .play-overlay {
    opacity: 1;
}

.video-info {
    text-align: center;
}

.video-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 4px 0;
}

.video-description {
    font-size: 12px;
    color: #666;
    margin: 0;
    line-height: 1.3;
}

/* 運動開始ボタン */
.start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}


/* フォームアクション */
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: #2196F3;
    color: white;
}

.btn-primary:hover {
    background-color: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.btn-secondary {
    background-color: white;
    color: #666;
    border-color: #e0e0e0;
}

.btn-secondary:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

/* 成功トースト */
.success-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: #4caf50;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 1100;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.success-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* レスポンシブ対応 */
@media (max-width: 430px) {
    .modal-overlay {
        left: 0;
        transform: none;
        max-width: 100%;
    }
    
    .modal-content {
        margin: 5vh 16px;
        max-width: calc(100% - 32px);
        max-height: 90vh;
    }
    
    .stats-inputs {
        grid-template-columns: 1fr;
    }
    
    .datetime-inputs {
        grid-template-columns: 1fr;
    }
    
    .level-options,
    .post-type-options,
    .exercise-type-options {
        flex-direction: column;
    }
    
    .video-option {
        min-width: 120px;
    }
    
    .video-thumbnail {
        height: 70px;
    }
    
}

/* アニメーション */
@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}