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

html {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #0d2137;
    background: #f8f9fb;
}

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

a { color: #0066aa; text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Nav ──────────────────────────────────────────── */
.top-nav {
    background: #0d2137;
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}
.nav-links a {
    color: rgba(255,255,255,0.8) !important;
    margin-left: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: #fff !important; }

/* ── Search Hero ──────────────────────────────────── */
.search-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.search-hero.compact {
    padding: 1.5rem 0 1rem;
}
.search-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.search-hero.compact h1 {
    font-size: 1.3rem;
}
.hero-sub {
    color: #556;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

/* ── Search Form ──────────────────────────────────── */
.search-form {
    max-width: 800px;
    margin: 0 auto;
}
.search-bar {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
}
.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    border: 2px solid #c0c8d0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    outline: none;
    background: #fff;
}
.search-bar input:focus { border-color: #0066aa; }
.search-bar button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: #0066aa;
    color: #fff;
    border: 2px solid #0066aa;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}
.search-bar button:hover { background: #005590; border-color: #005590; }

.filters-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.filters-row input,
.filters-row select {
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    border: 1.5px solid #c0c8d0;
    border-radius: 6px;
    background: #fff;
    outline: none;
    min-width: 0;
    flex: 1;
}
.filters-row input:focus,
.filters-row select:focus { border-color: #0066aa; }
.filters-row input[type="date"] { flex: 0.7; }

/* ── Results ──────────────────────────────────────── */
.results-section { padding: 0 0 2rem; }
.results-count {
    font-size: 0.9rem;
    color: #556;
    margin-bottom: 1rem;
}
.results-table-wrap { overflow-x: auto; }
.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.results-table th {
    text-align: left;
    padding: 0.6rem 0.5rem;
    border-bottom: 2px solid #d0d5da;
    font-weight: 600;
    color: #334;
    white-space: nowrap;
}
.results-table td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid #e8eaed;
    vertical-align: top;
}
.results-table tbody tr:nth-child(even) { background: #f4f5f7; }
.results-table tbody tr:hover { background: #edf2f7; }

.mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.title-cell { max-width: 350px; }

.btn-view {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0066aa !important;
    border: 1px solid #0066aa;
    border-radius: 4px;
    white-space: nowrap;
}
.btn-view:hover { background: #0066aa; color: #fff !important; text-decoration: none; }

.no-results {
    text-align: center;
    padding: 2rem;
    color: #667;
}

/* ── Stats Row ───────────────────────────────────── */
.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.stat-card {
    flex: 1;
    background: #fff;
    border: 1px solid #d0d5da;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    text-align: center;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0d2137;
}
.stat-label {
    font-size: 0.8rem;
    color: #667;
    margin-top: 0.2rem;
}

/* ── CPC Grid ────────────────────────────────────── */
.cpc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.cpc-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: #fff;
    border: 1px solid #e2e6ea;
    border-radius: 6px;
    font-size: 0.8rem;
}
.cpc-code {
    font-weight: 700;
    color: #0066aa;
    font-size: 0.9rem;
}
.cpc-desc {
    color: #334;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cpc-count {
    color: #667;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* ── Features Row ────────────────────────────────── */
.features-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.feature-card {
    flex: 1;
    background: #fff;
    border: 1px solid #d0d5da;
    border-radius: 8px;
    padding: 1rem 1.2rem;
}
.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #0d2137;
    margin-bottom: 0.4rem;
}
.feature-card p {
    font-size: 0.82rem;
    color: #445;
    line-height: 1.5;
}
.feature-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0066aa !important;
}

/* ── CTA Box ──────────────────────────────────────── */
.cta-box {
    background: #fff;
    border: 1px solid #d0d5da;
    border-radius: 10px;
    padding: 1.5rem 2rem;
    margin: 2rem 0;
}
.cta-box h2, .cta-box h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}
.cta-box ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1rem;
}
.cta-box li {
    padding: 0.3rem 0;
    padding-left: 1.2rem;
    position: relative;
}
.cta-box li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #0a8;
    font-weight: 700;
}
.btn-cta {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: #0066aa;
    color: #fff !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}
.btn-cta:hover { background: #005590; text-decoration: none; }

/* ── Patent Detail ────────────────────────────────── */
.breadcrumb {
    font-size: 0.85rem;
    color: #667;
    padding: 1rem 0 0.5rem;
}
.breadcrumb a { color: #0066aa; }

.patent-detail { padding-bottom: 2rem; }
.patent-detail header { margin-bottom: 1.5rem; }
.patent-detail h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.75rem;
}
.patent-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-size: 0.88rem;
    color: #445;
}

.patent-section {
    margin-bottom: 1.5rem;
}
.patent-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a3a5c;
    margin-bottom: 0.5rem;
}
.patent-section p {
    line-height: 1.7;
}

.claims-list {
    padding-left: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}
.claims-list li { margin-bottom: 0.5rem; }

details summary { cursor: pointer; user-select: none; }
details summary:hover { color: #0066aa; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: #e8f0f8;
    color: #0066aa !important;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 500;
}
.tag:hover { background: #d0e4f4; text-decoration: none; }

.links-section {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.btn-external {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0066aa;
    color: #fff !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-external:hover { background: #005590; text-decoration: none; }
.btn-secondary {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1.5px solid #0066aa;
    color: #0066aa !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}
.btn-secondary:hover { background: #f0f6fc; text-decoration: none; }

/* ── Error Page ───────────────────────────────────── */
.error-page {
    text-align: center;
    padding: 4rem 1rem;
}
.error-page h1 { font-size: 1.8rem; margin-bottom: 1rem; }
.error-page p { margin-bottom: 1.5rem; color: #556; }

/* ── Footer ───────────────────────────────────────── */
.site-footer {
    margin-top: auto;
    padding: 1.5rem 0;
    background: #0d2137;
    color: rgba(255,255,255,0.7);
    font-size: 0.82rem;
    text-align: center;
}
.footer-links a { color: rgba(255,255,255,0.8) !important; }
.footer-disclaimer {
    margin-top: 0.75rem;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.45);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* ── Year Accordion ──────────────────────────────── */
.results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.toolbar-left {
    display: flex;
    gap: 0.5rem;
}
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.cpc-filter-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #445;
}
#cpcFilter {
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    border: 1.5px solid #c0c8d0;
    border-radius: 4px;
    background: #fff;
    outline: none;
    min-width: 10rem;
}
#cpcFilter:focus { border-color: #0066aa; }

.btn-toggle {
    padding: 0.35rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1.5px solid #c0c8d0;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    color: #0d2137;
}
.btn-toggle:hover { border-color: #0066aa; color: #0066aa; }

.year-accordion { margin-bottom: 0.4rem; }

.year-ribbon {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d0d5da;
    border-radius: 6px;
    background: #f0f2f5;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0d2137;
    text-align: left;
    gap: 0.5rem;
}
.year-ribbon:hover { background: #e8ecf0; }
.year-ribbon.open {
    border-radius: 6px 6px 0 0;
    background: #e8f0f8;
    border-bottom-color: transparent;
}

.ribbon-arrow {
    width: 1rem;
    flex-shrink: 0;
    font-size: 0.75rem;
}
.ribbon-label {
    flex-shrink: 0;
    white-space: nowrap;
    min-width: 7rem;
}

.year-body {
    border: 1px solid #d0d5da;
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow-x: auto;
}
.year-body .results-table { margin-bottom: 0; }
.year-body .results-table th:first-child,
.year-body .results-table td:first-child { padding-left: 0.75rem; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
    .search-hero h1 { font-size: 1.5rem; }
    .hero-sub { font-size: 0.95rem; }
    .filters-row { flex-direction: column; }
    .filters-row input, .filters-row select { flex: none; width: 100%; }
    .patent-meta { flex-direction: column; gap: 0.3rem; }
    .results-table { font-size: 0.8rem; }
    .title-cell { max-width: 200px; }
    .stats-row { flex-direction: column; }
    .cpc-grid { grid-template-columns: repeat(2, 1fr); }
    .features-row { flex-direction: column; }
    .results-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
    .search-hero { padding: 1.5rem 0 1rem; }
    .search-hero h1 { font-size: 1.3rem; }
    .search-bar input { font-size: 0.95rem; padding: 0.6rem 0.75rem; }
    .search-bar button { padding: 0.6rem 1rem; }
    .patent-detail h1 { font-size: 1.2rem; }
}
