/* ===== Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Light Theme (default) ===== */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f6f3;
    --bg-hover: rgba(55, 53, 47, 0.08);
    --text-primary: #37352f;
    --text-secondary: #787774;
    --text-muted: #9b9a97;
    --border: #e9e9e7;
    --accent: #2383e2;
    --link-color: #0000EE;
    --link-hover: #551A8B;
    --input-bg: #ffffff;
    --font-sans: Arial, Helvetica, sans-serif;
    --font-mono: "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
    --bg-primary: #191919;
    --bg-secondary: #202020;
    --bg-hover: rgba(255, 255, 255, 0.055);
    --text-primary: #ffffffeb;
    --text-secondary: #ffffff99;
    --text-muted: #ffffff66;
    --border: #ffffff14;
    --accent: #529cca;
    --link-color: #6db3f2;
    --link-hover: #a3d1ff;
    --input-bg: #252525;
}

/* Screen reader only — visually hidden H1 for SEO */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Visible H1 for homepage */
.main-h1 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

/* ===== Base ===== */
html {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.5;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Layout ===== */
.layout {
    display: flex;
    flex: 1;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 200px;
    min-width: 200px;
    padding: 0 12px 12px;
    border-right: 1px solid var(--border);
    background: var(--bg-primary);
}

/* Sidebar logo row */
.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    height: 32px;
}

.logo {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
}

.logo:hover {
    color: var(--accent);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    color: var(--text-secondary);
    line-height: 1;
}

.theme-toggle:hover {
    color: var(--text-primary);
}

/* Filters header */
.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.filters-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.clear-link {
    font-size: 12px;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

.clear-link:hover {
    text-decoration: underline;
}

/* Filter sections */
.filter-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.filter-unit {
    font-weight: 400;
    color: var(--text-secondary);
}

/* Text input */
.filter-input {
    width: 100%;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--input-bg);
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
}

.filter-input:focus {
    border-color: var(--accent);
}

.filter-input::placeholder {
    color: var(--text-muted);
}

/* Range group — two inputs in one bordered box */
.range-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--input-bg);
    overflow: hidden;
}

.range-input {
    flex: 1;
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
    min-width: 0;
}

.range-input::placeholder {
    color: var(--text-muted);
}

.range-group:focus-within {
    border-color: var(--accent);
}

.range-sep {
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 0 2px;
}

/* Number input spinners — show on hover */
.range-input[type="number"]::-webkit-inner-spin-button,
.range-input[type="number"]::-webkit-outer-spin-button {
    opacity: 0;
    height: 24px;
    cursor: pointer;
}

.range-input[type="number"]:hover::-webkit-inner-spin-button,
.range-input[type="number"]:hover::-webkit-outer-spin-button,
.range-input[type="number"]:focus::-webkit-inner-spin-button,
.range-input[type="number"]:focus::-webkit-outer-spin-button {
    opacity: 1;
}

/* Brand filter */
.brand-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.brand-action {
    font-size: 11px;
    color: var(--accent);
    cursor: pointer;
    user-select: none;
}

.brand-action:hover {
    text-decoration: underline;
}

.brand-list {
    max-height: 200px;
    overflow-y: auto;
    margin-top: 6px;
}

.brand-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 0;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.brand-item input[type="checkbox"] {
    accent-color: var(--accent);
    flex-shrink: 0;
}

.brand-item:hover {
    color: var(--accent);
}

/* Bandwidth tabs */
.bandwidth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

.bw-tab {
    flex: 1;
    padding: 3px 6px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font-sans);
}

.bw-tab.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 6px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent);
}

