/* styles.css - 苹果股票app风格设计 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #111111;
    color: #ffffff;
    overflow-x: hidden;
}

/* 应用容器 */
.app-container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    background-color: #111111;
    position: relative;
    /* 移除overflow: hidden，允许页面内容滚动 */
}

/* 屏幕样式 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto; /* 改为auto，让内容决定高度 */
    min-height: 100vh; /* 保持最小高度为视窗高度 */
    transition: transform 0.3s ease;
}

.screen.active {
    transform: translateX(0);
}

.screen:not(.active) {
    transform: translateX(100%);
}

/* 主屏幕样式 */
#main-screen {
    display: flex;
    flex-direction: column;
}

/* 标题栏 */
.header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333333;
}

.header h1 {
    font-size: 20px;
    font-weight: 700;
    color: #2997ff;
}

/* 搜索栏 */
.search-bar {
    padding: 12px 16px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333333;
}

#stock-search {
    width: 100%;
    height: 40px;
    padding: 0 16px;
    background-color: #2d2d2d;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: all 0.2s ease;
}

#stock-search::placeholder {
    color: #666666;
}

/* 搜索结果下拉列表 */
.search-results {
    position: absolute;
    top: 110px; /* 标题栏60px + 搜索栏50px */
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: none;
}

.search-results.active {
    display: block;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 3px;
}

.search-result-item {
    padding: 14px 16px;
    border-bottom: 1px solid #333333;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #252525;
}

.search-result-info {
    display: flex;
    flex-direction: column;
}

.search-result-name {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
}

.search-result-code {
    font-size: 14px;
    color: #888888;
    margin-top: 2px;
}

.search-result-price {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

/* 适配移动设备 */
@media (max-width: 480px) {
    .search-bar {
        padding: 8px 12px;
        position: relative;
        z-index: 100;
    }
    
    #stock-search {
        height: 36px;
        font-size: 15px;
        padding: 0 12px;
        background-color: #2d2d2d;
        border: 1px solid transparent;
    }
    
    #stock-search:focus {
        background-color: #333333;
        border-color: #4a4a4a;
    }
    
    .search-results {
        top: 102px !important; /* 强制使用正确的位置 */
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-height: 200px !important;
        overflow-y: auto !important;
        background-color: #1a1a1a !important;
        border: 1px solid #333333 !important;
        border-top: none !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
        z-index: 200 !important;
        display: none !important;
    }
    
    .search-results.active {
        display: block !important;
    }
}

/* 策略分组列表 */
.strategy-groups {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 20px 16px;
}

/* 滚动条样式 */
.strategy-groups::-webkit-scrollbar {
    width: 6px;
}

.strategy-groups::-webkit-scrollbar-track {
    background: transparent;
}

.strategy-groups::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 3px;
}

/* 策略分组 */
.strategy-group {
    margin-top: 16px;
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 策略分组标题 */
.strategy-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: #252525;
    cursor: pointer;
    transition: background-color 0.2s ease;
    /* user-select: none; */
}

.strategy-title:hover {
    background-color: #2d2d2d;
}

.strategy-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: #2997ff;
    margin: 0;
}

/* 策略标题按钮组 */
.strategy-buttons {
    display: flex;
    align-items: center;
}

/* 展开/收起按钮 */
.expand-btn {
    /* width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #888888;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease; */
    background-color: transparent;
    color: #1e90ff; /* 深蓝色文字 */
    border: none;
    font-size: 14px; /* 调整大小以匹配"更多"按钮 */
    cursor: pointer;
    padding: 2px 5px;
}

.expand-btn:hover {
    color: #ffffff;
    transform: rotate(180deg);
}

.expand-btn.collapsed {
    transform: rotate(0deg);
}

/* 监测按钮样式，与"更多"按钮保持一致 */
.monitor-btn {
  background-color: transparent; /* 透明背景 */
  color: #1e90ff; /* 蓝色文字 */
  border: 1px solid #1e90ff; /* 蓝色边框 */
  border-radius: 10px; /* 圆角 4px*/ 
  padding: 4px 10px; /* 内边距 6px 12px*/
  margin: 0 5px; /* 外边距 */
  cursor: pointer; /* 指针样式 */
  font-size: 14px; /* 字体大小 */
  transition: all 0.3s ease; /* 过渡效果 */
}

.monitor-btn:hover {
  background-color: rgba(30, 144, 255, 0.1); /* 悬停时轻微背景色 */
}

/* 分组内股票列表 */
.group-stock-list {
    max-height: 500px;
    overflow: auto; 
    transition: max-height 0.3s ease;
}

.group-stock-list.collapsed {
    max-height: 0;
}

/* 分组股票列表滚动条样式 */
.group-stock-list::-webkit-scrollbar {
    width: 6px;
}

