/* ============================================================ */
/*  CariKami - Plain CSS (tidak perlu Tailwind / build apapun)  */
/* ============================================================ */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #fff;
    color: #202124;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
::selection { background: #ffe082; color: #202124; }

/* PWA banner */
.pwa-banner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; background: #fff; border-bottom: 1px solid #e0e0e0;
    padding: 8px 16px;
}
.pwa-banner .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pwa-banner .label { font-size: 0.8rem; color: #5f6368; }
.btn-install {
    background: #4285f4; color: #fff; border: none; padding: 6px 16px;
    border-radius: 999px; font-size: 0.85rem; font-weight: 500; cursor: pointer;
}
.btn-install:hover { background: #3367d6; }
.btn-close {
    background: transparent; border: none; padding: 6px; border-radius: 999px;
    color: #5f6368; cursor: pointer; display: inline-flex;
}
.btn-close:hover { background: #f1f3f4; }

/* Hero area */
.hero {
    display: flex; align-items: center; justify-content: center;
    min-height: 78vh; padding: 24px 16px; text-align: center;
}
.hero-inner { width: 100%; max-width: 780px; }
.logo-wrap { display: flex; justify-content: center; margin-bottom: 32px; }

/* Search box */
.search-form { position: relative; width: 100%; }
.search-input {
    width: 100%; height: 52px; padding: 0 56px 0 20px;
    font-size: 1rem; color: #202124; background: #fff;
    border: 1px solid #dfe1e5; border-radius: 999px; outline: none;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.search-input:hover { border-color: #c4c7cc; }
.search-input:focus { border-color: #4285f4; box-shadow: 0 1px 6px rgba(32,33,36,0.15); }
.search-input.small { height: 44px; }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-btn {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 999px; border: none;
    background: transparent; color: #4285f4; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.search-btn:hover { background: #f1f3f4; }
.search-btn svg { width: 20px; height: 20px; }

/* Trending pills */
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 24px; }
.pill {
    padding: 6px 14px; font-size: 0.82rem; color: #3c4043; background: #f1f3f4;
    border: 1px solid transparent; border-radius: 999px; cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.pill:hover { background: #e8eaed; border-color: #dadce0; }

.tagline { margin-top: 40px; font-size: 0.78rem; color: #9aa0a6; }
.subtle-link {
    display: inline-flex; align-items: center; gap: 6px;
    margin-top: 12px; font-size: 0.78rem; color: #5f6368;
    text-decoration: none; transition: color 0.15s;
}
.subtle-link:hover { color: #1a73e8; }

/* Sticky header on results page */
.header-sticky {
    position: sticky; top: 0; z-index: 30; background: #fff;
    padding: 16px; border-bottom: 1px solid #ebebeb;
}
.header-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.header-inner .logo-mini { flex-shrink: 0; transform: scale(0.4); transform-origin: left center; }
.header-inner .search-form { flex: 1; min-width: 0; }
.icon-btn {
    flex-shrink: 0; padding: 8px; border-radius: 999px; border: none;
    background: transparent; color: #5f6368; cursor: pointer;
    display: inline-flex; transition: background 0.15s;
}
.icon-btn:hover { background: #f1f3f4; }

/* Results */
.results-wrap { max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.results-stats { font-size: 0.82rem; color: #70757a; margin-bottom: 12px; }
.result {
    display: flex; gap: 16px; padding: 16px 0;
    border-bottom: 1px solid transparent;
}
.result-body { flex: 1; min-width: 0; }
.result-domain-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.result-favicon {
    width: 24px; height: 24px; border-radius: 999px; background: #f1f3f4;
    display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
}
.result-favicon img { width: 16px; height: 16px; }
.result-domain { font-size: 0.78rem; color: #202124; }
.result-url { font-size: 0.72rem; color: #70757a; }
.result-title {
    font-size: 1.2rem; font-weight: 400; margin: 0 0 4px;
}
.result-title a { color: #1a0dab; text-decoration: none; }
.result-title a:visited { color: #681da8; }
.result-title a:hover { text-decoration: underline; }
.result-snippet { font-size: 0.9rem; color: #4d5156; line-height: 1.5; word-break: break-word; }
.result-score { font-size: 0.7rem; color: #9aa0a6; margin-top: 4px; }
.result-thumb {
    flex-shrink: 0; width: 110px; height: 100px; border-radius: 12px;
    overflow: hidden; background: #f1f3f4; margin-top: 4px;
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
mark { background: #fce8b2; color: inherit; padding: 0 2px; border-radius: 2px; }

.empty-state, .error-state, .loading-state {
    padding: 64px 16px; text-align: center; color: #5f6368;
}
.empty-state h3, .error-state h3 { font-size: 1.2rem; font-weight: 400; color: #3c4043; margin: 12px 0 4px; }
.empty-state p, .error-state p { font-size: 0.9rem; color: #80868b; margin: 0; }
.btn-secondary {
    margin-top: 16px; padding: 8px 20px; background: #fff;
    border: 1px solid #dadce0; border-radius: 999px;
    font-size: 0.875rem; color: #3c4043; cursor: pointer;
    text-decoration: none; display: inline-block;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn-secondary:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.spinner {
    display: inline-block; width: 32px; height: 32px;
    border: 3px solid #e8eaed; border-top-color: #4285f4;
    border-radius: 999px; animation: spin 0.8s linear infinite;
}
.spinner.small { width: 20px; height: 20px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin layout */
.admin-wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; background: #fafafa; min-height: 100vh; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.admin-header .back { color: #5f6368; text-decoration: none; font-size: 0.875rem; display: inline-flex; align-items: center; gap: 8px; }
.admin-header .back:hover { color: #1a73e8; }
.admin-header .logo-mini { transform: scale(0.35); transform-origin: right center; }
.admin-title { font-size: 1.6rem; font-weight: 600; margin: 0; }
.admin-subtitle { font-size: 0.9rem; color: #5f6368; margin: 4px 0 0; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.stat-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 12px; padding: 16px; }
.stat-label { color: #5f6368; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 1.7rem; font-weight: 600; margin-top: 4px; color: #202124; }

.card { background: #fff; border: 1px solid #e0e0e0; border-radius: 12px; padding: 16px; margin-top: 24px; }
.card-title { font-size: 0.9rem; font-weight: 500; margin-bottom: 12px; }
.row-flex { display: flex; flex-wrap: wrap; gap: 8px; }
.input {
    height: 44px; padding: 0 16px; font-size: 0.875rem; color: #202124;
    background: #fff; border: 1px solid #dfe1e5; border-radius: 8px;
    outline: none; transition: border-color 0.15s, box-shadow 0.15s; width: 100%;
}
.input:focus { border-color: #4285f4; box-shadow: 0 0 0 3px rgba(66,133,244,0.15); }
.input.grow { flex: 1; min-width: 220px; }
.input.short { max-width: 220px; }
.btn-primary {
    height: 44px; padding: 0 20px; background: #1a73e8; color: #fff;
    border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 500;
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
    transition: background 0.15s;
}
.btn-primary:hover { background: #1765cc; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.error-msg { margin-top: 8px; font-size: 0.875rem; color: #c5221f; display: flex; align-items: center; gap: 6px; }
.hint { margin-top: 8px; font-size: 0.75rem; color: #80868b; }

.domains-list { background: #fff; border: 1px solid #e0e0e0; border-radius: 12px; overflow: hidden; margin-top: 24px; }
.list-header { padding: 12px 16px; border-bottom: 1px solid #e0e0e0; font-size: 0.875rem; font-weight: 500; }
.domain-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid #eee; }
.domain-item:first-of-type { border-top: none; }
.domain-avatar { width: 36px; height: 36px; border-radius: 999px; background: #f1f3f4; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.domain-avatar img { width: 20px; height: 20px; }
.domain-info { flex: 1; min-width: 0; }
.domain-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.domain-name { font-size: 0.875rem; font-weight: 500; color: #202124; }
.domain-url { font-size: 0.75rem; color: #5f6368; }
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 500;
}
.badge.pending { background: #fff4d6; color: #8a6d00; }
.badge.crawling { background: #e3f2fd; color: #1565c0; }
.badge.ready    { background: #e6f4ea; color: #137333; }
.badge.error    { background: #fce8e6; color: #c5221f; }
.badge .spinner.small { width: 10px; height: 10px; border-width: 2px; border-top-color: currentColor; border-color: rgba(0,0,0,0.15); border-top-color: currentColor; }
.actions { display: flex; gap: 4px; flex-shrink: 0; }
.icon-btn-danger { background: transparent; border: none; padding: 8px; border-radius: 999px; color: #c5221f; cursor: pointer; }
.icon-btn-danger:hover { background: #fce8e6; }
.icon-btn-default { background: transparent; border: none; padding: 8px; border-radius: 999px; color: #5f6368; cursor: pointer; }
.icon-btn-default:hover { background: #f1f3f4; }
.icon-btn-default:disabled { opacity: 0.5; cursor: not-allowed; }

/* Pagination */
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid #eee; font-size: 0.875rem; color: #5f6368; }
.pager button { background: transparent; border: none; padding: 6px; border-radius: 6px; cursor: pointer; color: #5f6368; }
.pager button:hover:not(:disabled) { background: #f1f3f4; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead { background: #f8f9fa; color: #5f6368; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table th, .data-table td { text-align: left; padding: 10px 16px; }
.data-table tbody tr { border-top: 1px solid #eee; }
.data-table tbody tr:hover { background: #fafafa; }
.cell-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal {
    background: #fff; border-radius: 12px; max-width: 720px; width: 100%;
    max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid #eee; }
.modal-body { padding: 20px; overflow-y: auto; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 0.875rem; }
.kv dt { color: #5f6368; }
.kv dd { margin: 0; }
.kv a { color: #1a73e8; word-break: break-all; }
.content-block { margin-top: 16px; background: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 12px; font-size: 0.875rem; max-height: 240px; overflow-y: auto; white-space: pre-wrap; }

/* Mobile */
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .header-inner { gap: 8px; }
    .header-inner .logo-mini { transform: scale(0.35); }
    .result { flex-direction: column-reverse; }
    .result-thumb { width: 100%; height: 160px; }
}

/* Login page */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px 16px; background: #fafafa;
}
.login-card {
    background: #fff; border: 1px solid #e0e0e0; border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
    padding: 36px 32px; width: 100%; max-width: 400px;
}
.login-title { font-size: 1.4rem; font-weight: 600; margin: 0; text-align: center; color: #202124; }
.login-subtitle { font-size: 0.875rem; color: #5f6368; text-align: center; margin: 4px 0 24px; }
.login-label { font-size: 0.78rem; font-weight: 500; color: #3c4043; display: block; margin-bottom: 6px; }
