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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "微軟正黑體", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Tabs */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    color: #6c757d;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.tab-content {
    display: none;
}

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

.filters {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.search-box {
    margin-bottom: 20px;
}

#searchInput {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.filter-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-clear {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-clear:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.stats {
    padding: 15px 30px;
    background: #f8f9fa;
    color: #6c757d;
}

.stats strong {
    color: #495057;
}

.results {
    padding: 20px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: top;
}

tr:hover {
    background: #f8f9fa;
}

.area-cell {
    font-weight: 500;
    color: #667eea;
    white-space: nowrap;
}

.multiple-zones {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
    cursor: help;
}

.all-zones {
    background: #28a745;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
}

.org-cell {
    font-weight: 500;
    max-width: 250px;
}

.time-cell, .service-cell {
    font-size: 14px;
    line-height: 1.6;
    max-width: 300px;
}

.contact-cell {
    font-size: 14px;
    max-width: 200px;
}

.contact-cell strong {
    color: #495057;
}

.remark-cell {
    font-size: 13px;
    color: #6c757d;
    max-width: 150px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
    font-size: 18px;
}

/* School selector */
.school-selector {
    padding: 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.school-selector label {
    display: inline-block;
    margin-right: 15px;
    font-weight: 500;
    color: #495057;
}

.school-selector select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    font-size: 15px;
    cursor: pointer;
    min-width: 200px;
    transition: all 0.3s;
}

.school-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.school-results {
    padding: 30px;
}

.school-info {
    margin-bottom: 30px;
}

.school-name {
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 20px;
}

.student-list {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.student-list h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #495057;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.student-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    text-align: center;
    font-size: 14px;
    color: #495057;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .btn-clear {
        width: 100%;
        margin-top: 10px;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 8px 5px;
    }
    
    .time-cell, .service-cell, .contact-cell {
        max-width: 200px;
    }
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

tbody tr {
    animation: fadeIn 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Loading spinner */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Credit button */
.credit-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px 15px;
    font-size: 12px;
    text-decoration: none;
    color: #666;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.credit-button:hover {
    background: white;
    color: #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-decoration: none;
}

@media (max-width: 768px) {
    .credit-button {
        bottom: 10px;
        left: 10px;
        font-size: 11px;
        padding: 8px 12px;
        max-width: calc(100vw - 40px);
    }
}