.group-stock-list::-webkit-scrollbar-track {
    background: transparent;
}

.group-stock-list::-webkit-scrollbar-thumb {
    background: #444444;
    border-radius: 3px;
}
/* 股票项 */
.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: #1a1a1a;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-top: 1px solid #333333;
}

.stock-item:first-child {
    border-top: none;
}

.stock-item:hover {
    background-color: #252525;
}

/* 股票左侧信息 */
.stock-left {
    display: flex;
    flex-direction: column;
}

.stock-name {
    font-size: 18px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 2px;
}

.stock-code {
    font-size: 14px;
    color: #888888;
}

/* 股票右侧信息 */
.stock-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stock-price {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 2px;
}

.stock-change-container {
    display: flex;
    align-items: center;
}

.stock-change {
    font-size: 14px;
    margin-right: 8px;
}

.stock-change.rise {
    color: #ef5350;
}

.stock-change.fall {
    color: #00cc66;
}

.stock-rate {
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 500;
    color: #ffffff;
    min-width: 65px;
    text-align: center;
}

.stock-rate.rise {
    background-color: #ef5350;
    color: #ffffff;
}

.stock-rate.fall {
    background-color: #00cc66;
    color: #ffffff;
}

/* 详情屏幕样式 */
#detail-screen {
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 允许详情页面内容滚动 */
}

/* 详情头部 */
.detail-header {
    height: 60px;
    display: flex;
    align-items: center;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333333;
    padding: 0 16px;
}

.back-button {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #2997ff;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    margin-right: 16px;
}

.detail-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-align: center;
    margin-right: 56px; /* 偏移2个汉字位置，考虑返回按钮宽度和边距 */
    flex: 1;
}

/* 股票信息 */
.stock-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #333333;
}

.stock-info .stock-code {
    font-size: 16px;
    color: #888888;
    margin-bottom: 10px;
}

.stock-info .stock-price {
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.stock-info .stock-change {
    font-size: 20px;
    font-weight: 500;
    color: #ff3b30; /* #ef5350 */
}

.stock-info .stock-change.fall {
    color: #00cc66;
}

.favorite-button {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    outline: none;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}


.favorite-button:hover {
    color: #ffd700;
}

.favorite-button.active {
    color: #ffd700;
}
/* K线图容器 */
.chart-container {
    display: flex;
    flex-direction: column;
    background-color: #111111;
    padding: 16px;
}

/* 时间周期选择器 */
.period-selector {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    position: relative;
}

/* 时间周期选择器滚动条样式 */
.period-selector::-webkit-scrollbar {
    height: 8px; /* 滚动条高度 */
}

.period-selector::-webkit-scrollbar-track {
    background-color: #2d2d2d; /* 滚动条背景色（深灰色） */
    border-radius: 4px;
}

.period-selector::-webkit-scrollbar-thumb {
    background-color: #444444; /* 滚动条滑块颜色 */
    border-radius: 4px;
}

.period-selector::-webkit-scrollbar-thumb:hover {
    background-color: #555555; /* 滚动条滑块悬停颜色 */
}

.period-btn {
    padding: 8px 16px;
    background-color: #2d2d2d;
    border: none;
    border-radius: 20px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.period-btn:hover {
    background-color: #3a3a3a;
}

.period-btn.active {
    background-color: #007aff;
    color: #ffffff;
}

/* 下拉菜单样式 */
.dropdown {
    position: relative;
    display: inline-block;
    z-index: 100;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background-color: #2d2d2d;
    border: none;
    border-radius: 20px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.dropdown-btn:hover {
    background-color: #3a3a3a;
}

.dropdown-btn.active {
    background-color: #007aff;
    color: #ffffff;
}

.dropdown-arrow {
    margin-left: 5px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

.dropdown-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 150px;
    max-height: 200px;
    overflow-y: auto;
    background-color: #1c1c1e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
    display: none;
    margin-top: 4px;
    /* 确保下拉菜单显示在1天按钮的下方，而不是挡住其他按钮 */
    width: 200px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    padding: 10px 16px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: #2d2d2d;
}

.dropdown-item[data-period="1天"] {
    font-weight: 600;
    color: #007aff;
}

/* K线图 */
.kline-chart {
    flex: 1;
    background-color: #1a1a1a;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    max-height: 550px; /* 限制K线图最大高度，防止占据过多空间 */
    min-height: 350px; /* 设置最小高度，确保K线图有足够显示空间 */
}

/* 数据指标区域 */
.data-indicators {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    background-color: #1a1a1a;
    border-top: 1px solid #333333;
    border-bottom: 1px solid #333333;
}

.indicator-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.indicator-label {
    font-size: 14px;
    color: #888888;
    margin-bottom: 8px;
}

.indicator-value {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    padding: 16px;
    background-color: #111111;
    gap: 12px;
}

.sell-btn, .buy-btn {
    flex: 1;
    height: 50px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    outline: none;
    transition: opacity 0.2s ease;
}

.sell-btn {
    background-color: #ef5350;
}

.buy-btn {
    background-color: #26a69a;
}

.sell-btn:hover, .buy-btn:hover {
    opacity: 0.9;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }
    
    .data-indicators {
        padding: 12px;
    }
    
    .indicator-item {
        padding: 0 8px;
    }
    
    .action-buttons {
        padding: 12px;
    }
    
    .kline-chart {
        max-height: 400px; /* 增大手机上的K线图最大高度 */
    }
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #111111;
    padding: 20px;
}

.login-form {
    width: 100%;
    max-width: 480px;
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 40px 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.login-form h1 {
    font-size: 24px;
    font-weight: 700;
    color: #2997ff;
    text-align: center;
    margin-bottom: 32px;
}

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

.form-group input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    background-color: #2d2d2d;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: all 0.2s ease;
}

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

.form-group input:focus {
    background-color: #333333;
}

/* 处理浏览器自动填充导致的背景色问题 */
.form-group input:-webkit-autofill,
.form-group input:-webkit-autofill:hover,
.form-group input:-webkit-autofill:focus,
.form-group input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #2d2d2d inset !important;
    -webkit-text-fill-color: #ffffff !important;
    background-color: #2d2d2d !important;
    background-clip: content-box !important;
}

/* 针对Mozilla浏览器的自动填充样式 */
.form-group input:-moz-autofill,
.form-group input:-moz-autofill:hover,
.form-group input:-moz-autofill:focus,
.form-group input:-moz-autofill:active {
    box-shadow: 0 0 0 30px #2d2d2d inset !important;
    -moz-text-fill-color: #ffffff !important;
    background-color: #2d2d2d !important;
    background-clip: content-box !important;
}

/* 确保用户名输入框与密码框样式一致 */
.form-group input[type="text"],
.form-group input[type="tel"] {
    background-color: #2d2d2d !important;
}

.code-group {
    display: flex;
    gap: 12px;
}

.code-group input {
    flex: 1;
}

#send-code-btn {
    width: 120px;
    height: 50px;
    background-color: transparent;
    border: 1px solid #2997ff;
    border-radius: 8px;
    color: #2997ff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

#send-code-btn:hover:not(:disabled) {
    background-color: rgba(41, 151, 255, 0.1);
}

