/**
 * 识图分析页面样式
 */

/* ==================== 上传区域 ==================== */
.upload-area {
    border: 2px dashed #ced4da;
    border-radius: 0.5rem;
    padding: 3rem 2rem;
    text-align: center;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: #007bff;
    background-color: #e7f3ff;
}

.upload-area.drag-over {
    border-color: #007bff;
    background-color: #cfe2ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    color: #6c757d;
    margin-bottom: 1rem;
}

.upload-hint {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ==================== 图片预览 ==================== */
#image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview-item {
    position: relative;
    border-radius: 0.375rem;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    background-color: #fff;
    aspect-ratio: 1;
}

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

.image-remove-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.image-remove-btn:hover,
.image-remove-btn:active {
    background-color: #dc3545;
    transform: scale(1.1);
}

/* 移动端触摸优化 */
@media (max-width: 1023px) {
    .image-remove-btn {
        width: 32px;
        height: 32px;
        font-size: 1.5rem;
        /* 增大触摸区域 */
        padding: 4px;
    }
    
    .upload-area {
        min-height: 150px;
        padding: 2rem 1rem;
    }
    
    /* 确保按钮在移动端可点击 */
    button, .btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
}

/* ==================== 表单区域 ==================== */
.analysis-form {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==================== 结果区域 ==================== */
#analysis-result {
    display: none;
    margin-top: 2rem;
}

/* 交易信号卡片特殊样式 */
.card.signal-buy {
    border-left: 4px solid #28a745;
    background: linear-gradient(to right, rgba(40, 167, 69, 0.05), #fff);
}

.card.signal-sell {
    border-left: 4px solid #dc3545;
    background: linear-gradient(to right, rgba(220, 53, 69, 0.05), #fff);
}

.card.signal-hold {
    border-left: 4px solid #ffc107;
    background: linear-gradient(to right, rgba(255, 193, 7, 0.05), #fff);
}

/* 风险等级徽章 */
.badge-risk-high {
    background-color: #dc3545;
    color: #fff;
}

.badge-risk-medium {
    background-color: #ffc107;
    color: #212529;
}

.badge-risk-low {
    background-color: #28a745;
    color: #fff;
}

/* 列表样式 */
.risk-factors,
.key-points {
    list-style: none;
    padding-left: 0;
    margin-top: 0.5rem;
}

.risk-factors li,
.key-points li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.risk-factors li:last-child,
.key-points li:last-child {
    border-bottom: none;
}

.risk-factors li::before {
    content: '⚠️';
    position: absolute;
    left: 0;
}

.key-points li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #007bff;
    font-weight: bold;
}

/* 表格样式 */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.table thead {
    background-color: #f8f9fa;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    font-weight: 600;
    color: #333;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* ==================== 响应式布局 ==================== */
/* 桌面端：双列布局 */
@media (min-width: 1024px) {
    .analysis-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .analysis-form {
        position: sticky;
        top: 80px;
        height: fit-content;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    #analysis-result {
        grid-column: 1 / -1;
    }
}

/* 移动端：单列布局 */
@media (max-width: 1023px) {
    .analysis-layout {
        display: flex;
        flex-direction: column;
    }

    .analysis-form {
        margin-bottom: 2rem;
    }

    /* 移动端按钮固定在底部 */
    .submit-btn-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: #fff;
        padding: 1rem;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 100;
        border-top: 1px solid #e0e0e0;
    }

    /* 为底部按钮留出空间 */
    main.container {
        padding-bottom: 90px !important;
    }
}

/* ==================== 徽章样式 ==================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge-success {
    background-color: #28a745;
    color: #fff;
}

.badge-warning {
    background-color: #ffc107;
    color: #212529;
}

.badge-secondary {
    background-color: #6c757d;
    color: #fff;
}

/* ==================== 加载状态 ==================== */
.uploading {
    opacity: 0.6;
    pointer-events: none;
}

/* ==================== 分隔线 ==================== */
.border-top {
    border-top: 1px solid #e0e0e0;
}

/* ==================== 提示框样式 ==================== */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* ==================== Grid布局兼容 ==================== */
.grid {
    display: grid;
}

.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gap-3 {
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    
    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

