/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1976d2;
    --primary-dark: #1565c0;
    --secondary-color: #757575;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #212121;
    --text-secondary: #757575;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* 头部样式 */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.date-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-selector input[type="date"] {
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
}

/* 标签导航 */
.tab-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: rgba(25, 118, 210, 0.1);
    color: var(--primary-color);
}

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

/* 标签内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 卡片样式 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* 表单网格 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

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

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--card-bg);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-group input::placeholder {
    color: #bbb;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

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

.btn-secondary:hover {
    background: #616161;
    transform: translateY(-1px);
}

.btn-large {
    padding: 14px 32px;
    font-size: 1rem;
}

/* 操作按钮区域 */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* 个股列表 */
.stock-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
}

.stock-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stock-name {
    font-weight: 600;
    color: var(--text-primary);
}

.stock-code {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stock-concept {
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(25, 118, 210, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
}

.stock-limit-badge {
    background: var(--danger-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
}

.stock-delete {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background 0.3s;
}

.stock-delete:hover {
    background: rgba(244, 67, 54, 0.1);
}

/* 历史记录列表 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: #e8e8e8;
    transform: translateX(4px);
}

.history-date {
    font-weight: 600;
    color: var(--text-primary);
}

.history-summary {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.history-profit {
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}

.history-profit.positive {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.history-profit.negative {
    background: rgba(244, 67, 54, 0.1);
    color: var(--danger-color);
}

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

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--text-primary);
}

/* 响应式设计 - 手机端 */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 16px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .date-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .date-selector input[type="date"] {
        width: 100%;
    }

    .tab-nav {
        padding: 6px;
    }

    .tab-btn {
        padding: 10px 14px;
        font-size: 0.875rem;
    }

    .card {
        padding: 16px;
    }

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

    .actions {
        flex-direction: column;
        padding: 16px;
    }

    .btn-large {
        width: 100%;
    }

    .stock-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* 平板端 */
@media (min-width: 769px) and (max-width: 1024px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 电脑端 */
@media (min-width: 1025px) {
    .container {
        padding: 24px;
    }

    .form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 空状态提示 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 数据统计卡片 */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 8px 0;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

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