/* ========================================
   小红书关键词搜索查询系统 - 主样式
   配色：小红书红 #FF2442 为主色调
   ======================================== */

/* CSS Variables */
:root {
    --xhs-red: #FF2442;
    --xhs-red-dark: #E01E3A;
    --xhs-red-light: #FFF0F3;
    --xhs-pink: #FF5A7E;
    --xhs-bg: #F5F5F5;
    --xhs-white: #FFFFFF;
    --xhs-text: #333333;
    --xhs-text-secondary: #666666;
    --xhs-text-light: #999999;
    --xhs-border: #E8E8E8;
    --xhs-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    --xhs-radius: 12px;
    --xhs-radius-sm: 8px;
    --xhs-transition: all 0.3s ease;
    
    --competition-low: #52C41A;
    --competition-mid: #FAAD14;
    --competition-high: #FF4D4F;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--xhs-bg);
    color: var(--xhs-text);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #FF2442 0%, #FF5A7E 100%);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(255, 36, 66, 0.25);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    justify-content: space-between;
}

.header .logo {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.header .logo-icon {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.header-nav {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    align-items: center;
    gap: 20px;
}

.header-nav a {
    display: inline-block;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    padding: 8px 16px;
    border-radius: 20px;
    -webkit-transition: all 0.3s ease;
    transition: all 0.3s ease;
    text-decoration: none;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.header-nav a:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.header-nav .btn-admin {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
}

/* Main Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Hero Search Section */
.hero-section {
    text-align: center;
    padding: 60px 24px 40px;
    background: var(--xhs-white);
    border-radius: 0 0 var(--xhs-radius) var(--xhs-radius);
    box-shadow: var(--xhs-shadow);
    margin-bottom: 24px;
}

.hero-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--xhs-text);
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 16px;
    color: var(--xhs-text-secondary);
    margin-bottom: 32px;
}

/* Search Box */
.search-box {
    max-width: 680px;
    margin: 0 auto;
    position: relative;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--xhs-white);
    border: 2px solid var(--xhs-border);
    border-radius: 50px;
    padding: 4px;
    transition: var(--xhs-transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.search-input-wrapper:focus-within {
    border-color: var(--xhs-red);
    box-shadow: 0 4px 20px rgba(255, 36, 66, 0.15);
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 14px 20px;
    background: transparent;
    color: var(--xhs-text);
}

.search-input-wrapper input::placeholder {
    color: var(--xhs-text-light);
}

.search-input-wrapper button {
    background: linear-gradient(135deg, #FF2442, #FF5A7E);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--xhs-transition);
    white-space: nowrap;
}

.search-input-wrapper button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 36, 66, 0.4);
}

.search-input-wrapper button:active {
    transform: scale(0.98);
}

/* Search Filters */
.search-filters {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.search-filters select {
    padding: 8px 16px;
    border: 1px solid var(--xhs-border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--xhs-text-secondary);
    background: var(--xhs-white);
    cursor: pointer;
    outline: none;
    transition: var(--xhs-transition);
}

.search-filters select:focus {
    border-color: var(--xhs-red);
}

/* Hot Searches */
.hot-searches {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.hot-searches .hot-label {
    font-size: 13px;
    color: var(--xhs-text-light);
    display: flex;
    align-items: center;
    gap: 4px;
}

.hot-searches .hot-tag {
    display: inline-block;
    padding: 6px 14px;
    background: var(--xhs-red-light);
    color: var(--xhs-red);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: var(--xhs-transition);
}

.hot-searches .hot-tag:hover {
    background: #FFE0E6;
    transform: translateY(-1px);
}

/* Results Section */
.results-section {
    display: none;
}

.results-section.active {
    display: block;
}

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

.results-count {
    font-size: 15px;
    color: var(--xhs-text-secondary);
}

.results-count strong {
    color: var(--xhs-red);
    font-size: 18px;
}

/* Keyword Table */
.table-container {
    background: var(--xhs-white);
    border-radius: var(--xhs-radius);
    box-shadow: var(--xhs-shadow);
    overflow: hidden;
}

.keyword-table {
    width: 100%;
    border-collapse: collapse;
}

.keyword-table thead {
    background: linear-gradient(135deg, #FFF0F3, #FFE8EC);
}

.keyword-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--xhs-text-secondary);
    white-space: nowrap;
    border-bottom: 2px solid #FFE0E6;
}

.keyword-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 24px;
    transition: background 0.2s;
}

.keyword-table th.sortable:hover {
    background: #FFD6DD;
}

.keyword-table th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 8px;
    opacity: 0.3;
    font-size: 12px;
}

