/* 全局变量 */
:root {
    --primary-color: #1E3A8A;
    --secondary-color: #3B82F6;
    --accent-color: #60A5FA;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --error-color: #EF4444;
    --bg-color: #F3F4F6;
    --surface-color: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
}

/* 导航栏 */
.navbar {
    background-color: var(--primary-color);
    color: white;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-user span {
    font-size: 14px;
}

.btn-logout {
    background-color: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background-color: rgba(255,255,255,0.2);
}

/* 页面容器 */
.container {
    max-width: 1200px;
    margin: 84px auto 20px; /* Top margin for navbar */
    padding: 0 20px;
}

/* 标题 */
h1 { font-size: 28px; margin-bottom: 20px; color: var(--text-primary); }
h2 { font-size: 22px; margin-bottom: 15px; color: var(--text-primary); }
h3 { font-size: 18px; margin-bottom: 10px; color: var(--text-primary); }

/* 卡片 */
.card {
    background-color: var(--surface-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.card-header {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    height: 40px;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.form-control.error {
    border-color: var(--error-color);
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s, opacity 0.2s;
    text-decoration: none;
}

.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background-color: var(--secondary-color); color: white; }
.btn-secondary { background-color: #6B7280; color: white; }
.btn-success { background-color: var(--success-color); color: white; }
.btn-danger { background-color: var(--error-color); color: white; }
.btn-block { width: 100%; }

/* Tooltip */
.tooltip-text {
    display: none;
    position: absolute;
    background-color: rgba(0,0,0,0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 10;
    top: 100%;
    left: 0;
    margin-top: 5px;
    white-space: nowrap;
}

.form-group:hover .tooltip-text {
    display: block;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 登录/注册页特定样式 */
.auth-container {
    max-width: 400px;
    margin: 100px auto;
}

.auth-toggle {
    text-align: center;
    margin-top: 15px;
}

.auth-toggle a {
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
}

/* 产品列表网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .product-grid { grid-template-columns: 1fr; }
    .navbar { padding: 0 15px; }
    .container { padding: 0 15px; }
}

/* 固件上传区域 */
.upload-area {
    border: 2px dashed #D1D5DB;
    background-color: #F9FAFB;
    border-radius: 8px;
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--secondary-color);
    background-color: #EFF6FF;
}

.upload-icon {
    font-size: 32px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* 提示框 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.alert-success { background-color: #D1FAE5; color: #065F46; }
.alert-error { background-color: #FEE2E2; color: #991B1B; }

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 产品卡片图片悬停效果 */
.product-card {
    position: relative;
    overflow: hidden;
}

.product-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.product-image-overlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
}

.product-card:hover .product-image-overlay {
    opacity: 1;
}

.product-card-details {
    position: relative;
    z-index: 2;
    transition: opacity 0.3s;
}

.product-card:hover .product-card-details {
    opacity: 0;
}

.product-card-actions {
    position: relative;
    z-index: 3;
}

.product-card-header {
    position: relative;
    z-index: 3;
}
