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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* 顶部导航 */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.admin-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    font-size: 14px;
    opacity: 0.9;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
}

.logout-btn {
    background: rgba(255,107,107,0.8);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(255,107,107,1);
}

/* 登录遮罩 */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-overlay.hidden {
    display: none;
}

.login-box {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.login-box h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 20px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.error-msg {
    color: #f44336;
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

.success-msg {
    color: #4CAF50;
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

/* 主内容区 */
.admin-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* 区块样式 */
.admin-section {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.admin-section h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

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

/* 上传组件 */
.upload-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.file-input {
    display: none;
}

.upload-btn {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.or-text {
    color: #999;
    font-size: 14px;
}

.url-input {
    flex: 1;
    min-width: 150px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.preview-box {
    margin-top: 10px;
    width: 80px;
    height: 80px;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-box.small {
    width: 60px;
    height: 60px;
}

.preview-box.avatar {
    border-radius: 50%;
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 按钮样式 */
.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

.add-btn {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.add-btn:hover {
    background: #45a049;
}

/* 热门App列表 */
.hot-apps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hot-app-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 10px;
    transition: background 0.2s;
}

.hot-app-item:hover {
    background: #f0f0f0;
}

.sort-buttons {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 10px;
}

.sort-btn {
    background: #e0e0e0;
    border: none;
    width: 24px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    color: #666;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sort-btn:hover:not(:disabled) {
    background: #667eea;
    color: #fff;
}

.sort-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.hot-app-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    margin-right: 15px;
}

.hot-app-info {
    flex: 1;
}

.hot-app-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.hot-app-url {
    font-size: 12px;
    color: #999;
    word-break: break-all;
}

.hot-app-actions {
    display: flex;
    gap: 8px;
}

.edit-btn, .delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.edit-btn {
    background: #2196F3;
    color: #fff;
}

.edit-btn:hover {
    background: #1976D2;
}

.delete-btn {
    background: #ff5252;
    color: #fff;
}

.delete-btn:hover {
    background: #f44336;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
    font-size: 16px;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
}

.cancel-btn, .confirm-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.cancel-btn {
    background: #f0f0f0;
    color: #666;
}

.cancel-btn:hover {
    background: #e0e0e0;
}

.confirm-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.confirm-btn:hover {
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
}

/* 排序手柄 */
.sort-handle {
    cursor: move;
    padding: 5px;
    margin-right: 10px;
    color: #ccc;
    font-size: 18px;
}

.sort-handle:hover {
    color: #999;
}

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

    .admin-header h1 {
        font-size: 16px;
    }

    .hot-app-item {
        flex-wrap: wrap;
    }

    .hot-app-actions {
        width: 100%;
        margin-top: 10px;
        justify-content: flex-end;
    }
}
