/* 时间线规划页面专用样式 */

/* 时间线提交按钮禁用状态样式 */
#btn-generate:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%) !important;
    border-color: #9ca3af !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

#btn-generate:disabled:hover {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%) !important;
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

#btn-generate:disabled .btn-icon,
#btn-generate:disabled .btn-text {
    color: #ffffff !important;
}

/* ✱✱ 修改开始：CSS变量和布局控制 ✱✱ */
:root { 
    --tl-col-width: 40px; /* 缩小刻度长度，使时间轴更紧凑 */
}

/* 让 planner-main 在 flex 布局里愿意收缩 */
#planner-main { 
    min-width: 0; 
}

/* 确保form-row在合适屏幕下并排显示 */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
/* ✱✱ 修改结束 ✱✱ */

/* 时间线容器样式 */
.timeline-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    /* 确保容器本身不会溢出 */
    max-width: 100%;
    overflow: hidden;
}

/* Gantt图时间线横向滚动容器 - 仅此区域可横向滚动 */
.timeline-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%; /* 确保不会超出父容器 */
    border-radius: 8px;
    background: #ffffff;
    position: relative;
    /* 自定义滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
    /* 确保容器边界清晰 */
    border: 1px solid #f3f4f6;
    margin: 16px 0;
}

.timeline-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.timeline-scroll-container::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 4px;
}

.timeline-scroll-container::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

.timeline-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* ✱✱ 修改开始：timeline-content 不再硬性 800px，改成随列数自动 ✱✱ */
.timeline-content {
    min-width: 100%; /* 原有 min-width: 800px; 改为 */
    width: max-content; /* 根据实际内容自动调整宽度 */
    padding: 16px;
    box-sizing: border-box;
}
/* ✱✱ 修改结束 ✱✱ */

/* 时间线滚动提示 */
.timeline-scroll-container::after {
    content: "← 横向滑动查看完整时间线 →";
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
}

.timeline-scroll-container:hover::after {
    opacity: 1;
}

/* 只在需要滚动时显示提示 */
.timeline-scroll-container[data-scrollable="true"]::after {
    opacity: 0.8;
}

/* 加载动画 */
.loading-spinner {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 20px auto;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid #f3f4f6;
    border-top-color: #10a37f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-center {
    position: absolute;
    inset: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10a37f;
}

.spinner-center svg {
    width: 24px;
    height: 24px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 中等屏幕优化 (1200px及以下) */
@media (max-width: 1200px) {
    .timeline-container {
        max-width: 100%;
        padding: 16px;
        margin: 16px 0;
    }
    
    .timeline-content {
        min-width: 100%;
        padding: 12px;
    }
    
    #profile-side { 
        width: 100%;
        margin-bottom: 20px;
    }
    
    /* 确保时间线在中等屏幕上正确显示 */
    .timeline-scroll-container {
        max-width: 100%;
        overflow-x: auto;
    }
}

/* 移动端优化 (768px及以下) */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .timeline-container {
        padding: 12px;
        margin: 12px 0;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .timeline-scroll-container {
        margin: 12px 0;
        border-radius: 6px;
        max-width: 100%;
        /* 改善移动端横向滚动体验 */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .timeline-scroll-container::-webkit-scrollbar {
        height: 10px;
    }
    
    .timeline-scroll-container::-webkit-scrollbar-track {
        background: #f1f5f9;
        border-radius: 5px;
    }
    
    .timeline-scroll-container::-webkit-scrollbar-thumb {
        background: #94a3b8;
        border-radius: 5px;
    }
    
    .timeline-content {
        min-width: max-content;
        width: max-content;
        padding: 8px;
        /* 确保时间线内容在移动端可以正确横向滚动 */
    }
    
    /* 移动端时间线表格优化 */
    .timeline-table {
        font-size: 14px;
        border-spacing: 2px;
    }
    
    .timeline-cell {
        min-width: 30px;
        padding: 4px 2px;
        font-size: 12px;
    }
    
    .timeline-year-label,
    .timeline-month-label {
        font-size: 12px;
        padding: 4px 6px;
    }
    
    /* 移动端加载动画优化 */
    .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    .spinner-center {
        inset: 10px;
    }
    
    .spinner-center svg {
        width: 20px;
        height: 20px;
    }
    
    /* 移动端滚动提示优化 */
    .timeline-scroll-container::after {
        content: "← 左右滑动查看完整时间线 →";
        font-size: 12px;
        bottom: -20px;
        color: #64748b;
        font-weight: 500;
    }
}

/* 小屏幕移动端优化 (480px及以下) */
@media (max-width: 480px) {
    .timeline-container {
        padding: 8px;
        margin: 8px 0;
        border-radius: 6px;
    }
    
    .timeline-scroll-container {
        -webkit-overflow-scrolling: touch;
        margin: 8px 0;
        border-radius: 4px;
    }
    
    .timeline-scroll-container::-webkit-scrollbar {
        height: 12px;
    }
    
    .timeline-scroll-container::-webkit-scrollbar-thumb {
        background: #64748b;
        border-radius: 6px;
    }
    
    .timeline-content {
        min-width: max-content;
        width: max-content;
        padding: 6px;
    }
    
    /* 小屏幕时间线表格进一步优化 */
    .timeline-table {
        font-size: 13px;
        border-spacing: 1px;
    }
    
    .timeline-cell {
        min-width: 28px;
        padding: 3px 1px;
        font-size: 11px;
    }
    
    .timeline-year-label,
    .timeline-month-label {
        font-size: 11px;
        padding: 3px 4px;
        white-space: nowrap;
    }
    
    /* 小屏幕滚动提示 */
    .timeline-scroll-container::after {
        content: "← 滑动查看时间线 →";
        font-size: 11px;
        bottom: -18px;
        color: #64748b;
        font-weight: 500;
    }
    
    .timeline-scroll-container[data-scrollable="true"]::after {
        opacity: 1;
    }
    
    /* 小屏幕表单优化 */
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .form-input,
    .form-select {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 8px 12px;
    }
}

/* 表单响应式优化 - 确保学制信息在小屏幕上换行 */
@media (max-width: 320px) {
    .form-row {
        grid-template-columns: 1fr; /* 在极小屏幕上堆叠显示 */
        gap: 12px;
    }
    
    .timeline-container {
        padding: 6px;
    }
    
    .timeline-content {
        min-width: 100%; /* 极小设备也避免横向滚动 */
        width: 100%;
        padding: 6px;
        overflow-x: visible;
    }
    
    .timeline-scroll-container::after {
        content: "← 滑动 →";
        font-size: 10px;
        bottom: -16px;
    }
}

/* 针对侧栏的特定布局优化 */
#profile-side .form-row {
    /* 确保在侧栏内并排显示 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* 只在非常小的屏幕上堆叠 */
@media (max-width: 320px) {
    #profile-side .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* 确保时间线项目正确显示且不影响外部布局 */
.timeline-content > div {
    white-space: nowrap;
    overflow: visible;
}

/* 确保时间线不会破坏页面的整体布局 */
.timeline-container,
.timeline-scroll-container {
    box-sizing: border-box;
}

.timeline-container {
    /* 防止时间线容器影响页面padding */
    contain: layout style;
} 