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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
    background: #f5f5f5;
    color: #333;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: #1e3a5f;
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.header-left:hover {
    opacity: 0.8;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-title-link {
    color: inherit;
    text-decoration: none;
}

.header-title-link:visited {
    color: inherit;
}

.header-title-link:hover {
    text-decoration: none;
}

.header-subtitle {
    font-size: 12px;
    color: #94a3b8;
}

.header-powered {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    padding: 8px 16px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.header-powered-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
}

.header-powered a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all 0.15s;
}

.header-powered a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.header-powered-icon {
    font-size: 16px;
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* サイドバー */
.sidebar {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    background: #f8fafc;
}

/* カスタム検索 */
.custom-search {
    padding: 16px;
    background: #f0f9ff;
}

.custom-search-label {
    font-size: 13px;
    color: #0369a1;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.custom-search-input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

.custom-search-input:focus {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.custom-search-suffix {
    font-size: 14px;
    color: #334155;
    white-space: nowrap;
}

.custom-search-suffix-line {
    font-size: 14px;
    color: #334155;
    margin: 2px 0 8px;
}

.custom-search-prefix-line {
    font-size: 14px;
    color: #334155;
    margin-bottom: 6px;
}

.custom-search-btn {
    width: 100%;
    padding: 12px;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.custom-search-btn:hover {
    background: #0284c7;
}

.custom-search-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.htmx-indicator {
    display: none;
}

.htmx-indicator.htmx-request {
    display: inline;
}

.btn-label-loading {
    display: none;
}

.htmx-request .btn-label {
    display: none;
}

.htmx-request .btn-label-loading {
    display: inline;
}

/* カテゴリ一覧 */
.category-item {
    padding: 0;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* <a> をリンクっぽく見せない（元のdivクリック風に） */
.category-item>a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    color: inherit;
    text-decoration: none;
}

.category-item>a:visited {
    color: inherit;
}

.category-item>a:hover {
    text-decoration: none;
}

.category-item:hover {
    background: #f1f5f9;
}

.category-item.active {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 500;
}

.category-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.category-name {
    flex: 1;
}

/* メインエリア */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.main-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.article-count {
    font-size: 13px;
    color: #64748b;
}

/* パンくず */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.breadcrumb-item {
    color: #3b82f6;
    cursor: pointer;
}

.breadcrumb-item:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: #94a3b8;
}

.breadcrumb-current {
    color: #64748b;
}

/* 企業グリッド */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.company-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.company-card>a {
    display: block;
    padding: 12px 16px;
    color: inherit;
    text-decoration: none;
}

.company-card>a:visited {
    color: inherit;
}

.company-card>a:hover {
    text-decoration: none;
}

.company-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #3b82f6;
}

.company-card-name,
.company-name {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    word-break: break-all;
}

.company-card-count,
.company-count {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* 記事リスト */
.article-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.article-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    transition: box-shadow 0.15s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.article-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #64748b;
}

.article-source {
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.article-date {
    color: #94a3b8;
}

.article-title {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 6px;
    line-height: 1.5;
}

.article-description {
    font-size: 13px;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-tags {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.article-tag {
    font-size: 11px;
    background: #eff6ff;
    color: #3b82f6;
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.article-tag:hover {
    background: #3b82f6;
    color: #fff;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
    color: #94a3b8;
    font-size: 14px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state p {
    font-size: 14px;
    margin-top: 8px;
}

/* トップページ */
.top-hero {
    text-align: center;
    padding: 80px 40px;
}

.top-hero-title {
    font-size: 32px;
    color: #1e293b;
    margin-bottom: 16px;
    font-weight: 300;
}

.top-hero-title strong {
    font-weight: 600;
}

.top-hero-input-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 32px;
    color: #1e293b;
    margin-bottom: 32px;
}

.top-hero-input {
    width: 220px;
    padding: 10px 16px;
    font-size: 28px;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    background: #f0f9ff;
    text-align: center;
    outline: none;
    color: #0369a1;
    font-weight: 500;
    transition: all 0.2s;
}

.top-hero-input::placeholder {
    color: #0ea5e9;
    font-weight: 400;
    opacity: 0.7;
}

.top-hero-input:focus {
    border-color: #0369a1;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2);
}

.top-hero-input:not(:focus):not(:placeholder-shown) {
    background: #fff;
}

/* 点滅カーソル風アニメーション */
@keyframes blink-caret {

    0%,
    100% {
        border-right-color: transparent;
    }

    50% {
        border-right-color: #0ea5e9;
    }
}

.top-hero-input:focus:placeholder-shown {
    animation: none;
}

.top-hero-input.blinking::after {
    content: '|';
    animation: blink-caret 1s step-end infinite;
}

/* ヒントテキスト */
.top-hero-hint {
    margin-top: 12px;
    font-size: 13px;
    color: #94a3b8;
}

.top-hero-hint span {
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 0 2px;
}

.top-hero-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 14px 48px;
    background: #0ea5e9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.top-hero-btn:hover {
    background: #0284c7;
}

.top-hero-btn:active {
    transform: scale(0.98);
}

.top-hero-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 48px auto;
    max-width: 400px;
    color: #94a3b8;
    font-size: 13px;
}

.top-hero-divider::before,
.top-hero-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.top-hero-sub {
    color: #64748b;
    font-size: 14px;
}

.top-hero-sub strong {
    color: #334155;
}

.top-categories {
    margin-top: 48px;
}

.top-categories-title {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 16px;
}

.top-categories-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.top-category-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}

.top-category-btn:hover {
    background: #f0f9ff;
    border-color: #0ea5e9;
    color: #0369a1;
}

.top-category-btn .icon {
    font-size: 16px;
}

/* Homeリンク */
.home-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 16px;
}

.home-link:hover {
    color: #0ea5e9;
}

/* 戻るボタン */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #475569;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 16px;
}

.back-btn:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* もっと読み込むボタン */
.load-more-container {
    text-align: center;
    padding: 20px;
}

.load-more-btn {
    background: #3b82f6;
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.load-more-btn:hover {
    background: #2563eb;
}

.load-more-btn:active {
    transform: scale(0.98);
}

.load-more-btn:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

.load-more-info {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

/* エラー表示 */
.error-state {
    text-align: center;
    padding: 40px 20px;
    color: #ef4444;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
}

.error-state p {
    font-size: 14px;
    margin-top: 8px;
}

/* クエリ説明 */
.query-explanation {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #166534;
}

.query-explanation-title {
    font-weight: 600;
    margin-bottom: 4px;
}

/* 企業数表示 */
.company-count-info {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 16px;
}

/* フッター */
.footer {
    margin-top: 40px;
    padding: 20px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.footer-disclaimer {
    font-size: 11px;
    color: #64748b;
    line-height: 1.7;
}

.footer-disclaimer-title {
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.footer-disclaimer ul {
    margin: 0;
    padding-left: 20px;
}

.footer-disclaimer li {
    margin-bottom: 4px;
}

.footer-copyright {
    margin-top: 12px;
    font-size: 10px;
    color: #94a3b8;
}
