:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* Header */
.header {
    text-align: center;
    padding: 24px 0 20px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Search Card */
.search-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.search-form {
    display: flex;
    gap: 12px;
}

.form-group {
    flex: 1;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Results */
.results-section {
    margin-top: 8px;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.results-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.results-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Order Card - Collapsible */
.order-card {
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.order-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.order-toggle:hover {
    background: var(--surface-hover);
}

.order-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.order-phone {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.order-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.order-toggle-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.order-card.expanded .order-toggle-icon {
    transform: rotate(180deg);
}

/* Course List */
.order-content {
    display: none;
    border-top: 1px solid var(--border);
}

.order-card.expanded .order-content {
    display: block;
}

.course-list {
    padding: 8px;
}

.course-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.course-item:hover {
    background: var(--surface-hover);
}

.course-info {
    flex: 1;
    min-width: 0;
}

.course-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-remarks {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.4;
}

/* Progress Bar */
.progress-bar-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar-fill.complete {
    background: var(--success);
}

.progress-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 36px;
    text-align: right;
}

/* Status Tag */
.course-status {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.course-status.status-queue {
    background: var(--warning-light);
    color: #b45309;
}

.course-status.status-done {
    background: var(--success-light);
    color: #15803d;
}

.course-status.status-progress {
    background: var(--primary-light);
    color: var(--primary-hover);
}

/* Refresh Button */
.btn-refresh {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--surface);
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-refresh:hover {
    background: var(--primary-color);
    color: white;
}

.btn-refresh:active {
    transform: scale(0.95);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.875rem;
}

/* Error Message */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--error);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 16px 0;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        padding: 14px;
    }
    
    .course-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .btn-refresh {
        width: 100%;
        margin-top: 4px;
        padding: 10px;
    }
}

/* Hide label on mobile for cleaner look */
.form-group label {
    display: none;
}

/* Smooth animations */
.order-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
