/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header h1 i {
    margin-right: 15px;
    color: #ffd700;
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Controls section */
.controls {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.search-container {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-container i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 1.1rem;
}

#searchInput {
    width: 100%;
    padding: 15px 15px 15px 50px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

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

.filter-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#sectorFilter, #sortBy {
    padding: 15px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 1rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

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

/* Stats section */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: white;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 1rem;
    color: #666;
    font-weight: 500;
}

/* Table styles */
.table-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 30px;
}

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

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 20px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
}

td {
    padding: 18px 15px;
    font-size: 0.95rem;
}

.ticker {
    font-weight: 700;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.company-name {
    font-weight: 600;
    color: #333;
}

.sector {
    background: #e3f2fd;
    color: #1976d2;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.sub-industry {
    color: #666;
    font-size: 0.9rem;
}

.headquarters {
    color: #666;
    font-size: 0.9rem;
}

.founded {
    color: #666;
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.page-btn {
    padding: 12px 24px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#pageInfo {
    font-weight: 600;
    color: white;
    background: rgba(255,255,255,0.2);
    padding: 12px 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: white;
    opacity: 0.8;
}

/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    font-size: 1.2rem;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        min-width: auto;
    }
    
    .filter-container {
        justify-content: center;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 800px;
    }
    
    th, td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .header h1 i {
        margin-right: 8px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .controls {
        padding: 20px;
    }
    
    #searchInput, #sectorFilter, #sortBy {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    th, td {
        padding: 10px 6px;
        font-size: 0.8rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    }
    
    .controls, .table-container, .stat-item {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    #searchInput, #sectorFilter, #sortBy {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    #searchInput:focus, #sectorFilter:focus, #sortBy:focus {
        background: #2c3e50;
        border-color: #667eea;
    }
    
    tbody tr:hover {
        background: #34495e;
    }
    
    .company-name {
        color: #ecf0f1;
    }
    
    .sub-industry, .headquarters, .founded {
        color: #bdc3c7;
    }
}
