/* 自选股页面样式 */

.section-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.page-header {
    text-align: center;
    color: #1a56a7;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

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

.section-header h2 {
    color: #1a56a7;
    margin: 0;
    font-size: 1.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    background: linear-gradient(135deg, #1a56a7 0%, #144785 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    cursor: pointer;
    gap: 5px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 86, 167, 0.3);
    color: white;
    text-decoration: none;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.btn-remove:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(200, 35, 51, 0.3);
}

/* 自选股网格布局 - 重新实现 */
.shares-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

/* 骨架屏样式 */
.shares-skeleton {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.skeleton-card {
    background: #f0f0f0;
    border-radius: 8px;
    height: 120px;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 响应式网格布局 */
@media (min-width: 1800px) {
    .shares-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

@media (min-width: 1600px) and (max-width: 1799px) {
    .shares-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

@media (min-width: 1400px) and (max-width: 1599px) {
    .shares-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (min-width: 1200px) and (max-width: 1399px) {
    .shares-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .shares-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .shares-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .shares-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .shares-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

@media (max-width: 400px) {
    .shares-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

.share-card {
    background: white;
    border: 1px solid #e1e5eb;
    border-radius: 10px;
    padding: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 140px; /* 减小最小高度，使卡片更紧凑 */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.share-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
    border-color: #1a56a7;
}

.share-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    margin-bottom: 0.4rem;
    margin-right: 80px; /* 为右上角的加入时间预留空间 */
}

.share-info {
    flex: 1;
    min-width: 0; /* 防止内容溢出 */
}

.share-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a56a7;
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-code {
    font-size: 0.75rem;
    font-weight: 500;
    color: #7f8c8d;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-price {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.1rem;
}

.share-change {
    font-size: 0.75rem;
    font-weight: 600;
}

.share-change.positive {
    color: #28a745;
}

.share-change.negative {
    color: #dc3545;
}

.share-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.65rem;
    color: #6c757d;
}

.added-date {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.05rem 0.15rem;
    background: rgba(23, 162, 184, 0.08);
    border-radius: 3px;
    font-size: 0.55rem;
    color: #17a2b8;
    border-left: 1px solid #17a2b8;
    z-index: 2;
    max-width: 75px; /* 更精确的最大宽度控制 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.added-date i {
    color: #17a2b8;
    font-size: 0.55rem;
}

.update-time {
    display: none;
}

/* 按钮样式补充 */
.btn-refresh, .btn-remove {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.btn-remove {
    background: #dc3545;
}

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

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

.btn-refresh.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* 状态指示器 */
.status-indicator {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    z-index: 1;
}

.status-indicator.error {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.status-indicator.warning {
    background: rgba(255, 193, 7, 0.9);
    color: #212529;
}

.status-indicator.success {
    background: rgba(40, 167, 69, 0.9);
    color: white;
}

.share-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: auto;
    gap: 0.3rem;
    padding-top: 0.3rem;
}

/* 小屏幕设备上的调整 */
@media (max-width: 768px) {
    .share-price {
        font-size: 0.9rem;
    }
    
    .share-change {
        font-size: 0.7rem;
    }
    
    .share-stats {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .share-price {
        font-size: 0.85rem;
    }
    
    .share-change {
        font-size: 0.65rem;
    }
    
    .share-stats {
        font-size: 0.55rem;
    }
}

.index-chart-container {
    height: 400px;
    position: relative;
}

.rankings-tabs {
    display: flex;
    margin-bottom: 1rem;
}

.tab-btn {
    background: #e9ecef;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    margin-right: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: #1a56a7;
    color: white;
}

.rankings-container {
    min-height: 300px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid #e1e5eb;
}

.ranking-item:nth-child(odd) {
    background: #f8f9fa;
}

.ranking-info {
    display: flex;
    align-items: center;
}

.ranking-position {
    font-weight: bold;
    width: 30px;
    margin-right: 1rem;
}

.ranking-change {
    font-weight: bold;
}

.ranking-change.positive {
    color: #28a745;
}

.ranking-change.negative {
    color: #dc3545;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: modalopen 0.3s ease;
}

@keyframes modalopen {
    from {opacity: 0; transform: translateY(-50px);}
    to {opacity: 1; transform: translateY(0);}
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1a56a7 0%, #144785 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

/* 返回首页链接 */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #1a56a7 0%, #144785 100%);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.back-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(26, 86, 167, 0.3);
    color: white;
    text-decoration: none;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1a56a7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .section-header h2 {
        margin-bottom: 1rem;
        font-size: 1.25rem;
    }
    
    .share-card {
        padding: 0.875rem;
        min-height: 150px;
    }
    
    .modal-content {
        width: 90%;
        margin: 10% auto;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .form-group input {
        padding: 0.75rem;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .btn-primary {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .share-card {
        padding: 0.75rem;
        min-height: 140px;
    }
    
    .share-code {
        font-size: 0.85rem;
    }
    
    .share-name {
        font-size: 0.75rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
    }
    
    .page-header {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .section-card {
        padding: 15px;
        margin-bottom: 20px;
    }
}