* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3e9d0 100%);
    min-height: 100vh;
    color: #333;
}

/* ヘッダー */
header {
    background: linear-gradient(135deg, #2e7d32 0%, #4caf50 100%);
    color: white;
    padding: 1.5rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
}

/* 注: .settings-button と .version-badge は .header-right 内でflexレイアウト */

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

/* ヘッダーのサッカーボール画像 */
.ball-icon-img {
    width: 48px;
    height: 48px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* AI読み込み中のサッカーボール回転アニメーション */
.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

.ai-loading-ball {
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

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

.ai-loading-text {
    color: #2e7d32;
    font-weight: bold;
    font-size: 1rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: bold;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.95;
    margin-left: 3.5rem;
}

/* メインコンテンツ */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* タブコンテナ */
.tab-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 3px solid #e0e0e0;
}

.tab-button {
    flex: 1;
    padding: 1.2rem;
    font-size: 1.1rem;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.tab-button:hover {
    background: rgba(76, 175, 80, 0.1);
}

.tab-button.active {
    background: white;
    color: #2e7d32;
    border-bottom: 3px solid #ff9800;
    margin-bottom: -3px;
}

.tab-content {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 検索セクション */
.search-section {
    margin-bottom: 2rem;
}

.search-section h2 {
    color: #2e7d32;
    margin-bottom: 1rem;
}

.search-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#searchInput {
    padding: 1rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    outline: none;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    border-color: #4caf50;
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.7rem 1.5rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.category-btn:hover {
    background: #f5f5f5;
}

.category-btn.active {
    background: linear-gradient(135deg, #ff9800 0%, #ffc107 100%);
    color: white;
    border-color: #ff9800;
}

/* 資料グリッド */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* 練習メニューグリッド */
.practice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* 練習メニューカード */
.practice-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.practice-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #4caf50;
}

.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.practice-category-label {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.practice-difficulty {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: bold;
}

.difficulty-easy {
    background: #e3f2fd;
    color: #1976d2;
}

.difficulty-medium {
    background: #fff3e0;
    color: #f57c00;
}

.difficulty-advanced {
    background: #fce4ec;
    color: #c2185b;
}

.practice-card h3 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.practice-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.practice-footer {
    display: flex;
    justify-content: flex-end;
}

.view-pdf-btn {
    color: #4caf50;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.practice-card:hover .view-pdf-btn {
    text-decoration: underline;
}

/* 練習メニューカテゴリボタン */
.practice-category-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.practice-category-btn:hover {
    background: #f5f5f5;
}

.practice-category-btn.active {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    border-color: #4caf50;
}

.resource-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    border-color: #4caf50;
}

.resource-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    margin-bottom: 0.8rem;
}

.resource-card h3 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
}

.resource-card p {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* AI機能のタブコンテナ */
.ai-tabs-container {
    margin-top: -1rem;
}

/* AI機能の内部タブ */
.ai-tabs {
    display: flex;
    background: #f0f7f1;
    border-radius: 15px 15px 0 0;
    padding: 0.5rem;
    gap: 0.5rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.ai-tab-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
    font-weight: 500;
    position: relative;
}

.ai-tab-button:hover {
    background: rgba(255, 255, 255, 0.5);
}

.ai-tab-button.active {
    background: white;
    color: #2e7d32;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ai-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 20%;
    right: 20%;
    height: 3px;
    background: linear-gradient(135deg, #ff9800 0%, #ffc107 100%);
    border-radius: 2px;
}

.ai-tab-icon {
    font-size: 1.2rem;
}

.ai-tab-text {
    font-size: 1rem;
}

/* AI機能のタブコンテンツ */
.ai-tab-content {
    display: none;
    background: white;
    padding: 2rem;
    border-radius: 0 0 15px 15px;
    animation: fadeIn 0.3s ease;
}

.ai-tab-content.active {
    display: block;
}

.ai-tool-description {
    background: linear-gradient(135deg, #f8fffe 0%, #e8f5e9 100%);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-left: 4px solid #4caf50;
}

.ai-tool-description h3 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
}

.ai-tool-description p {
    color: #666;
    line-height: 1.6;
}

/* モーダル */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: #333;
}

/* フォーム要素 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2e7d32;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    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: #4caf50;
}

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

/* 生徒選択コンテナ */
.student-select-container {
    display: flex;
    flex-direction: column;
}

.student-select-container input[type="text"] {
    padding: 0.6rem 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.student-select-container input[type="text"]:focus {
    outline: none;
    border-color: #4caf50;
}

.student-select-container input[type="text"]::placeholder {
    color: #aaa;
}

/* ボタン */
.btn-primary {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    padding: 1rem 2rem;
    background: #f5f5f5;
    color: #666;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* ============================================
   ヘッダー右側エリア
   ============================================ */
.header-right {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.version-badge {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* 認証情報（ヘッダー右） */
.auth-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.location-badge {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

.user-name {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
}

.admin-link {
    color: white;
    font-size: 0.7rem;
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
}

.admin-link:hover {
    background: rgba(255,255,255,0.15);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    cursor: pointer;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.settings-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
}

.settings-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(30deg);
}

/* ============================================
   プロファイル設定モーダル
   ============================================ */
.profile-settings-modal {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-title {
    color: #2e7d32;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e8f5e9;
}

.profile-section h3 {
    color: #2e7d32;
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* プロファイル一覧 */
.profile-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.no-profiles {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 10px;
    color: #666;
}

.no-profiles .help-text {
    font-size: 0.85rem;
    color: #999;
    margin-top: 0.5rem;
}

/* プロファイルカード */
.profile-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-card:hover {
    background: #e8f5e9;
    border-color: #4caf50;
}

.profile-card.active {
    background: #e8f5e9;
    border-color: #4caf50;
}

.profile-radio {
    flex-shrink: 0;
}

.profile-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #4caf50;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.2rem;
}

.profile-email {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.2rem;
}

.profile-folder {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-icon-small {
    margin-right: 0.3rem;
}

.btn-edit-profile {
    padding: 0.4rem 0.8rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-profile:hover {
    background: #f5f5f5;
    border-color: #4caf50;
    color: #4caf50;
}

/* 新規追加ボタン */
.btn-add-profile {
    width: 100%;
    padding: 0.8rem;
    background: white;
    border: 2px dashed #4caf50;
    border-radius: 10px;
    color: #4caf50;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add-profile:hover {
    background: #e8f5e9;
}

/* プロファイル追加・編集フォーム */
.add-profile-form,
.edit-profile-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.add-profile-form h3,
.edit-profile-form h3 {
    color: #2e7d32;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.required {
    color: #e65100;
}

/* Googleアカウント状態 */
.google-account-status {
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.8rem;
}

.google-account-status .status-text {
    color: #666;
}

.google-account-status .status-text.connected {
    color: #2e7d32;
    font-weight: 500;
}

/* Googleログインボタン */
.btn-google-login {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-google-login:hover {
    background: #f5f5f5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* フォルダ選択 */
.folder-input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.btn-folder-picker {
    padding: 0.7rem 1rem;
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-folder-picker:hover {
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

.selected-folder-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.8rem;
    background: #e8f5e9;
    border-radius: 8px;
    color: #2e7d32;
}

.folder-icon {
    font-size: 1.2rem;
}

/* フォルダID直接入力 */
.folder-id-toggle {
    margin-bottom: 0.5rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    accent-color: #4caf50;
}

.folder-id-input-group {
    margin-top: 0.5rem;
}

.folder-id-input-group input {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
}

.folder-id-input-group input:focus {
    outline: none;
    border-color: #4caf50;
}

.help-text {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.3rem;
}

/* フォームアクション */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.form-actions .btn-primary,
.form-actions .btn-secondary {
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
}

.btn-danger {
    padding: 0.7rem 1.5rem;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: auto;
}

.btn-danger:hover {
    background: #ffcdd2;
}

/* ============================================
   シンプル設定モーダル
   ============================================ */
.setting-step {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    color: #2e7d32;
    font-size: 1rem;
    margin-bottom: 0.8rem;
}

.account-display,
.folder-display {
    padding: 0.8rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    border: 1px solid #e0e0e0;
}

.account-status,
.folder-status {
    font-size: 0.9rem;
}

.account-status.not-connected,
.folder-status.not-selected {
    color: #999;
}

.account-status.connected {
    color: #2e7d32;
    font-weight: 500;
}

.folder-status.selected {
    color: #2e7d32;
    font-weight: 500;
}

.setting-complete {
    text-align: center;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 8px;
    color: #2e7d32;
    font-weight: 500;
    margin-top: 1rem;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    main {
        padding: 0 1rem;
    }

    .ai-tab-button {
        padding: 0.8rem 0.5rem;
    }

    .ai-tab-text {
        font-size: 0.85rem;
    }

    .resources-grid {
        grid-template-columns: 1fr;
    }

    .practice-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .profile-settings-modal {
        max-height: 90vh;
    }

    .folder-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions {
        flex-wrap: wrap;
    }

    .btn-danger {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* タブボタン - モバイル */
    .tab-button {
        padding: 0.6rem 0.3rem;
        font-size: 0.7rem;
        line-height: 1.2;
    }

    /* ボタン - モバイル */
    .btn-primary,
    .btn-secondary {
        padding: 0.7rem 1rem;
        font-size: 0.85rem;
    }

    /* インポートエリア - モバイル */
    .import-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .import-actions .btn-primary,
    .import-actions .btn-download-template {
        width: 100%;
        text-align: center;
        font-size: 0.8rem;
        padding: 0.7rem 0.5rem;
    }

    .btn-download-template {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }

    /* インポート種別ボタン - モバイル */
    .import-type-btn {
        min-width: 80px;
        padding: 0.6rem;
    }

    .import-type-icon {
        font-size: 1.5rem;
    }

    .import-type-label {
        font-size: 0.75rem;
    }

    /* タブコンテンツ - モバイル */
    .tab-content {
        padding: 1rem;
    }

    /* フォルダ選択セクション - モバイル */
    .folder-selection-section h4 {
        font-size: 0.9rem;
    }
}

/* ============================================
   データ同期ボタン
   ============================================ */
.sync-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.sync-btn:hover {
    background: #45a049;
}

.sync-btn:disabled {
    background: #9e9e9e;
    cursor: not-allowed;
}

.sync-icon {
    display: inline-block;
    font-size: 1.1rem;
}

.sync-icon.spinning {
    animation: sync-spin 1s linear infinite;
}

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

/* ============================================
   活動内容チェックボックス（複数選択用）
   ============================================ */
.activity-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.activity-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.activity-checkboxes label:hover {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.activity-checkboxes input[type="checkbox"]:checked + span,
.activity-checkboxes label:has(input:checked) {
    background: #e8f5e9;
    border-color: #4CAF50;
    color: #2e7d32;
}

.activity-checkboxes input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #4CAF50;
}

/* ============================================
   一括記録作成ウィザード
   ============================================ */
.batch-record-wizard {
    padding: 1rem;
}

.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.progress-step {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 8px;
    margin: 0 0.25rem;
    font-size: 0.85rem;
    color: #757575;
    position: relative;
}

.progress-step.active {
    background: #4CAF50;
    color: white;
    font-weight: bold;
}

.progress-step.completed {
    background: #e8f5e9;
    color: #2e7d32;
}

.batch-summary {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #4CAF50;
}

.batch-summary p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
}

.wizard-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-small:hover {
    background: #e0e0e0;
}

/* 児童選択リスト */
.children-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.child-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.child-checkbox-label:hover {
    border-color: #4CAF50;
    background: #f9fff9;
}

.child-checkbox-label:has(input:checked) {
    border-color: #4CAF50;
    background: #e8f5e9;
}

.child-checkbox-label input {
    width: 18px;
    height: 18px;
    accent-color: #4CAF50;
}

/* 個別メモ入力 */
.batch-children-inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.batch-child-input {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
}

.batch-child-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.batch-child-number {
    width: 28px;
    height: 28px;
    background: #4CAF50;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
}

.batch-child-name {
    font-weight: bold;
    color: #333;
    font-size: 1rem;
}

.batch-child-input textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    resize: vertical;
}

.no-issue-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
}

.no-issue-label input {
    width: 16px;
    height: 16px;
    accent-color: #4CAF50;
}

/* 結果表示 */
.batch-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.batch-result-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.batch-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}

.batch-result-status {
    margin-left: auto;
    color: #4CAF50;
    font-size: 0.85rem;
}

.batch-result-content {
    padding: 1rem;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.9rem;
}

/* 保護者向け連絡帳セクション */
.parent-note-section {
    padding: 1rem;
    border-top: 1px dashed #e0e0e0;
    background: #fff8e1;
}

.parent-note-header {
    color: #ff9800;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.parent-note-content {
    padding: 0.75rem;
    background: white;
    border: 1px solid #ffe082;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ========================================
   CSVインポート機能
   ======================================== */

.csv-import-container {
    max-width: 700px;
    margin: 0 auto;
}

.import-type-selector {
    margin-bottom: 1.5rem;
}

.import-type-selector h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1rem;
}

.import-type-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.import-type-btn {
    flex: 1;
    min-width: 150px;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.import-type-btn:hover {
    border-color: #4caf50;
    background: #f8fff8;
}

.import-type-btn.active {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.import-type-icon {
    font-size: 2rem;
}

.import-type-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.csv-import-form {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.import-type-info {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.import-type-info h4 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
}

.import-type-info p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.required-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.field-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #666;
}

.field-badge.required {
    background: #fff3e0;
    color: #e65100;
    font-weight: 500;
}

.file-upload-area {
    border: 2px dashed #c8e6c9;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fafafa;
    margin-bottom: 1rem;
}

.file-upload-area:hover {
    border-color: #4caf50;
    background: #f8fff8;
}

.file-upload-area.dragover {
    border-color: #4caf50;
    background: #e8f5e9;
}

.file-upload-area .upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.file-upload-area p {
    color: #666;
    margin-bottom: 0.5rem;
}

.file-upload-area .file-hint {
    font-size: 0.8rem;
    color: #999;
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: #e8f5e9;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.selected-file-info .file-icon {
    font-size: 1.5rem;
}

.selected-file-info .file-name {
    flex: 1;
    font-weight: 500;
    color: #2e7d32;
}

.btn-remove-file {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #ffcdd2;
    color: #c62828;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-file:hover {
    background: #ef9a9a;
}

.import-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.btn-download-template {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid #4caf50;
    color: #4caf50;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-download-template:hover {
    background: #f8fff8;
}

.import-result {
    margin-top: 1.5rem;
}

.import-success,
.import-error {
    text-align: center;
    padding: 2rem;
    border-radius: 12px;
}

.import-success {
    background: #e8f5e9;
}

.import-error {
    background: #ffebee;
}

.success-icon,
.error-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

.success-icon {
    background: #4caf50;
    color: white;
}

.error-icon {
    background: #f44336;
    color: white;
}

.import-success h4 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
}

.import-error h4 {
    color: #c62828;
    margin-bottom: 0.5rem;
}

.imported-names {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.imported-name {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.import-result-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

/* ========================================
   フォルダ選択機能（CSVインポート用）
   ======================================== */

.folder-selection-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
}

.folder-selection-section h4 {
    color: #2e7d32;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.folder-selection-section > p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.folder-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: #666;
}

.folder-loading .loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.folder-list {
    margin-bottom: 1rem;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.folder-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.folder-item:hover {
    border-color: #4caf50;
    background: #f8fff8;
    transform: translateY(-2px);
}

.folder-item.selected {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.folder-item .folder-icon {
    font-size: 2rem;
}

.folder-item .folder-name {
    font-size: 0.85rem;
    color: #333;
    word-break: break-word;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}

.folder-item.selected .folder-name {
    color: #2e7d32;
    font-weight: 500;
}

.selected-folder-indicator {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #e8f5e9;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #c8e6c9;
}

.selected-folder-indicator .check-icon {
    color: #4caf50;
    font-size: 1.2rem;
}

.selected-folder-indicator span {
    color: #2e7d32;
    font-weight: 500;
}

.btn-new-folder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px dashed #4caf50;
    border-radius: 8px;
    color: #4caf50;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
}

.btn-new-folder:hover {
    background: #e8f5e9;
}

.new-folder-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.new-folder-form input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.9rem;
}

.new-folder-form input:focus {
    outline: none;
    border-color: #4caf50;
}

.new-folder-form .btn-create {
    padding: 0.6rem 1rem;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.new-folder-form .btn-create:hover {
    background: #43a047;
}

.new-folder-form .btn-cancel {
    padding: 0.6rem 0.8rem;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
}

.new-folder-form .btn-cancel:hover {
    background: #e0e0e0;
}

.no-folders-message {
    text-align: center;
    padding: 1.5rem;
    color: #999;
    font-size: 0.9rem;
}

/* フォルダ選択レスポンシブ */
@media (max-width: 768px) {
    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }

    .folder-item {
        padding: 0.75rem 0.5rem;
    }

    .folder-item .folder-icon {
        font-size: 1.5rem;
    }

    .folder-item .folder-name {
        font-size: 0.75rem;
    }

    .new-folder-form {
        flex-direction: column;
    }

    .new-folder-form input {
        width: 100%;
    }
}

/* ============================================
   練習メニューアップロードボタン
   ============================================ */
.btn-upload {
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, #ff9800 0%, #ffc107 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.uploaded-badge {
    display: inline-block;
    background: #ff9800;
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.btn-video {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.8rem;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-video:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.btn-delete-menu {
    padding: 0.3rem 0.6rem;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete-menu:hover {
    background: #ffcdd2;
}

.btn-add-video {
    padding: 0.3rem 0.6rem;
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-video:hover {
    background: #ffe0b2;
}

.btn-edit-video {
    padding: 0.3rem 0.5rem;
    background: #e3f2fd;
    color: #1565c0;
    border: 1px solid #90caf9;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-video:hover {
    background: #bbdefb;
}

.btn-edit-uploaded {
    padding: 0.3rem 0.6rem;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-uploaded:hover {
    background: #c8e6c9;
}

/* ============================================
   Assessment Manager Styles (embedded)
   ============================================ */
.am-children-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 20px;
}

.am-filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.am-filter-section input,
.am-filter-section select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.am-filter-section input:focus,
.am-filter-section select:focus {
    border-color: #4caf50;
}

.am-filter-section input {
    flex: 1;
    min-width: 200px;
}

.am-child-item {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;
    align-items: center;
    transition: border-color 0.3s;
}

.am-child-item:hover {
    border-color: #4caf50;
}

.am-child-info h3 {
    color: #333;
    margin-bottom: 8px;
}

.am-child-info p {
    color: #666;
    font-size: 14px;
    margin: 4px 0;
}

.am-child-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.am-child-records-summary {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.am-record-count-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    color: white;
}

.am-record-count-badge.assessment { background: #4caf50; }
.am-record-count-badge.plan { background: #66bb6a; }
.am-record-count-badge.daily { background: #ff9800; }
.am-record-count-badge.review { background: #2196f3; }

.am-grade-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
}

.am-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: opacity 0.3s;
}

.am-btn:hover { opacity: 0.8; }
.am-btn-primary { background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%); color: white; }
.am-btn-secondary { background: #4caf50; color: white; }
.am-btn-tertiary { background: #ff9800; color: white; }
.am-btn-quaternary { background: #2196f3; color: white; }
.am-btn-danger-small {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    min-width: auto;
}
.am-btn-danger-small:hover { background: #ffcdd2; opacity: 1; }

.am-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.am-empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.am-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 60vh;
    overflow-y: auto;
}

.am-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s;
}

.am-list-item:hover {
    background: #e8f5e9;
    border-color: #4caf50;
}

.am-list-item-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.am-list-item-info p {
    color: #666;
    font-size: 13px;
    margin: 2px 0;
}

.am-list-item-actions {
    display: flex;
    gap: 10px;
}

.am-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.am-modal.active {
    display: flex;
}

.am-modal-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.am-modal-content h2 {
    color: #2e7d32;
    margin-bottom: 20px;
}

.am-close-modal {
    float: right;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

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

@media (max-width: 768px) {
    .am-child-item {
        grid-template-columns: 1fr;
    }
    .am-child-actions {
        justify-content: flex-start;
    }
    .am-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .am-list-item-actions {
        width: 100%;
    }
    .am-filter-section {
        flex-direction: column;
    }
    .am-filter-section input {
        min-width: auto;
        width: 100%;
    }
}