@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
    --bg: #0f0f0f;
    --bg-surface: #161616;
    --bg-card: #1a1a1a;
    --bg-card-hover: #222222;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.45);
    --text-dim: rgba(255, 255, 255, 0.25);
    --accent: #ff6b2b;
    --accent-hover: #ff8c55;
    --accent-dim: rgba(255, 107, 43, 0.12);
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --platform-youtube: #ff0000;
    --platform-tiktok: #ffffff;
    --platform-instagram: #e1306c;
    --platform-x: #ffffff;
    --platform-twitter: #1da1f2;
    --platform-linkedin: #0077b5;
    --platform-facebook: #1877f2;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

/* === LAYOUT === */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* === HEADER === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    padding-top: 16px;
    padding-bottom: 16px;
}

.site-header nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    height: 40px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

/* === FOOTER === */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: 64px;
    text-align: center;
}

.site-footer small {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* === SEARCH SECTION === */
.search-section {
    padding: 48px 0 24px;
}

.search-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 8px;
}

.search-section .subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
    margin-bottom: 32px;
}

/* === SEARCH FORM === */
#search-form {
    margin-bottom: 0;
}

.search-grid {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
}

.search-grid input[type="search"],
.search-grid select {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.875rem;
    padding: 12px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    width: 100%;
    height: 48px;
}

.search-grid input[type="search"]:focus,
.search-grid select:focus {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.search-grid input[type="search"]::placeholder {
    color: var(--text-dim);
}

.search-grid select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.search-grid select option {
    background: var(--bg-surface);
    color: var(--text);
}

/* === TAG CLOUD === */
.tag-cloud-section {
    padding: 24px 0 16px;
}

.tag-cloud-section h4 {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 12px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-cloud-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: calc(0.75rem + var(--tag-weight, 1) * 0.04rem);
    font-weight: 500;
    opacity: calc(0.6 + var(--tag-weight, 1) * 0.08);
    transition: all 0.2s ease;
    text-decoration: none;
}

.tag-cloud-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-hover);
    color: var(--text);
}

/* === DIVIDER === */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 8px 0;
}

/* === RESULTS === */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* === SUMMARY CARDS === */
.summary-card {
    background: transparent;
    border-radius: var(--radius-md);
    padding: 24px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
}

.summary-card:hover {
    background: rgba(255, 255, 255, 0.03);
}

.summary-card .card-content {
    display: flex;
    gap: 20px;
}

.summary-card .card-thumbnail {
    flex-shrink: 0;
    width: 180px;
    height: 100px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    display: block;
    transition: opacity 0.2s;
}

.summary-card .card-thumbnail:hover {
    opacity: 0.85;
}

.summary-card .card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.summary-card .card-thumbnail.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid var(--border);
}

.summary-card .card-thumbnail.no-image img {
    display: none;
}

.summary-card .card-thumbnail.no-image::after {
    content: "\1F4F7";
}

.summary-card .card-thumbnail.no-image[data-platform="instagram"]::after {
    content: "\1F4F7";
}

.summary-card .card-thumbnail.no-image[data-platform="tiktok"]::after {
    content: "\1F3B5";
}

.summary-card .card-thumbnail.no-image[data-platform="youtube"]::after {
    content: "\25B6\FE0F";
}

.summary-card .card-thumbnail.no-image[data-platform="x"]::after {
    content: "\1D54F";
}

.summary-card .card-body {
    flex: 1;
    min-width: 0;
}

.summary-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    letter-spacing: -0.01em;
}

.summary-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.platform-youtube { background: var(--platform-youtube); color: white; }
.platform-tiktok { background: var(--platform-tiktok); color: #0f0f0f; }
.platform-instagram { background: var(--platform-instagram); color: white; }
.platform-x { background: var(--platform-x); color: #0f0f0f; }
.platform-twitter { background: var(--platform-twitter); color: white; }
.platform-linkedin { background: var(--platform-linkedin); color: white; }
.platform-facebook { background: var(--platform-facebook); color: white; }

.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
}

.date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

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

.summary-preview {
    color: var(--text-muted);
    font-size: 0.8125rem;
    line-height: 1.6;
    margin-top: 8px;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === NO RESULTS === */
.no-results {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.no-results p {
    margin-bottom: 8px;
}

/* === LOAD MORE === */
.load-more {
    text-align: center;
    padding: 32px 0;
}

.load-more button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.load-more button:hover,
.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    color: var(--text);
}

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    font-weight: 600;
}

.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}

.btn-danger {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
    font-weight: 600;
}

.btn-danger:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* === DETAIL PAGE === */
.detail-header {
    padding: 32px 0 16px;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.8125rem;
}

.breadcrumb a {
    color: var(--text-muted);
    font-weight: 500;
}

.breadcrumb a:hover {
    color: var(--text);
}

.breadcrumb .separator {
    color: var(--text-dim);
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.detail-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.3;
    margin-top: 16px;
    margin-bottom: 4px;
}

.thumbnail {
    max-width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.summary-content {
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

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

.tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: var(--accent-dim);
    border: 1px solid rgba(255, 107, 43, 0.15);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent);
}

.raw-content {
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.raw-content pre {
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: var(--text-muted);
    font-family: 'Geist Mono', 'SF Mono', 'Fira Code', monospace;
}

details {
    margin-top: 24px;
}

details summary {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.2s;
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: "+ ";
    font-weight: 400;
}

details[open] summary::before {
    content: "- ";
}

details summary:hover {
    color: var(--text);
}

.detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

/* === PAGINATION === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 32px 0 16px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.pagination-btn.disabled {
    color: var(--text-dim);
    pointer-events: none;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pagination-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination-num:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.pagination-num.active {
    background: var(--accent);
    color: white;
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: var(--text-dim);
    font-size: 0.8125rem;
}

/* === FOOTER === */
.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.footer-social {
    display: inline-flex;
    align-items: center;
    color: var(--text-dim);
    transition: color 0.2s;
}

.footer-social:hover {
    color: #0077b5;
}

/* === HTMX === */
.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-indicator {
    display: none;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    .site-header .container {
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .brand-logo {
        height: 32px;
    }

    .search-section {
        padding: 32px 0 16px;
    }

    .search-section h1 {
        font-size: 1.75rem;
    }

    .search-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .search-grid input[type="search"],
    .search-grid select {
        height: 44px;
    }

    .summary-card {
        padding: 16px;
    }

    .summary-card .card-content {
        flex-direction: column;
        gap: 12px;
    }

    .summary-card .card-thumbnail {
        width: 100%;
        height: 200px;
    }

    .summary-meta {
        gap: 6px;
    }

    .detail-card {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .detail-card h2 {
        font-size: 1.25rem;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions .btn {
        text-align: center;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .search-section {
        padding: 24px 0 12px;
    }

    .search-section h1 {
        font-size: 1.5rem;
    }

    .summary-card {
        padding: 12px;
    }

    .tag-cloud {
        gap: 6px;
    }

    .tag-cloud-item {
        padding: 4px 10px;
        font-size: 0.6875rem;
    }
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
