/* 全域動畫 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 搜尋表單美化 */
#search-form {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08) !important;
    border: 1px solid #e2e8f0 !important;
    animation: fadeInUp 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

#search-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px 16px 0 0;
}

/* 表單標籤美化 */
.form-label {
    color: #4a5568 !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    margin-bottom: 8px !important;
}

/* 表單控件美化 */
.form-select, .form-control {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    transition: all 0.3s ease !important;
    font-size: 15px !important;
    background: #fff !important;
}

.form-select:focus, .form-control:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    outline: none !important;
}

.form-select:hover, .form-control:hover {
    border-color: #cbd5e0 !important;
}

/* 核取方塊美化 */
.form-check-input {
    border: 2px solid #e2e8f0 !important;
    border-radius: 4px !important;
    width: 18px !important;
    height: 18px !important;
}

.form-check-input:checked {
    background-color: #667eea !important;
    border-color: #667eea !important;
}

.form-check-label {
    color: #4a5568 !important;
    font-weight: 500 !important;
    margin-left: 8px !important;
}

/* 主要按鈕美化 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
    color: white !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4) !important;
}

.btn-secondary {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 12px 24px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 12px rgba(160, 174, 192, 0.3) !important;
    color: white !important;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 16px rgba(160, 174, 192, 0.4) !important;
}

/* 類別按鈕美化 */
.btn-outline-primary {
    border: 2px solid #667eea !important;
    color: #667eea !important;
    background: #fff !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    margin: 4px !important;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.btn-outline-primary.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
    color: white !important;
}

.btn-outline-secondary {
    border: 2px solid #a0aec0 !important;
    color: #4a5568 !important;
    background: #fff !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    margin: 4px !important;
}

.btn-outline-secondary:hover {
    background: linear-gradient(135deg, #a0aec0 0%, #718096 100%) !important;
    border-color: #a0aec0 !important;
    color: white !important;
    transform: translateY(-2px) !important;
}

.btn-outline-success {
    border: 2px solid #48bb78 !important;
    color: #48bb78 !important;
    background: #fff !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    margin: 4px !important;
}

.btn-outline-success:hover {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%) !important;
    border-color: #48bb78 !important;
    color: white !important;
    transform: translateY(-2px) !important;
}

/* 按鈕群組美化 */
.btn-group {
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    margin-bottom: 24px !important;
}

/* 週課表提示文字 */
#week_table_prompt {
    margin-top: 8px;
    padding: 12px 14px;
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, #f7f9ff 0%, #eef2ff 100%);
    border-radius: 8px;
    color: #2d3748;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: inset 0 0 0 1px rgba(102, 126, 234, 0.15);
}

#week_table_prompt:empty {
    display: none;
}

#results .card {
    transition: all 0.3s ease !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
    animation: fadeInUp 0.8s ease-out;
}

#results .card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
    border-color: #667eea !important;
}

.card {
    font-size: 15px !important;
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%) !important;
    position: relative !important;
    overflow: hidden !important;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover::before {
    opacity: 1;
}

.card-body {
    padding: 20px !important;
}

.card-title {
    font-size: 18px !important;
    font-weight: 600 !important;
    color: #2d3748 !important;
    margin-bottom: 12px !important;
}

.card-text {
    font-size: 14px !important;
    color: #4a5568 !important;
    line-height: 1.6 !important;
}

.loading-container {
    display: none !important;
    text-align: center;
    margin: 40px 0;
    padding: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(102, 126, 234, 0.1);
    border-top: 6px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

.loading-container p {
    font-size: 18px !important;
    color: #667eea !important;
    margin-top: 16px !important;
    font-weight: 600 !important;
}

.timetable-container {
    width: 100%;
    overflow-x: auto;
    padding: 20px;
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    margin: 20px 0;
}

.timetable-wrapper {
    width: 100%;
    min-width: 800px;
    max-width: 100%;
    margin: auto;
}

.timetable-wrapper table {
    border-collapse: collapse;
    width: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.timetable-wrapper th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 12px;
    font-weight: 600;
    text-align: center;
    border: none;
}

.timetable-wrapper td {
    padding: 12px;
    border: 1px solid #e2e8f0;
    text-align: center;
    transition: background-color 0.2s ease;
}

.timetable-wrapper td:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

/* 結果區域美化 */
#results {
    animation: fadeInUp 1s ease-out;
}

/* 響應式設計 */
@media (max-width: 768px) {
    #search-form {
        margin: 10px;
        padding: 20px !important;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .display-mode {
        border-radius: 8px !important;
        margin-bottom: 8px;
    }
    
    .timetable-container {
        padding: 16px;
        margin: 16px 10px;
    }
    
    .timetable-wrapper {
        min-width: unset;
        width: 100%;
        font-size: 12px;
    }

    .timetable-wrapper table {
        font-size: 12px;
    }

    .timetable-wrapper .small {
        font-size: 10px;
    }
    
    .timetable-wrapper th,
    .timetable-wrapper td {
        padding: 8px 6px;
    }
    
    .card {
        margin-bottom: 16px;
    }
    
    .form-label {
        font-size: 13px !important;
    }
    
    .btn-outline-primary,
    .btn-outline-secondary,
    .btn-outline-success {
        padding: 6px 12px !important;
        font-size: 13px !important;
    }
}
