/* 基础样式与变量 */
:root {
    --primary: #1890ff;
    --primary-light: #40a9ff;
    --primary-dark: #096dd9;
    --secondary: #eb2f96;
    --accent: #13c2c2;
    --success: #52c41a;
    --warning: #faad14;
    --danger: #f5222d;
    
    --bg-main: #f5f7fa;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-sidebar: #ffffff;
    --bg-header: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    
    --border: #e8e8e8;
    --border-active: #1890ff;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --header-height: 100px;
    --sidebar-width: 200px;
    --footer-height: 50px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    flex-direction: column;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* 顶部搜索栏 */
.header {
    background: var(--bg-header);
    height: var(--header-height);
    position: relative;
    z-index: 100;
}

.header-inner {
    max-width: 1800px;
    margin: 0 auto;
    height: 100%;
    padding: 0 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-right: 20px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.logo span {
    font-size: 22px;
    font-weight: 600;
    color: white;
}

/* 搜索区域 */
.search-area {
    flex: 1;
    max-width: 650px;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: var(--radius-full);
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 550px;
}

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

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box button {
    padding: 12px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-box button:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* 天气预报 */
.weather-box {
    flex-shrink: 0;
    background: transparent;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.weather-box iframe {
    display: block;
}

/* 快捷按钮 */
.quick-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 4px;
}

.quick-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.quick-btn i {
    font-size: 18px;
}

.quick-btn span {
    font-size: 11px;
}

/* 主内容区 */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* 左侧分类导航 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header i {
    color: var(--primary);
}

.category-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
    position: relative;
}

.category-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-item:hover {
    background: #f5f5f5;
    color: var(--text-primary);
}

.category-item:hover::before {
    transform: scaleY(1);
}

.category-item.active {
    background: #e6f7ff;
    color: var(--primary);
}

.category-item.active::before {
    transform: scaleY(1);
}

.category-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    opacity: 0.7;
}

.category-item.active i {
    opacity: 1;
    color: var(--primary);
}

.category-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.category-title-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    vertical-align: middle;
}

.category-item span {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

/* 右侧网站列表 */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
}

.content-header {
    padding: 20px 28px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.content-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.content-header h2 i {
    color: var(--primary);
}

.sites-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* 网站卡片网格 */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.site-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.site-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.site-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f5f5f5;
    overflow: hidden;
}

.site-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.site-icon .icon-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary);
}

.site-info {
    flex: 1;
    min-width: 0;
}