.keyword-table th.sortable.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: var(--xhs-red);
}

.keyword-table th.sortable.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: var(--xhs-red);
}

.keyword-table td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--xhs-border);
    vertical-align: middle;
}

.keyword-table tbody tr {
    transition: background 0.2s ease;
}

.keyword-table tbody tr:hover {
    background: #FFF9FA;
}

.keyword-table .keyword-cell {
    font-weight: 600;
    color: var(--xhs-text);
    font-size: 15px;
}

.keyword-table .keyword-cell a {
    color: var(--xhs-text);
    transition: var(--xhs-transition);
}

.keyword-table .keyword-cell a:hover {
    color: var(--xhs-red);
}

/* Competition Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-low {
    background: #F6FFED;
    color: var(--competition-low);
    border: 1px solid #B7EB8F;
}

.badge-mid {
    background: #FFFBE6;
    color: var(--competition-mid);
    border: 1px solid #FFE58F;
}

.badge-high {
    background: #FFF2F0;
    color: var(--competition-high);
    border: 1px solid #FFCCC7;
}

/* Trend */
.trend-up { color: #52C41A; }
.trend-down { color: #FF4D4F; }
.trend-stable { color: #999; }

/* Recommend Reason */
.recommend-reason {
    max-width: 260px;
    font-size: 13px;
    color: var(--xhs-text-secondary);
    line-height: 1.5;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    padding: 20px;
}

.pagination button {
    min-width: 40px;
    height: 40px;
    border: 1px solid var(--xhs-border);
    border-radius: 20px;
    background: var(--xhs-white);
    color: var(--xhs-text);
    font-size: 14px;
    cursor: pointer;
    transition: var(--xhs-transition);
}

.pagination button:hover:not(:disabled) {
    border-color: var(--xhs-red);
    color: var(--xhs-red);
}

.pagination button.active {
    background: var(--xhs-red);
    color: white;
    border-color: var(--xhs-red);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 13px;
    color: var(--xhs-text-light);
    margin: 0 8px;
}

/* Loading & Empty */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--xhs-text-light);
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--xhs-border);
    border-top-color: var(--xhs-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--xhs-text-light);
}

.empty-state .empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
}

/* Initial State */
.initial-state {
    text-align: center;
    padding: 60px 20px;
}

.initial-state .initial-icon {
    font-size: 80px;
    margin-bottom: 16px;
}

.initial-state p {
    font-size: 18px;
    color: var(--xhs-text-light);
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 160px;
    background: var(--xhs-white);
    border-radius: var(--xhs-radius);
    padding: 20px;
    box-shadow: var(--xhs-shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card .stat-icon.red { background: var(--xhs-red-light); }
.stat-card .stat-icon.blue { background: #E6F7FF; }
.stat-card .stat-icon.green { background: #F6FFED; }
.stat-card .stat-icon.orange { background: #FFF7E6; }

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--xhs-text);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--xhs-text-light);
}

/* Login Tip */
.login-tip {
    display: none;
    text-align: center;
    padding: 20px 24px;
    margin-top: 20px;
    background: linear-gradient(135deg, #FFF0F3, #FFFFFF);
    border: 1px solid #FFE0E6;
    border-radius: var(--xhs-radius);
}

.login-tip p {
    font-size: 14px;
    color: var(--xhs-text-secondary);
    margin-bottom: 12px;
}

.login-tip .btn-login {
    display: inline-block;
    padding: 8px 24px;
    background: var(--xhs-red);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    text-decoration: none;
    transition: var(--xhs-transition);
}

.login-tip .btn-login:hover {
    background: var(--xhs-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 36, 66, 0.3);
}

/* Footer */
.footer {
    text-align: center;
    padding: 32px 24px;
    color: var(--xhs-text-light);
    font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 16px 30px;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .search-input-wrapper input {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .search-input-wrapper button {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .keyword-table {
        font-size: 12px;
    }
    
    .keyword-table th,
    .keyword-table td {
        padding: 10px 8px;
    }
    
    .recommend-reason {
        max-width: 150px;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .stats-bar {
        gap: 10px;
    }
    
    .stat-card {
        min-width: 140px;
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .hero-section {
        padding: 30px 12px 24px;
    }
    
    .hero-title {
        font-size: 20px;
    }
    
    .search-filters {
        flex-direction: column;
        align-items: stretch;
    }
}