#send-code-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    width: 100%;
    height: 50px;
    background-color: #2997ff;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    outline: none;
    transition: opacity 0.2s ease;
}

.primary-btn:hover {
    opacity: 0.9;
}

.login-options {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
}

.login-options a {
    color: #2997ff;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-options a:hover {
    color: #5caaff;
}

/* 登录页面响应式设计 */
@media (max-width: 480px) {
    .login-container {
        padding: 16px;
    }
    
    .login-form {
        padding: 32px 20px;
    }
    
    .login-form h1 {
        font-size: 22px;
        margin-bottom: 28px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group input,
    .primary-btn {
        height: 48px;
        font-size: 15px;
    }
    
    #send-code-btn {
        width: 110px;
        height: 48px;
        font-size: 13px;
    }
}
/* 登录表单切换样式 */
.login-form-section {
    display: none;
}

.login-form-section.active {
    display: block;
}

/* 密码输入框样式（确保与其他输入框一致） */
.form-group input[type="password"] {
    /* 继承现有输入框样式 */
    width: 100%;
    height: 50px;
    padding: 0 16px;
    background-color: #2d2d2d;
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-shadow: none;
    transition: all 0.2s ease;
}

.form-group input[type="password"]::placeholder {
    color: #666666;
}

.form-group input[type="password"]:focus {
    background-color: #333333;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .form-group input[type="password"] {
        height: 48px;
        font-size: 15px;
    }
}
/* 密码设置页面样式 */
.subtitle {
    text-align: center;
    color: #666666;
    font-size: 14px;
    margin-bottom: 32px;
}

.form-group input[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .subtitle {
        font-size: 13px;
        margin-bottom: 28px;
    }
}

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

.custom-alert.active {
    display: flex;
}

.custom-alert-content {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.custom-alert-message {
    font-size: 16px;
    color: #ffffff;
    margin-bottom: 24px;
    line-height: 1.5;
}

.custom-alert-content .primary-btn {
    width: auto;
    min-width: 120px;
    height: 44px;
    font-size: 15px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .custom-alert-content {
        padding: 24px;
        width: 92%;
    }
    
    .custom-alert-message {
        font-size: 15px;
        margin-bottom: 20px;
    }
    
    .custom-alert-content .primary-btn {
        height: 42px;
        font-size: 14px;
    }
}

