/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force light theme regardless of system preferences */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff !important;
    min-height: 100vh;
    color: #1d1d1f !important;
    line-height: 1.6;
}

/* Override system color scheme preferences */
:root {
    color-scheme: light !important;
}

/* Force light theme for all browsers */
@media (prefers-color-scheme: dark) {
    body {
        background: #ffffff !important;
        color: #1d1d1f !important;
    }
    
    .container {
        background: #ffffff !important;
    }
    
    .search-section {
        background: #ffffff !important;
    }
    
    .cid-item {
        background: #ffffff !important;
        color: #1d1d1f !important;
        border-color: #e0e0e0 !important;
    }
    
    .footer {
        background: #ffffff !important;
        color: #1d1d1f !important;
        border-color: #e0e0e0 !important;
    }
    
    .search-box {
        background: #f8f9fa !important;
        color: #1d1d1f !important;
        border-color: #e0e0e0 !important;
    }
    
    .search-box:focus-within {
        background: #ffffff !important;
    }
    
    .empty-state h3,
    .cid-description {
        color: #1d1d1f !important;
    }
}

.container {
    max-width: 100%;
    min-height: 100vh;
    background: #ffffff !important;
}

/* Header */
.header {
    background: linear-gradient(135deg, #007AFF 0%, #0056cc 100%);
    color: white;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 122, 255, 0.3);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.app-info h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-info p {
    opacity: 0.9;
    font-size: 14px;
}

.import-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Search Section */
.search-section {
    background: #ffffff;
    padding: 30px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.results-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
}

.results-per-page label {
    font-weight: 500;
    color: #1d1d1f;
    font-size: 14px;
}

.results-per-page select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #ffffff;
    color: #1d1d1f;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.results-per-page select:focus {
    outline: none;
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 16px 20px;
    transition: all 0.3s;
    margin-bottom: 15px;
}

.search-box:focus-within {
    border-color: #007AFF;
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
    background: white;
}

.search-box i {
    color: #86868b;
    font-size: 18px;
    margin-right: 15px;
}

.search-box input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    font-size: 16px;
    color: #1d1d1f;
}

.search-box input::placeholder {
    color: #86868b;
}

.clear-btn {
    background: none;
    border: none;
    color: #86868b;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #f0f0f0;
    color: #1d1d1f;
}

.search-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #86868b;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 400px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
    color: #86868b;
}

.loading-spinner {
    font-size: 48px;
    margin-bottom: 20px;
    color: #007AFF;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #86868b;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #1d1d1f;
}

.empty-state p {
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.primary-btn {
    background: #007AFF;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.primary-btn:hover {
    background: #0056cc;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
}

/* Results List */
.results-list {
    display: grid;
    gap: 15px;
}

.cid-item {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    border-left: 4px solid #007AFF;
    cursor: pointer;
    border: 1px solid #e0e0e0;
}

.cid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.cid-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.cid-code {
    background: #007AFF;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    flex-shrink: 0;
}

.cid-description {
    flex: 1;
    color: #1d1d1f;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

.cid-description strong {
    font-weight: 600;
    color: #007AFF;
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 30px;
}

.load-more-btn {
    background: white;
    color: #007AFF;
    border: 2px solid #007AFF;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.load-more-btn:hover {
    background: #007AFF;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3);
}

/* Footer */
.footer {
    background: #ffffff;
    text-align: center;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    color: #86868b;
    font-size: 14px;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-icon {
    font-size: 20px;
}

.toast.success .toast-icon {
    color: #34c759;
}

.toast.error .toast-icon {
    color: #ff3b30;
}

.toast.info .toast-icon {
    color: #007AFF;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .app-info h1 {
        font-size: 24px;
    }

    .search-controls {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .results-per-page {
        justify-content: center;
    }

    .search-box {
        padding: 14px 16px;
    }

    .search-box input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .cid-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .cid-code {
        align-self: flex-start;
    }

    .toast {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
}

/* PWA Styles */
@media (display-mode: standalone) {
    .header {
        padding-top: 40px; /* Account for notch */
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .container {
        background: #000;
    }
    
    .search-section,
    .main-content .cid-item,
    .footer {
        background: #1c1c1e;
        border-color: #38383a;
    }
    
    .search-box {
        background: #2c2c2e;
        border-color: #38383a;
        color: white;
    }
    
    .search-box:focus-within {
        background: #1c1c1e;
    }
    
    .empty-state h3,
    .cid-description {
        color: white;
    }
}
