/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --bg: #f3f4f6;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 头部 ===== */
.site-header {
    text-align: center;
    padding: 30px 20px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.site-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ===== 板块标题 ===== */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 24px 0 16px;
    padding-left: 12px;
    border-left: 4px solid var(--primary);
    color: var(--text);
}

/* ===== 店铺区域 - 关键：三店铺一行不换行 ===== */
.shops-row {
    display: flex;
    flex-wrap: nowrap; /* 强制不换行 */
    gap: 12px;
    margin-bottom: 24px;
    overflow-x: auto; /* 如果太窄允许横向滚动，但不换行 */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.shops-row::-webkit-scrollbar {
    display: none;
}

.shop-card {
    flex: 1 1 0; /* 三等分，且允许缩小 */
    min-width: 0; /* 允许flex子项缩小 */
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
}

.shop-card:hover,
.shop-card:active {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.shop-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid var(--primary-light);
    margin: 0 auto 20px;
    display: block;
    background: var(--bg);
}

.shop-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 6px;
    font-weight: 600;
}

.shop-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 软件卡片 ===== */
.software-grid {
    display: grid;
    gap: 20px;
}

.software-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 16px;
    flex-direction: column;
}

@media (min-width: 640px) {
    .software-card {
        flex-direction: row;
    }
}

.software-icon-wrap {
    flex-shrink: 0;
    text-align: center;
}

.software-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 2px solid var(--border);
    background: var(--bg);
}

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

.software-name {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.software-intro {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* ===== 价格选项 ===== */
.prices-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.price-tag {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    min-width: 70px;
    cursor: pointer;
    transition: all 0.2s;
}

.price-tag:hover,
.price-tag.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary-dark);
    color: white;
    transform: scale(1.05);
}

.price-tag .period {
    font-size: 0.75rem;
    font-weight: 600;
}

.price-tag .price {
    font-size: 1.1rem;
    font-weight: 800;
    color: #dc2626;
}

.price-tag.active .price,
.price-tag:hover .price {
    color: #fbbf24;
}

.price-tag .desc {
    font-size: 0.65rem;
    opacity: 0.8;
}

/* ===== 版本区域 ===== */
.versions-section {
    margin-top: 8px;
}

.version-block {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 12px;
}

.version-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.version-name::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.download-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* 下载按钮样式 */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-direct {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-baidu {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
}

.btn-quark {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
}

.btn-xunlei {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    color: white;
}

.download-code {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 2px;
}

/* ===== 后台样式 ===== */
.admin-body {
    background: #f1f5f9;
}

.admin-header {
    background: var(--primary-dark);
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.admin-header h1 {
    font-size: 1.3rem;
}

.admin-nav {
    display: flex;
    gap: 8px;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.15);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255,255,255,0.3);
}

.admin-main {
    max-width: 1000px;
    margin: 24px auto;
    padding: 0 20px;
}

.admin-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.admin-card h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* 列表表格 */
.item-list {
    list-style: none;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    background: #fafafa;
}

.item-row img {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
    background: white;
}

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

.item-info .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.item-info .sub {
    font-size: 0.8rem;
    color: var(--text-light);
}

.item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* 登录页 */
.login-container {
    max-width: 400px;
    margin: 80px auto;
    padding: 0 20px;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--primary-dark);
}

.error-msg {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid #fecaca;
}

.success-msg {
    background: #f0fdf4;
    color: #16a34a;
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border: 1px solid #bbf7d0;
}

/* 子项编辑区 */
.sub-item-block {
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
}

.sub-item-block .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-sub-btn {
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.add-sub-btn:hover {
    border-color: var(--primary);
    background: #eef2ff;
}

.thumb-preview {
    max-width: 80px;
    max-height: 80px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    margin-top: 8px;
}

/* ===== 手机端适配 ===== */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .site-header {
        padding: 20px 16px 16px;
        margin-bottom: 16px;
    }
    
    .site-header h1 {
        font-size: 1.4rem;
    }
    
    /* 关键：手机端三店铺仍然保持一行，缩小内边距 */
    .shops-row {
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .shop-card {
        padding: 10px 6px;
    }
    
    .shop-avatar {
        width: 48px;
        height: 48px;
        border-width: 2px;
        margin-bottom: 6px;
    }
    
    .shop-number {
        font-size: 0.6rem;
        padding: 1px 6px;
    }
    
    .shop-name {
        font-size: 0.75rem;
    }
    
    .section-title {
        font-size: 1.1rem;
        margin: 16px 0 12px;
    }
    
    .software-card {
        padding: 14px;
        gap: 12px;
    }
    
    .software-icon {
        width: 56px;
        height: 56px;
    }
    
    .software-name {
        font-size: 1rem;
    }
    
    .software-intro {
        font-size: 0.82rem;
    }
    
    .price-tag {
        padding: 4px 8px;
        min-width: 58px;
    }
    
    .price-tag .period {
        font-size: 0.65rem;
    }
    
    .price-tag .price {
        font-size: 0.95rem;
    }
    
    .price-tag .desc {
        font-size: 0.55rem;
    }
    
    .btn-download {
        padding: 7px 10px;
        font-size: 0.75rem;
    }
    
    .admin-nav {
        flex-wrap: wrap;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}
