* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: white;
    padding: 30px 40px;
    margin-bottom: 30px;
    text-align: center;
}

.clinic-name {
    font-size: 36px;
    font-weight: 700;
    color: #5A5A5A;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.clinic-subtitle {
    font-size: 16px;
    color: #dc2626;
    font-weight: 600;
    line-height: 1.4;
}

/* Enhanced Search Container with Sticky Behavior */
.search-container {
    background: white;
    padding: 25px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: sticky;
    top: 10px;
    z-index: 1000;
}

.search-container:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    transform: translateY(-1px);
    border-color: #cbd5e1;
}

/* Compact sticky state */
.search-container.sticky-compact {
    padding: 15px 25px;
    margin-bottom: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
}

.search-container.sticky-compact .search-help {
    display: none;
}

.search-container.sticky-compact .search-performance {
    font-size: 11px;
    margin-top: 5px;
}

.search-container.sticky-compact .search-input {
    padding: 14px 60px 14px 20px;
    font-size: 15px;
}

.search-container.sticky-compact .search-status {
    margin-top: 8px;
    font-size: 13px;
}

/* Enhanced Search Box */
.search-box {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Enhanced Search Input */
.search-input {
    width: 100%;
    padding: 18px 60px 18px 24px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    color: #1e293b;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
    font-weight: 400;
    letter-spacing: 0.2px;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.04),
        0 0 0 4px rgba(59, 130, 246, 0.1),
        0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.search-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f1f5f9;
}

.search-input::placeholder {
    color: #64748b;
    font-weight: 400;
    transition: color 0.3s ease;
}

.search-input:focus::placeholder {
    color: #94a3b8;
}

/* Enhanced Search Icon */
.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    font-size: 20px;
    transition: all 0.3s ease;
}

.search-input:focus + .search-icon {
    color: #3b82f6;
    transform: translateY(-50%) scale(1.1);
}

/* Clear Search Button - Fixed Position */
.search-clear {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-clear.visible {
    opacity: 1;
}

.search-clear:hover {
    color: #dc2626;
    background: #fef2f2;
}

/* Search Status Indicators */
.search-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 14px;
    color: #64748b;
    transition: all 0.3s ease;
}

.search-status.searching {
    color: #3b82f6;
}

.search-status.error {
    color: #dc2626;
}

.search-status.success {
    color: #059669;
}

/* Loading Spinner for Search */
.search-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.search-status.searching .search-spinner {
    display: inline-block;
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-suggestion {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.search-suggestion:hover,
.search-suggestion.highlighted {
    background: #f8fafc;
}

.search-suggestion:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.search-suggestion strong {
    color: #3b82f6;
    font-weight: 600;
}

/* Search Performance Display */
.search-performance {
    margin-top: 8px;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-performance.visible {
    opacity: 1;
}

/* Keyboard Shortcuts Hint */
.search-shortcuts {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 11px;
    color: #94a3b8;
    background: rgba(255,255,255,0.9);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-box:hover .search-shortcuts {
    opacity: 1;
}

/* Table Container */
#tableContainer {
    position: relative;
    z-index: 1;
}

.search-results-info {
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    color: #64748b;
}

.highlight {
    background: #fef3c7;
    color: #92400e;
    padding: 1px 2px;
    border-radius: 2px;
}

.warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
    text-align: center;
}

.stats-bar {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.stat-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background: #fef2f2;
    color: #dc2626;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #fecaca;
    margin: 20px 0;
    text-align: center;
}

.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-mode-indicator {
    background: #dbeafe;
    color: #1d4ed8;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
    display: none;
}

/* Progress Bar Styles */
.progress-bar-container {
    width: 100%;
    height: 20px;
    background-color: #e2e8f0;
    border-radius: 10px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #3b82f6;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 20px;
}

#loadingProgressContainer {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .clinic-name {
        font-size: 28px;
    }
    
    .clinic-subtitle {
        font-size: 14px;
    }
    
    .search-container {
        padding: 20px;
        margin: 0 10px 20px;
        border-radius: 12px;
    }
    
    .search-input {
        padding: 16px 50px 16px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .search-icon {
        right: 16px;
        font-size: 18px;
    }
    
    .search-clear {
        right: 40px;
    }
    
    .search-shortcuts {
        display: none;
    }
    
    .stats-bar {
        gap: 20px;
        flex-wrap: wrap;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .search-container {
        background: rgba(30, 41, 59, 0.95);
        border-color: rgba(255,255,255,0.1);
    }
    
    .search-input {
        background: rgba(15, 23, 42, 0.6);
        color: #e2e8f0;
        border-color: rgba(255,255,255,0.1);
    }
    
    .search-input:focus {
        background: rgba(15, 23, 42, 0.8);
        border-color: #60a5fa;
    }
    
    .search-suggestions {
        background: #1e293b;
        border-color: rgba(255,255,255,0.1);
    }
    
    .search-suggestion:hover {
        background: rgba(255,255,255,0.05);
    }
}