/* Use Case Navigation */
.nav-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.use-case-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: block;
    font-size: 12px;
    color: var(--text-primary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background 0.15s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.nav-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* SEO Hero Section */
.seo-hero {
    padding: 16px 16px 8px;
    border-bottom: 1px solid var(--border);
}

.seo-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.seo-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.seo-desc a {
    color: var(--accent);
    text-decoration: none;
}

.seo-desc a:hover {
    text-decoration: underline;
}

.seo-desc strong {
    color: var(--text-primary);
}

.seo-specs {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.spec-card {
    display: flex;
    flex-direction: column;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    min-width: 80px;
}

.spec-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.spec-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.seo-sub {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
}

.seo-sub code {
    background: var(--bg-secondary);
    padding: 1px 4px;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
}

.seo-subtitle {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 8px;
}

/* ===== Policy Page ===== */
.policy-sidebar {
    padding-top: 12px;
}

.policy-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 12px;
}

.policy-nav a {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 3px;
}

.policy-nav a:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.back-link {
    display: block;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    margin-top: 16px;
    padding: 4px 8px;
}

.back-link:hover {
    text-decoration: underline;
}

.policy-main {
    padding: 24px 32px;
    max-width: 720px;
}

.policy-content h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.policy-updated {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.policy-content h2 {
    font-size: 15px;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.policy-content p {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.policy-content ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.policy-content li {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.policy-content strong {
    color: var(--text-primary);
}

.policy-content a {
    color: var(--accent);
    text-decoration: none;
}

.policy-content a:hover {
    text-decoration: underline;
}

.policy-content ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

/* ===== FAQ Page ===== */
.faq-nav-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 8px 8px 2px;
    margin-top: 4px;
}

.faq-nav-label:first-child {
    margin-top: 0;
}

.faq-category {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 28px;
    margin-bottom: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.faq-item {
    margin-bottom: 20px;
}

.faq-q {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.4;
}

.faq-a {
    padding-left: 0;
}

.faq-a p,
.faq-a li {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.faq-a ul,
.faq-a ol {
    padding-left: 20px;
    margin-bottom: 10px;
}

.faq-a strong {
    color: var(--text-primary);
}

.faq-a a {
    color: var(--accent);
    text-decoration: none;
}

.faq-a a:hover {
    text-decoration: underline;
}

/* Information section */
.info-section {
    border-bottom: none;
}

.faq-link {
    display: block;
    font-size: 12px;
    color: var(--text-primary);
    text-decoration: none;
    padding: 2px 0;
}

.faq-link:hover {
    color: var(--accent);
}

.info-contact {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.info-contact a {
    color: var(--accent);
    text-decoration: none;
}

.info-contact a:hover {
    text-decoration: underline;
}

/* ===== Main Content ===== */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Plan count */
.main-header {
    display: flex;
    align-items: center;
    margin: 6px 6px 6px 6px;
}

.plan-count {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== Table ===== */
.table-wrapper {
    flex: 1;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 800px;
    border-collapse: collapse;
    font-size: 13px;
}

/* Column widths — percentage based like vpsprices.net */
thead th:nth-child(1) {
    width: 6%;
    min-width: 60px;
}

/* Price */
thead th:nth-child(2) {
    width: 6%;
    min-width: 60px;
}

/* Brand */
thead th:nth-child(3) {
    width: 8%;
    max-width: 120px;
}

/* Plan Name */
thead th:nth-child(4) {
    width: 6%;
}

/* CPU */
thead th:nth-child(5) {
    width: 6%;
}

/* RAM */
thead th:nth-child(6) {
    width: 6%;
}

/* Storage */
thead th:nth-child(7) {
    width: 8%;
}

/* Bandwidth */
thead th:nth-child(8) {
    width: 40%;
    min-width: 200px;
}

/* Newest VPS Deals */

thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--bg-primary);
}

thead th {
    padding: 2px 6px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}

th.sortable {
    cursor: pointer;
}

th.sortable:hover {
    color: var(--accent);
}

th.sorted-asc,
th.sorted-desc {
    color: var(--accent);
}

tbody tr {
    cursor: pointer;
}

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

td {
    padding: 5px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

/* Spec cells — monospace font */
td.cell-spec {
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Plan name truncation */
td:nth-child(3) {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Deals column — classic underline links */
td:nth-child(8) {
    min-width: 200px;
    font-size: 13px;
    line-height: 1.2;
}

td:nth-child(8) a {
    color: var(--link-color);
    text-decoration: underline;
}

td:nth-child(8) a:hover {
    color: var(--link-hover);
}

.price {
    font-weight: 600;
}

/* Empty & Loading */
.empty-state,
.loading-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ===== Footer ===== */
.footer {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background-color: var(--bg-primary);
    line-height: 1.5;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 8px;
}

.footer-link:hover {
    text-decoration: underline;
}

/* ===== Mobile Sidebar Toggle ===== */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 200;
    line-height: 1;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 149;
}

/* ===== SEO Content Section ===== */
.seo-content {
    padding: 24px 16px 8px;
    max-width: 720px;
}

.seo-content h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 20px 0 8px;
}

.seo-content h2:first-child {
    margin-top: 0;
}

.seo-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

.seo-content code {
    background: var(--bg-secondary);
    padding: 1px 4px;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Requirements table inside seo-content */
.req-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 16px;
    font-size: 12px;
}

.req-table th,
.req-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.req-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.req-table td {
    color: var(--text-secondary);
}

.req-table tr:last-child td {
    border-bottom: none;
}

/* ===== Footer Navigation ===== */
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 8px;
}

/* ===== Tablet Responsive ===== */
@media (max-width: 1024px) and (min-width: 769px) {
    .sidebar {
        min-width: 200px;
        width: 200px;
    }

    table th,
    table td {
        padding: 5px 8px;
        font-size: 12px;
    }
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px;
        min-width: 260px;
        z-index: 150;
        transition: left 0.25s ease;
        height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay.open {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    table th,
    table td {
        padding: 4px 6px;
    }

    /* Policy/FAQ pages: show back link as nav */
    .policy-sidebar .back-link {
        position: sticky;
        top: 0;
        background: var(--bg-primary);
        z-index: 10;
        padding: 8px;
        border-bottom: 1px solid var(--border);
    }
}

/* ===== Scrollbar ===== */
.brand-list::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.brand-list::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.brand-list::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.brand-list::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}