/* スマホ対応とファイル表示の改善 */

/* データ管理セクションを条件付きで非表示 */
.data-management {
    display: none; /* デフォルトで非表示 */
}

.show-data-management .data-management {
    display: block;
}

/* 添付ファイル表示の改善 */
.attachment-section {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.attachment-section h4 {
    margin: 0 0 10px 0;
    color: var(--primary-color);
    font-size: 16px;
}

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 10px 0;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin: 8px 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

.attachment-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.attachment-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.attachment-name {
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.attachment-name:hover {
    text-decoration: underline;
}

.attachment-meta {
    font-size: 12px;
    color: #666;
}

.attachment-icon {
    width: 40px;
    height: 40px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--secondary-color);
    color: white;
    border-radius: 8px;
    font-size: 18px;
}

/* ファイルタイプ別アイコン */
.attachment-icon.pdf { background-color: #dc3545; }
.attachment-icon.image { background-color: #28a745; }
.attachment-icon.doc { background-color: #007bff; }
.attachment-icon.default { background-color: #6c757d; }

/* 改善されたモバイル対応 */
@media (max-width: 768px) {
    .container {
        padding: 5px;
        margin: 0;
    }

    header {
        padding: 15px 0;
    }

    h1 {
        font-size: 18px;
        margin: 0;
    }

    .calendar-controls {
        flex-direction: column;
        gap: 15px;
        margin: 15px 0;
    }

    .month-navigation {
        order: 0;
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .month-navigation button {
        padding: 12px 20px;
        font-size: 14px;
        flex: 1;
        max-width: 120px;
    }

    .current-month {
        font-size: 16px;
        font-weight: bold;
        text-align: center;
        min-width: 120px;
    }

    .grade-filter {
        order: 1;
        justify-content: center;
    }

    .action-buttons {
        order: 2;
        width: 100%;
        justify-content: center;
        gap: 8px;
    }

    .action-buttons button {
        padding: 10px 15px;
        font-size: 13px;
    }

    .legend {
        flex-direction: column;
        gap: 15px;
        margin: 15px 0;
        padding: 12px;
    }

    .legend-section {
        text-align: center;
    }

    .legend-items {
        justify-content: center;
        gap: 10px;
    }

    .calendar {
        margin: 15px 0;
    }

    .calendar-grid {
        gap: 1px;
    }

    .calendar-header {
        font-size: 12px;
        padding: 8px 2px;
        font-weight: bold;
    }

    .calendar-day {
        min-height: 80px;
        padding: 4px;
        font-size: 12px;
    }

    .day-number {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .event {
        font-size: 10px;
        padding: 3px 5px;
        margin: 2px 0;
        line-height: 1.2;
        min-height: 20px;
    }

    .event .grade-badge {
        width: 14px;
        height: 14px;
        line-height: 14px;
        font-size: 8px;
        top: 1px;
        right: 1px;
    }

    .event .participant-count {
        font-size: 9px;
        padding: 1px 3px;
        right: 16px;
    }

    /* モーダルの改善 */
    .modal-content {
        margin: 10px;
        padding: 15px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-title {
        font-size: 18px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* iOSのズーム防止 */
        padding: 12px;
    }

    /* 特別予定セクション */
    .special-events-section {
        margin: 15px 5px;
        padding: 12px;
    }

    .special-events-section h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .special-event-item {
        padding: 12px;
        margin: 10px 0;
    }

    .special-event-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .special-event-actions {
        width: 100%;
        gap: 8px;
    }

    .detail-btn, .participate-btn {
        width: 100%;
        padding: 12px;
        font-size: 14px;
    }

    /* 管理パネル */
    .admin-panel {
        margin: 15px 5px;
        padding: 15px;
    }

    .admin-panel-header h2 {
        font-size: 16px;
    }

    .event-list {
        max-height: 300px;
    }

    .event-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .event-actions {
        width: 100%;
        justify-content: stretch;
    }

    .event-actions button {
        flex: 1;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* データ管理セクションを小さく */
    .data-management {
        padding: 12px;
        margin-top: 15px;
    }

    .data-management h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .data-management button {
        font-size: 12px;
        padding: 8px 12px;
        margin: 5px;
    }

    /* 添付ファイル */
    .attachment-section {
        margin: 10px 0;
        padding: 10px;
    }

    .attachment-item {
        flex-direction: row;
        padding: 10px;
    }

    .attachment-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        margin-right: 8px;
    }

    .attachment-info {
        font-size: 13px;
    }

    .attachment-name {
        font-size: 14px;
    }

    .attachment-meta {
        font-size: 11px;
    }

    /* ユーザー情報 */
    .user-info {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }

    /* フッター */
    .footer {
        padding: 15px 10px;
        font-size: 12px;
    }
}

/* 極小スマホ対応 */
@media (max-width: 320px) {
    .container {
        padding: 3px;
    }

    .calendar-day {
        min-height: 70px;
        padding: 2px;
    }

    .event {
        font-size: 9px;
        padding: 2px 3px;
        margin: 1px 0;
        min-height: 18px;
    }

    .month-navigation button {
        padding: 8px 12px;
        font-size: 12px;
    }

    .current-month {
        font-size: 14px;
    }
}

/* 添付ファイルダウンロードボタンの改善 */
.download-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.download-btn:hover {
    background-color: #27ae60;
    transform: translateY(-1px);
}

/* データ管理トグルボタン */
.data-management-toggle {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 10px;
}

.data-management-toggle:hover {
    background-color: #5a6268;
}