.site-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.site-desc {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 页脚 */
.footer {
    height: var(--footer-height);
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    font-size: 13px;
    color: var(--text-muted);
    gap: 20px;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer a:hover {
    color: var(--primary);
}

.footer-divider {
    color: var(--border);
}

.footer-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 页面内容样式 */
.page-content {
    background: white;
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    line-height: 1.8;
    color: var(--text-primary);
}

.page-content h1,
.page-content h2,
.page-content h3 {
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 600;
}

.page-content h1 {
    font-size: 24px;
}

.page-content h2 {
    font-size: 20px;
}

.page-content h3 {
    font-size: 16px;
}

.page-content p {
    margin-bottom: 16px;
}

.page-content ul,
.page-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.page-content li {
    margin-bottom: 8px;
}

.page-content a {
    color: var(--primary);
    text-decoration: none;
}

.page-content a:hover {
    text-decoration: underline;
}

/* 网站收录表单样式 */
.submit-form-container {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

.submit-intro {
    background: linear-gradient(135deg, #e6f7ff 0%, #f0f5ff 100%);
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    margin-bottom: 30px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.submit-intro p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.submit-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-row {
    display: contents;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-label i {
    color: var(--primary);
    font-size: 14px;
}

.form-label .required {
    color: var(--danger);
    font-size: 12px;
}

.form-input,
.form-select,
.form-textarea {
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.submit-btn {
    padding: 14px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.reset-btn {
    padding: 14px 30px;
    background: white;
    color: var(--text-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reset-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.submit-alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.submit-alert.success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.submit-alert.error {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    color: #ff4d4f;
}

.submit-alert i {
    font-size: 18px;
}

/* 动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-card {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
}

.site-card:nth-child(1) { animation-delay: 0.01s; }
.site-card:nth-child(2) { animation-delay: 0.02s; }
.site-card:nth-child(3) { animation-delay: 0.03s; }
.site-card:nth-child(4) { animation-delay: 0.04s; }
.site-card:nth-child(5) { animation-delay: 0.05s; }
.site-card:nth-child(6) { animation-delay: 0.06s; }
.site-card:nth-child(7) { animation-delay: 0.07s; }
.site-card:nth-child(8) { animation-delay: 0.08s; }
.site-card:nth-child(n+9) { animation-delay: 0.09s; }

/* 响应式 */
@media (max-width: 1400px) {
    .weather-box {
        display: none;
    }
}

@media (max-width: 1200px) {
    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .quick-actions {
        display: none;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: auto;
        --sidebar-width: 100%;
        --footer-height: auto;
    }
    
    html, body {
        height: auto;
        overflow: auto;
    }
    
    body {
        min-height: 100vh;
    }
    
    /* 顶部搜索栏 - 简化布局 */
    .header {
        height: auto;
        padding: 12px;
    }
    
    .header-inner {
        flex-direction: column;
        padding: 0;
        gap: 12px;
        height: auto;
    }
    
    .logo {
        margin-right: 0;
        gap: 8px;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .logo-icon img {
        width: 22px;
        height: 22px;
    }
    
    .logo span {
        display: block;
        font-size: 16px;
    }
    
    .search-area {
        width: 100% !important;
        max-width: none !important;
        flex: none !important;
    }
    
    .search-box {
        min-width: 0 !important;
        width: 100% !important;
        padding: 4px;
    }
    
    .search-box input {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .search-box button {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .quick-actions {
        display: none !important;
    }
    
    /* 主内容区 */
    .main-container {
        flex-direction: column;
        height: auto !important;
        min-height: calc(100vh - 160px);
        overflow: visible !important;
    }
    
    /* 侧边栏改为横向滚动标签 */
    .sidebar {
        width: 100% !important;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-shrink: 0;
        height: auto !important;
    }
    
    .sidebar-header {
        display: none;
    }
    
    .category-nav {
        display: flex !important;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 10px 12px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
        height: auto !important;
        flex: none !important;
    }
    
    .category-nav::-webkit-scrollbar {
        display: none;
    }
    
    .category-item {
        flex-shrink: 0;
        padding: 8px 14px;
        margin-bottom: 0;
        border-radius: 20px;
        background: #f0f0f0;
        gap: 6px;
    }
    
    .category-item::before {
        display: none;
    }
    
    .category-item:hover {
        background: #e8e8e8;
    }
    
    .category-item.active {
        background: var(--primary);
        color: white;
    }
    
    .category-item.active i {
        color: white;
        opacity: 1;
    }
    
    .category-item i {
        font-size: 14px;
        opacity: 1;
    }
    
    .category-item span {
        font-size: 13px;
        white-space: nowrap;
    }
    
    .category-icon {
        width: 16px;
        height: 16px;
    }
    
    /* 内容区 */
    .content-area {
        flex: 1;
        min-height: 300px;
        height: auto !important;
        overflow: visible !important;
    }
    
    .content-header {
        padding: 14px 16px;
    }
    
    .content-header h2 {
        font-size: 15px;
    }
    
    .sites-container {
        padding: 12px;
        height: auto !important;
        overflow: visible !important;
        flex: none !important;
    }
    
    /* 网站卡片 - 手机端2列 */
    .sites-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .site-card {
        padding: 10px;
        gap: 8px;
    }
    
    .site-icon {
        width: 32px;
        height: 32px;
    }
    
    .site-icon img {
        width: 18px;
        height: 18px;
    }
    
    .site-icon .icon-text {
        font-size: 13px;
    }
    
    .site-name {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .site-desc {
        font-size: 10px;
    }
    
    /* 页脚 */
    .footer {
        flex-wrap: wrap;
        height: auto !important;
        padding: 12px;
        gap: 8px;
        justify-content: center;
        font-size: 11px;
    }
    
    .footer a {
        font-size: 11px;
    }
    
    .footer-divider {
        display: none;
    }
    
    .footer-right {
        width: 100%;
        margin-left: 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    /* 页面内容 */
    .page-content {
        padding: 16px;
    }
    
    .page-content h1 {
        font-size: 18px;
    }
    
    .page-content h2 {
        font-size: 16px;
    }
    
    /* 网站收录表单 */
    .submit-form-container {
        padding: 16px;
    }
    
    .submit-form {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .submit-btn,
    .reset-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }
    
    .submit-intro {
        padding: 10px 14px;
        margin-bottom: 16px;
    }
}

@media (max-width: 480px) {
    .sites-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .site-card {
        padding: 8px;
        gap: 6px;
    }
    
    .site-icon {
        width: 28px;
        height: 28px;
    }
    
    .site-name {
        font-size: 11px;
    }
    
    .site-desc {
        display: none;
    }
    
    .category-item {
        padding: 6px 10px;
    }
    
    .category-item span {
        font-size: 12px;
    }
}
