/* Global Styles */
body {
    background: #f8f9fa;
    min-height: 100vh;
    color: #2d3748;
}

/* Typography */
.title {
    color: #1a202c;
    font-weight: 600;
    letter-spacing: -0.5px;
    font-size: 2rem;
    margin-bottom: 2rem;
}

/* Container Styles */
.box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

/* Filter Styles */
.filters-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    min-width: 0;
    padding-top: 0.5rem;
}

.filters-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-actions {
    display: flex;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-group label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #64748b;
    margin-right: 0.25rem;
}

.filter-group .input {
    width: 40px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    transition: all 0.2s ease;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    background: #ffffff;
}

.filter-group #price-max {
    width: 60px;
}

/* Search row styles */
.search-row {
    margin-bottom: 1.5rem;
}

.search-row .input {
    width: 100%;
    max-width: 400px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.filter-group .input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.filter-group .checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #4a5568;
    cursor: pointer;
}

.filter-group .checkbox input[type="checkbox"] {
    cursor: pointer;
}

.filter-group .buttons {
    margin: 0;
    height: 30px;
}

.filter-group .buttons .button {
    height: 30px;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 30px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #64748b;
    transition: all 0.2s ease;
}

.filter-group .buttons .button:hover:not(.is-selected) {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.filter-group .buttons .button.is-info {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

/* Table Styles */
.table-container {
    margin-top: 1.5rem;
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table {
    background: transparent;
    table-layout: auto;
}

/* Column width optimization */
.table th:nth-child(1), /* Model (combined) */
.table td:nth-child(1) {
    min-width: 200px;
}

.table th:nth-child(2), /* Category */
.table td:nth-child(2) {
    width: 90px;
}

/* Port columns - narrow */
.table th:nth-child(3), /* GigE */
.table td:nth-child(3),
.table th:nth-child(4), /* 2.5G */
.table td:nth-child(4),
.table th:nth-child(5), /* 10G */
.table td:nth-child(5),
.table th:nth-child(6), /* Combo */
.table td:nth-child(6),
.table th:nth-child(7), /* SFP */
.table td:nth-child(7),
.table th:nth-child(8), /* SFP+ */
.table td:nth-child(8),
.table th:nth-child(9), /* SFP28 */
.table td:nth-child(9),
.table th:nth-child(10), /* QSFP+ */
.table td:nth-child(10),
.table th:nth-child(11), /* QSFP28 */
.table td:nth-child(11) {
    width: 50px;
    text-align: center;
}

.table th:nth-child(12), /* CPU */
.table td:nth-child(12) {
    min-width: 100px;
    max-width: 150px;
}

.table th:nth-child(13), /* RAM */
.table td:nth-child(13),
.table th:nth-child(14), /* Storage */
.table td:nth-child(14) {
    width: 80px;
    white-space: nowrap;
}

.table th:nth-child(15), /* RRP */
.table td:nth-child(15) {
    width: 80px;
    text-align: right;
    font-weight: 500;
}

.table th:nth-child(16), /* Buy */
.table td:nth-child(16) {
    width: 70px;
}

.table thead th {
    background: #f8fafc;
    color: #1a202c;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #000000;
    user-select: none;
    padding: 0.75rem;
}

.table thead th:first-child {
    padding-left: 1.75rem;
}

.table thead th:last-child {
    padding-right: 1.75rem;
}

.table thead th:not(:last-child):hover {
    background: #e2e8f0;
    transition: background-color 0.2s;
    cursor: pointer;
}

.table thead th:nth-child(15) {
    text-align: right;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: #e2e8f0;
}

.table tbody tr:not(:last-child) {
    border-bottom: 1px solid #000000;
}

.table td {
    padding: 0.75rem;
    font-size: 0.875rem;
    border: none !important;
}

.table td:first-child {
    padding-left: 1.75rem;
}

.table td:last-child {
    padding-right: 1.75rem;
}

td:last-child {
    white-space: nowrap;
}

/* Button Styles */
#clear-filters {
    background: #ffffff;
    color: #64748b;
    border: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

#clear-filters:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.buy-button {
    background: #3b82f6;
    color: white !important;
    font-weight: 500;
    border: none;
    transition: all 0.2s ease;
    padding: 0.25rem 0.75rem !important;
    height: 28px;
    line-height: 1;
    font-size: 0.8125rem;
    border-radius: 4px;
}

.buy-button:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.buy-button:active {
    transform: translateY(0);
}

/* Amazon Popup Styles */
.amazon-popup {
    position: fixed;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 0;
    z-index: 1000;
    display: none;
    width: 280px;
    overflow: hidden;
}

/* Popup Tabs */
.popup-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.popup-tab {
    flex: 1;
    padding: 0.5rem;
    border: none;
    background: none;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-tab:hover {
    color: #1a202c;
    background: #f1f5f9;
}

.popup-tab.active {
    color: #1a202c;
    background: #ffffff;
    border-bottom: 2px solid #3b82f6;
}

/* Tab Content */
.popup-content {
    padding: 0.75rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Amazon Flags Grid */
.store-flags.compact {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.25rem;
}

.store-flags.compact .store-flag-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.store-flags.compact .store-flag-link:hover {
    background: #f8fafc;
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Store List */
.store-list {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.store-text-link {
    display: block;
    padding: 0.375rem 0.5rem;
    text-decoration: none;
    color: #4a5568;
    font-size: 0.8125rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.store-text-link:hover {
    background: #f8fafc;
    color: #1a202c;
    padding-left: 0.75rem;
}

/* Notification Styles */
.notification {
    border-radius: 6px;
    border: 1px solid;
    font-size: 0.875rem;
}

.notification.is-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #dbeafe;
}

.notification.is-danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* Tag Styles */
.tag {
    font-weight: 500;
    min-width: 75px;
    text-align: center;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
}

.tag.is-info {
    background: #dbeafe;
    color: #1e40af;
}

.tag.is-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.tag.is-success {
    background: #d1fae5;
    color: #065f46;
}

/* Responsive Design */
@media (max-width: 1200px) {
    /* Allow wrapping at medium screens */
    .filters-wrapper {
        flex-wrap: wrap;
    }
    
    .filter-actions {
        margin-left: auto;
    }
}

@media (max-width: 768px) {
    /* Stack filters vertically on mobile */
    .filters-wrapper {
        flex-direction: column;
    }
    
    .filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        flex: none;
    }
    
    .filter-actions {
        width: 100%;
        margin-top: 0.75rem;
    }
    
    #clear-filters {
        width: 100%;
    }
    
    .filter-group {
        justify-content: space-between;
        width: 100%;
    }
    
    .filter-group .input {
        width: 60px;
    }
    
    /* Hide less important columns on mobile */
    .table th:nth-child(4), /* 2.5G */
    .table td:nth-child(4),
    .table th:nth-child(5), /* 10G */
    .table td:nth-child(5),
    .table th:nth-child(6), /* Combo */
    .table td:nth-child(6),
    .table th:nth-child(9), /* SFP28 */
    .table td:nth-child(9),
    .table th:nth-child(10), /* QSFP+ */
    .table td:nth-child(10),
    .table th:nth-child(11), /* QSFP28 */
    .table td:nth-child(11),
    .table th:nth-child(12), /* CPU */
    .table td:nth-child(12),
    .table th:nth-child(14) /* Storage */,
    .table td:nth-child(14) {
        display: none;
    }
    
    .table th:nth-child(1), /* Model */
    .table td:nth-child(1) {
        min-width: 120px;
        font-size: 0.875rem;
    }
    
    /* Make table scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 500px;
    }
    
    /* Smaller text in table */
    .table {
        font-size: 0.875rem;
    }
    
    /* Compact padding */
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    /* Stack buttons in filter */
    .filter-group .buttons {
        width: 100%;
    }
    
    .filter-group .buttons .button {
        flex: 1;
    }
}

@media (max-width: 480px) {
    /* Even more compact on very small screens */
    .table th,
    .table td {
        padding: 0.375rem;
        font-size: 0.8125rem;
    }
    
    /* Hide RAM column too */
    .table th:nth-child(13),
    .table td:nth-child(13) {
        display: none;
    }
    
    .buy-button {
        padding: 0.125rem 0.5rem !important;
        font-size: 0.75rem;
    }
    
    /* Adjust popup on small screens */
    .amazon-popup {
        width: calc(100vw - 20px);
        max-width: 280px;
        left: 10px !important;
        right: 10px !important;
    }
    
    .store-flags.compact {
        grid-template-columns: repeat(4, 1fr);
    }
}