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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --card-bg: #ffffff;
    --accent-color: #3b82f6;
    --hover-bg: #f1f5f9;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --table-stripe: #f8fafc;
    --search-bg: #ffffff;
    --price-color: #3b82f6;
    --price-secondary: #1e40af;
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #242424;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --border-color: #333333;
    --card-bg: #242424;
    --accent-color: #60a5fa;
    --hover-bg: #2a2a2a;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.8), 0 1px 2px -1px rgb(0 0 0 / 0.8);
    --table-stripe: #2a2a2a;
    --search-bg: #242424;
    --price-color: #60a5fa;
    --price-secondary: #93c5fd;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 25px;
    width: auto;
    max-width: 200px;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-primary);
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle:hover {
    background: var(--hover-bg);
}

.theme-icon {
    width: 16px;
    height: 16px;
    fill: var(--text-secondary);
}

main {
    padding: 1rem 0;
}

.header-search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 2rem;
}

.header-search-container h1 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex: 1;
}

.search-container {
    margin-bottom: 0;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.search-box {
    width: 300px;
    max-width: 300px;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--search-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.table-container {
    background: var(--card-bg);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-wrapper {
    overflow-x: auto;
}

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

table th:nth-child(1),
table td:nth-child(1) {
    width: 35%; 
}

table th:nth-child(2),
table td:nth-child(2) {
    width: 20%;
}

table th:nth-child(3),
table td:nth-child(3) {
    width: 45%;
}

th {
    background: var(--bg-secondary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

th:hover {
    background: var(--hover-bg);
}

th .sort-icon {
    margin-left: 0.25rem;
    opacity: 0.6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    transition: all 0.2s ease;
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    th .sort-icon {
        margin-left: 0.1rem;
        width: 12px;
        height: 12px;
    }
}

th:hover .sort-icon {
    opacity: 0.8;
    transform: scale(1.1);
}

th.sorted .sort-icon {
    opacity: 1;
    color: var(--accent-color);
    transform: scale(1.15);
}

.sort-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    display: block;
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
}

tr:nth-child(even) {
    background: var(--table-stripe);
}

tr:hover {
    background: var(--hover-bg);
}

.network-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
    transform: translateX(0);
    min-width: 0; 
}

.network-link:hover {
    color: var(--accent-color);
    transform: translateX(4px);
}

.network-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    flex-shrink: 0; 
}

.network-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.price {
    font-weight: 600;
    color: var(--price-color);
    font-size: 1.1rem;
}

.price-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    justify-content: center;
    min-height: 2.5rem;
}

.price-item {
    font-size: 1rem; 
    color: var(--text-secondary);
    line-height: 1.3;
}

.price-item strong {
    color: var(--price-color);
    font-weight: 600;
}

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

.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

.update-info {
    margin-top: 2rem;
    text-align: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
}

.update-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

.update-text a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.update-text a:hover {
    color: var(--price-secondary);
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-search-container {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-search-container h1 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .search-container {
        justify-content: center;
    }
    
    .search-box {
        width: 100%;
        max-width: 100%;
    }
    
    .header-content {
        gap: 1rem;
        flex-direction: row;
    }

    th, td {
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    th {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    th .sort-icon {
        margin-left: 0.1rem;
        font-size: 0.6rem;
    }

    .brand-text {
        font-size: 1.125rem;
    }

    .logo {
        width: auto;
        height: 20px;
    }

    .network-logo {
        width: 30px;
        height: 30px;
    }

    .network-link {
        gap: 0.25rem;
    }

    .price {
        font-size: 0.9rem;
    }
    
    .price-item {
        font-size: 0.8rem;
    }
    
    table th:nth-child(1),
    table td:nth-child(1) {
        width: 35%;
    }

    table th:nth-child(2),
    table td:nth-child(2) {
        width: 25%;
    }

    table th:nth-child(3),
    table td:nth-child(3) {
        width: 40%;
    }
}