/* 蒙特梭利排課系統樣式 */
/* 2025-10-01 Update */
/* 整體容器 */

.montessori-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 卡片樣式 */
.montessori-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 24px;
}

.montessori-card h3 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.4em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 12px;
}

/* 按鈕樣式 */
.montessori-btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.montessori-btn-primary {
    background-color: #3498db;
    color: white;
}

.montessori-btn-primary:hover {
    background-color: #2980b9;
    color: white;
}

.montessori-btn-success {
    background-color: #27ae60;
    color: white;
}

.montessori-btn-success:hover {
    background-color: #219a52;
}

.montessori-btn-danger {
    background-color: #e74c3c;
    color: white;
}

.montessori-btn-danger:hover {
    background-color: #c0392b;
}

.montessori-btn-warning {
    background-color: #f39c12;
    color: white;
}

.montessori-btn-warning:hover {
    background-color: #d68910;
}

/* 表單樣式 */
.montessori-form {
    display: grid;
    gap: 16px;
    max-width: 600px;
}

.montessori-form-group {
    display: flex;
    flex-direction: column;
}

.montessori-form-group label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 6px;
}

.montessori-form-group input,
.montessori-form-group select,
.montessori-form-group textarea {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.montessori-form-group input:focus,
.montessori-form-group select:focus,
.montessori-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.montessori-form-group textarea {
    min-height: 100px;
    resize: vertical;
}

/* 響應式網格 */
.montessori-grid {
    display: grid;
    gap: 20px;
}

.montessori-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.montessori-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.montessori-grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* 學生卡片 */
.student-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.student-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.student-item h4 {
    margin: 0 0 8px 0;
    color: #2c3e50;
}

.student-item p {
    margin: 4px 0;
    color: #666;
    font-size: 14px;
}

.student-item .actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.student-item .actions button {
    padding: 6px 12px;
    font-size: 12px;
}

/* 原生資料表格樣式 */
.montessori-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.montessori-table th,
.montessori-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.montessori-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

.montessori-table tbody tr:hover {
    background: #f8f9fa;
}

.montessori-table tbody tr:nth-child(even) {
    background: #fdfdfd;
}

.montessori-table tbody tr:nth-child(even):hover {
    background: #f0f0f0;
}

/* 分頁控制 */
.montessori-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 20px 0;
}

.montessori-pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.montessori-pagination button:hover:not(:disabled) {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.montessori-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.montessori-pagination .current {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.montessori-pagination .page-info {
    margin: 0 10px;
    color: #666;
    font-size: 14px;
}

/* 簡單的模態對話框 */
.montessori-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.montessori-modal.show {
    opacity: 1;
    visibility: visible;
}

.montessori-modal-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.montessori-modal.show .montessori-modal-content {
    transform: scale(1);
}

.montessori-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.montessori-modal-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5em;
}

.montessori-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.montessori-modal-close:hover {
    color: #333;
}

.montessori-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

/* 排序指示器 */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    background: #e9ecef;
}

.sortable::after {
    content: "↕";
    position: absolute;
    right: 8px;
    opacity: 0.5;
    font-size: 12px;
}

.sortable.asc::after {
    content: "↑";
    opacity: 1;
    color: #3498db;
}

.sortable.desc::after {
    content: "↓";
    opacity: 1;
    color: #3498db;
}

/* 篩選器樣式 */
.montessori-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.montessori-filters .filter-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.montessori-filters .filter-row:last-child {
    margin-bottom: 0;
}

.montessori-filters label {
    font-weight: 600;
    color: #2c3e50;
    margin-right: 8px;
}

.montessori-filters input,
.montessori-filters select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.montessori-filters input:focus,
.montessori-filters select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* 動作按鈕組 */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-buttons .montessori-btn {
    padding: 6px 12px;
    font-size: 12px;
    min-width: auto;
}

