/* KeywordPick - PandaRank Style Clean Light UI */

:root {
    --kp-bg: #ffffff;
    --kp-bg-alt: #f9fafb;
    --kp-text: #111827;
    --kp-text-muted: #6b7280;
    --kp-border: #e5e7eb;
    --kp-primary: #00d68b;
    --kp-primary-hover: #00c17d;
    --kp-font: 'Noto Sans KR', sans-serif;
    --kp-success: #10b981;
    --kp-danger: #ef4444;
}

body {
    background: var(--kp-bg);
    color: var(--kp-text);
    font-family: var(--kp-font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .kp-brand {
    color: #111827;
    font-weight: 700;
}

a {
    color: var(--kp-text);
    text-decoration: none;
}

/* Header */
.kp-header {
    background: #fff;
    border-bottom: 1px solid var(--kp-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.kp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    height: 64px;
    padding: 0 24px;
}

.kp-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--kp-primary);
}

.kp-brand span {
    background: var(--kp-primary);
    color: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.kp-nav-links {
    display: flex;
    gap: 24px;
    margin-left: 32px;
    flex: 1;
}

.kp-nav-links a {
    color: var(--kp-text);
    font-weight: 500;
    font-size: 0.95rem;
}

.kp-nav-links a:hover, .kp-nav-links a.active {
    color: var(--kp-primary);
}

.kp-nav-actions a {
    background: rgba(0, 214, 139, 0.1);
    color: var(--kp-primary);
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Home Section */
.kp-home-shell {
    padding: 60px 24px 80px;
}

.kp-home-inner {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.kp-service-hero {
    margin-bottom: 40px;
}

.kp-service-label {
    display: none;
}

.kp-service-hero h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    color: #1f2937;
}

.kp-service-copy {
    color: var(--kp-text-muted);
    font-size: 1.05rem;
    display: none;
}

.kp-source-panel {
    display: none;
}

/* Search Form */
.kp-home-search {
    position: relative;
    max-width: 700px;
    margin: 0 auto 30px;
}

.kp-home-search input {
    width: 100%;
    background: #fff;
    border: 2px solid var(--kp-primary);
    color: var(--kp-text);
    padding: 18px 24px;
    padding-right: 120px;
    font-size: 1.1rem;
    border-radius: 999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.kp-home-search input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 214, 139, 0.2);
}

.kp-home-search button {
    position: absolute;
    right: 8px;
    top: 8px;
    bottom: 8px;
    background: var(--kp-primary);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    padding: 0 28px;
    border-radius: 999px;
    cursor: pointer;
}

/* Recent Keywords */
.kp-recent-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto 60px;
}

.kp-recent-row strong {
    color: var(--kp-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.kp-recent-row a {
    background: #f3f4f6;
    color: #4b5563;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
}

.kp-recent-row a:hover {
    background: #e5e7eb;
}

/* Features Grid */
.kp-capability-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 60px;
    text-align: left;
}

.kp-capability-grid article {
    background: #fff;
    border: 1px solid var(--kp-border);
    padding: 24px;
    border-radius: 12px;
}

.kp-capability-grid span {
    display: inline-block;
    color: var(--kp-primary);
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.kp-capability-grid strong {
    display: block;
    font-size: 1.15rem;
    margin-bottom: 8px;
}

.kp-capability-grid p {
    color: var(--kp-text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* Shopping Section */
.kp-shopping-section {
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}

.kp-rank-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.kp-rank-heading h2 {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.kp-rank-heading p {
    color: #6b7280;
    font-size: 0.85rem;
    margin: 0;
}

.kp-rank-heading time {
    color: #9ca3af;
    font-size: 0.8rem;
}

.kp-shopping-tabs-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

.kp-shopping-tabs {
    display: flex;
    gap: 20px;
}

.kp-shopping-tabs span {
    color: #6b7280;
    font-weight: 600;
    font-size: 1rem;
    padding-bottom: 12px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kp-shopping-tabs .active {
    color: #00d68b;
}

.kp-shopping-tabs .active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #00d68b;
}

.badge-n {
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 800;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.kp-shopping-periods {
    display: flex;
    gap: 8px;
    padding-bottom: 12px;
    font-size: 0.8rem;
    color: #9ca3af;
}

.kp-shopping-periods .active {
    color: #374151;
    font-weight: 600;
}

.kp-shopping-periods .divider {
    color: #e5e7eb;
}

.kp-category-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    background: #f8f9fa;
    padding: 12px 16px;
    margin-bottom: 24px;
}

.kp-category-row span {
    color: #9ca3af;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.kp-category-row span.active {
    color: #00d68b;
    font-weight: 700;
}
.kp-category-row span:hover:not(.active) {
    color: #6b7280;
}

.kp-shopping-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 40px;
    row-gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kp-shopping-list li {
    border-bottom: 1px solid #f9fafb;
}

/* 초기 로드 시 20개까지만 노출 (JS가 필터링하기 전 깜빡임 방지) */
.kp-shopping-list li:nth-child(n+21) {
    display: none;
}

.kp-shopping-list a {
    display: grid;
    grid-template-columns: 28px 16px auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    text-decoration: none;
}

.kp-rank-no {
    background: #f3f4f6;
    color: #4b5563;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kp-shopping-list li:nth-child(-n+3) .kp-rank-no {
    color: #111827;
}

.kp-rank-trend {
    font-size: 0.65rem;
    text-align: center;
    font-weight: 800;
}
.trend-up { color: #00d68b; }
.trend-down { color: #ef4444; }
.trend-new { color: #00d68b; }
.trend-same { color: #d1d5db; }

.kp-shopping-list strong {
    color: #1f2937;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kp-shopping-list em {
    color: #9ca3af;
    font-size: 0.8rem;
    font-style: normal;
}

.kp-shopping-list small {
    display: none;
}

/* Detail Page */
.kp-detail-shell {
    padding: 40px 24px;
    max-width: 1000px;
    margin: 0 auto;
}

.kp-back-link {
    color: var(--kp-text-muted);
    font-weight: 500;
    margin-bottom: 20px;
    display: inline-block;
}

.kp-inline-search {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
}

.kp-inline-search input {
    background: #fff;
    border: 1px solid var(--kp-border);
    padding: 10px 16px;
    border-radius: 8px;
    width: 300px;
}

.kp-inline-search button {
    background: var(--kp-primary);
    border: none;
    color: #fff;
    padding: 0 20px;
    border-radius: 8px;
    font-weight: 600;
}

.kp-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.kp-summary-card {
    background: #fff;
    border: 1px solid var(--kp-border);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.kp-summary-card span {
    color: var(--kp-text-muted);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 8px;
}

.kp-summary-card strong {
    color: var(--kp-primary);
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.kp-panel {
    background: #fff;
    border: 1px solid var(--kp-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.table th {
    font-weight: 600;
    color: var(--kp-text-muted);
    border-bottom: 2px solid var(--kp-border);
}

.table td {
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .kp-shopping-list { grid-template-columns: 1fr; }
    .kp-capability-grid { grid-template-columns: 1fr; }
    .kp-summary-grid { grid-template-columns: 1fr 1fr; }
}
/* ========================================================
   PANDARANK STYLE DETAIL PAGE (UI Overhaul)
   ======================================================== */
.kp-detail-wrapper {
    background-color: #f9fafb;
    min-height: 100vh;
    padding: 30px 0 60px 0;
}
.kp-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
/* Header */
.kp-detail-header {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.kp-detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.kp-detail-title-area h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 5px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.kp-detail-title-area h1 img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--kp-border);
}
.kp-detail-breadcrumbs {
    font-size: 13px;
    color: #6b7280;
    margin-left: 52px;
}
.kp-detail-breadcrumbs .percent-badge {
    color: #00d68b;
    font-weight: bold;
    margin-left: 4px;
}
.kp-detail-search-vol {
    margin-top: 15px;
    margin-left: 52px;
}
.kp-detail-search-vol span {
    font-size: 13px;
    color: #6b7280;
}
.kp-detail-search-vol strong {
    display: block;
    font-size: 36px;
    font-weight: 800;
    color: #00d68b;
    line-height: 1.1;
    margin-top: 4px;
}
/* Header Metrics */
.kp-detail-metrics {
    display: flex;
    gap: 40px;
    margin-top: 10px;
}
.kp-detail-metric-item {
    display: flex;
    flex-direction: column;
}
.kp-detail-metric-item .label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}
.kp-detail-metric-item .val {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
}
.kp-detail-metric-item .val.optimal {
    color: #111827;
}
.kp-detail-metric-item .sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Tabs */
.kp-detail-tabs-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--kp-border);
    margin-bottom: 30px;
    padding-bottom: 0;
}
.kp-detail-tabs {
    display: flex;
    gap: 30px;
}
.kp-detail-tab {
    padding: 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.kp-detail-tab.active {
    color: #00d68b;
    border-bottom-color: #00d68b;
}
.kp-detail-tab .badge {
    background: #00d68b;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
}
.kp-detail-tab-golden {
    color: #f59e0b;
}
.kp-detail-tab-link {
    color: #00d68b;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}

/* Main Grid */
.kp-detail-main-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    margin-bottom: 20px;
}

/* Panel */
.kp-panel-white {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.kp-panel-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Cards (Right Column) */
.kp-status-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}
.kp-status-card-title {
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.kp-status-card.optimal .kp-status-card-title { color: #10b981; }
.kp-status-card.weak .kp-status-card-title { color: #ef4444; }
.kp-status-card-desc {
    font-size: 13px;
    color: #4b5563;
    margin-bottom: 16px;
}
.kp-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.kp-status-item .label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}
.kp-status-item .val {
    font-size: 14px;
    font-weight: 600;
}

/* Tables */
.kp-table-clean {
    width: 100%;
    border-collapse: collapse;
}
.kp-table-clean th {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
    padding: 12px 8px;
    text-align: right;
    border-bottom: 1px solid var(--kp-border);
}
.kp-table-clean th:first-child { text-align: left; }
.kp-table-clean td {
    font-size: 14px;
    padding: 14px 8px;
    text-align: right;
    border-bottom: 1px solid #f9fafb;
}
.kp-table-clean td:first-child { text-align: left; font-weight: 500; }
.kp-table-clean td .text-blue { color: #3b82f6; font-weight: 600; }

/* Top 10 Products */
.kp-top10-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 15px;
}
.kp-product-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}
.kp-product-rank {
    font-size: 14px;
    font-weight: 700;
    color: #00d68b;
    width: 20px;
    text-align: center;
}
.kp-product-item img {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
}
.kp-product-info {
    flex: 1;
}
.kp-product-title {
    font-size: 13px;
    color: #4b5563;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
    line-height: 1.4;
}
.kp-product-price {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}
.kp-product-btn {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--kp-border);
    border-radius: 6px;
    font-size: 12px;
    color: #4b5563;
    text-decoration: none;
    white-space: nowrap;
}

/* Empty State */
.kp-empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-size: 14px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Bottom Grid */
.kp-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Ad Cost Table */
.kp-ad-cost-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.kp-ad-type-label {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}
.kp-ad-pc { background: #e0f2fe; color: #0284c7; }
.kp-ad-mo { background: #dcfce3; color: #059669; }

.kp-ad-table { width: 100%; border-collapse: collapse; }
.kp-ad-table td {
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f9fafb;
}
.kp-ad-table td:first-child { color: #6b7280; width: 40px; }
.kp-ad-table td:last-child { font-weight: 600; text-align: right; }

html { scroll-behavior: smooth; }