/* 狀態徽章 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.pending {
    background: #fff3cd;
    color: #856404;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state svg,
.empty-state .icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: #2c3e50;
    margin: 0 0 10px;
}

.empty-state p {
    margin: 0 0 20px;
    color: #666;
}

/* 資料載入骨架屏 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.skeleton-row {
    height: 50px;
    margin: 10px 0;
    border-radius: 4px;
}

.skeleton-text {
    height: 20px;
    margin: 8px 0;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.long {
    width: 100%;
}

@keyframes skeleton-loading {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* 響應式表格 */
@media (max-width: 768px) {
    .montessori-table {
        font-size: 14px;
    }
    
    .montessori-table th,
    .montessori-table td {
        padding: 8px 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-buttons .montessori-btn {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .montessori-filters .filter-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .montessori-modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .montessori-pagination {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .montessori-pagination button {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 時間槽樣式 */
.time-slot {
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 4px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-slot:hover {
    background: #f8f9fa;
    border-color: #3498db;
}

.time-slot.occupied {
    background: #e8f4fd;
    border-color: #3498db;
}

.time-slot.conflict {
    background: #fdeaea;
    border-color: #e74c3c;
}

.time-slot .course-name {
    font-weight: 600;
    color: #2c3e50;
}

.time-slot .course-time {
    font-size: 12px;
    color: #666;
}

.time-slot .course-students {
    font-size: 12px;
    color: #27ae60;
}

/* 統計卡片 */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    border-radius: 8px;
    text-align: center;
}

.stats-card h4 {
    margin: 0 0 8px 0;
    font-size: 2.2em;
    font-weight: 700;
}

.stats-card p {
    margin: 0;
    opacity: 0.9;
}

/* 搜尋框 */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-box::after {
    content: "🔍";
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 通知樣式 */
.montessori-notice {
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.montessori-notice.success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.montessori-notice.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.montessori-notice.warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.montessori-notice.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .montessori-container {
        padding: 16px;
    }
    
    .montessori-grid-2,
    .montessori-grid-3,
    .montessori-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .montessori-card {
        padding: 16px;
    }
    
    .student-item .actions {
        flex-direction: column;
    }
    
    .student-item .actions button {
        width: 100%;
    }
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .montessori-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .montessori-card h3 {
        color: #e2e8f0;
        border-bottom-color: #4299e1;
    }
    
    .student-item {
        background: #4a5568;
        border-color: #2d3748;
        color: #e2e8f0;
    }
    
    .time-slot {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}
/* 解決頁面管理選單區塊太小問題 */
.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}
/* 2025-10-01 加入以處理課程管理頁面搜尋工具的版面 */
.montessori-filters .filter-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.montessori-filters .filter-row label {
    margin: 0;
    white-space: nowrap;
}

.montessori-filters .filter-row input[type="text"] {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.montessori-filters .filter-row select {
    min-width: 150px;
}

.montessori-filters .filter-row button {
    margin-left: auto;
}

/* 響應式：小螢幕時仍然垂直排列 */
@media (max-width: 768px) {
    .montessori-filters .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .montessori-filters .filter-row input[type="text"],
    .montessori-filters .filter-row select {
        width: 100%;
        max-width: none;
    }
}/* 搜尋與篩選區域橫式排列 */
.montessori-filters {
    width: 100%;
}

.montessori-filters .filter-row {
    display: grid;
    grid-template-columns: 150px 250px auto 150px auto 150px auto 150px auto;
    align-items: center;
    gap: 100px;
}

.montessori-filters .filter-row label {
    margin: 0;
    font-weight: 500;
}

.montessori-filters .filter-row input[type="text"] {
    width: 100%;
}

.montessori-filters .filter-row select {
    width: 100%;
}

.montessori-filters .filter-row button {
    white-space: nowrap;
}

/* 響應式設計 */
@media (max-width: 992px) {
    .montessori-filters .filter-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* 分頁按鈕樣式修正 */
.montessori-pagination button,
#pagination-controls button,
#pagination button {
    background-color: #f8f9fa;
    color: #333333;
    border: 1px solid #dee2e6;
    padding: 8px 16px;
    margin: 0 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.montessori-pagination button:hover,
#pagination-controls button:hover,
#pagination button:hover {
    background-color: #046bd2;
    color: #ffffff;
    border-color: #046bd2;
}

.montessori-pagination button.current,
#pagination-controls button.current,
#pagination button.current {
    background-color: #046bd2;
    color: #ffffff;
    border-color: #046bd2;
    font-weight: 600;
}

.montessori-pagination button:disabled,
#pagination-controls button:disabled,
#pagination button:disabled {
    background-color: #e9ecef;
    color: #6c757d;
    border-color: #dee2e6;
    cursor: not-allowed;
    opacity: 0.6;
}

.montessori-pagination .page-info,
#pagination-controls .page-info,
#pagination .page-info {
    color: #333333;
    margin-left: 15px;
    font-size: 14px;
}
/* ========== 🆕 跨層級拖曳視覺樣式 (2025-10-13) ========== */

/* 被拖曳的節點 */
.tree-node.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    z-index: 1000;
    border: 2px dashed #2196f3 !important;
}

/* 有效的放置目標 - 高亮顯示 */
.tree-node.valid-drop-target {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
    border: 2px solid #2196f3 !important;
    box-shadow: 0 0 12px rgba(33, 150, 243, 0.5);
    transform: scale(1.02);
    transition: all 0.3s ease;
    cursor: pointer;
}

.tree-node.valid-drop-target::before {
    content: '✓ 可放置於此';
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #4caf50;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* 無效的放置目標 - 變灰+禁止圖標 */
.tree-node.invalid-drop-target {
    opacity: 0.4;
    filter: grayscale(100%);
    cursor: not-allowed;
    pointer-events: none;
    position: relative;
}

.tree-node.invalid-drop-target::after {
    content: '🚫';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    font-size: 20px;
    opacity: 0.6;
}

/* 拖曳懸停在有效目標上 */
.tree-node.drag-over {
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%) !important;
    border: 3px solid #ffc107 !important;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
}

.tree-node.drag-over::before {
    content: '↓ 放開以移動到此';
    background: #ff9800;
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
}

/* 載入中訊息 */
.drag-notice.loading {
    background: #2196f3;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    position: fixed;
    top: 20px;
    right: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    animation: slideInRight 0.3s ease;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 成功訊息樣式增強 */
.drag-notice.success {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    white-space: pre-line;
    max-width: 400px;
    line-height: 1.6;
}

/* 錯誤訊息樣式增強 */
.drag-notice.error {
    background: linear-gradient(135deg, #f44336 0%, #e57373 100%);
    max-width: 400px;
}

/* 拖曳手柄樣式優化 */
.drag-handle {
    font-size: 16px;
    color: #666;
    cursor: grab;
    padding: 4px 8px;
    margin-right: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    user-select: none;
}

.drag-handle:hover {
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
    transform: scale(1.2);
}

.drag-handle:active {
    cursor: grabbing;
    background: rgba(33, 150, 243, 0.2);
}

/* 樹狀節點拖曳時的整體樣式 */
.tree-node[draggable="true"] {
    position: relative;
    transition: all 0.3s ease;
}

.tree-node[draggable="true"]:not(.dragging):hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
