/* 自定义样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border: none;
    border-radius: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.form-control-lg {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: border-color 0.3s ease;
}

.form-control-lg:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.btn-lg {
    border-radius: 10px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3) !important;
    border-color: #007bff !important;
    color: white !important;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #0056b3, #004085) !important;
    border-color: #0056b3 !important;
}

.btn-primary:disabled {
    background: #6c757d !important;
    border-color: #6c757d !important;
    opacity: 0.65 !important;
}

.step-icon {
    margin-bottom: 1rem;
}

.step-icon i {
    padding: 20px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 2px solid currentColor;
}

.display-4 {
    font-weight: 700;
    background: linear-gradient(45deg, #e91e63, #f44336);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lead {
    font-size: 1.25rem;
    font-weight: 300;
}

.result-image {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.result-image:hover {
    transform: scale(1.05);
}

.download-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    border-radius: 25px;
    padding: 10px 25px;
    font-weight: 600;
    color: white;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
}

.download-btn:hover {
    background: linear-gradient(45deg, #20c997, #17a2b8);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40,167,69,0.3);
    color: white;
    text-decoration: none;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

.alert {
    border-radius: 10px;
    border: none;
}

.bg-success {
    background: linear-gradient(45deg, #28a745, #20c997) !important;
}

.card-header {
    border-radius: 15px 15px 0 0 !important;
}

footer {
    margin-top: auto;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .step-icon i {
        font-size: 2rem !important;
        padding: 15px;
    }
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* 图片预览样式 */
.image-preview {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

.image-info {
    padding: 1rem;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.image-info h5 {
    margin-bottom: 1rem;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
}

.image-info p {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.image-info .download-btn {
    margin-top: auto;
    width: 100%;
    text-align: center;
    justify-self: flex-end;
}

.quality-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,123,255,0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* 加载动画 */
.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% {
        color: rgba(0,0,0,0);
        text-shadow:
            .25em 0 0 rgba(0,0,0,0),
            .5em 0 0 rgba(0,0,0,0);
    }
    40% {
        color: black;
        text-shadow:
            .25em 0 0 rgba(0,0,0,0),
            .5em 0 0 rgba(0,0,0,0);
    }
    60% {
        text-shadow:
            .25em 0 0 black,
            .5em 0 0 rgba(0,0,0,0);
    }
    80%, 100% {
        text-shadow:
            .25em 0 0 black,
            .5em 0 0 black;
    }
}

/* 示例链接样式 */
.example-link {
    border-radius: 25px;
    font-size: 0.9rem;
    padding: 8px 20px;
    transition: all 0.3s ease;
    border: 2px solid #17a2b8;
    background: rgba(255, 255, 255, 0.9);
    color: #17a2b8;
    font-weight: 500;
}

.example-link:hover {
    background: rgba(23, 162, 184, 0.1);
    border-color: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
    color: #138496;
}

.example-link:active {
    transform: translateY(0);
}

.example-link.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    border-color: #28a745;
    color: white;
    transform: scale(1.05);
}

/* 调整示例链接区域间距 */
.example-section {
    margin-top: 5px;
    margin-bottom: 15px;
}

.example-section hr {
    margin: 8px 0 10px 0;
    opacity: 0.3;
}

.example-section p {
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #6c757d;
}

/* 响应式设计 - 示例链接 */
@media (max-width: 576px) {
    .example-link {
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        display: block;
    }
}

/* PC端布局修复 */
@media (min-width: 992px) {
    .container {
        max-width: 1200px;
    }
    
    .display-4 {
        font-size: 3.5rem;
    }
    
    .lead {
        font-size: 1.5rem;
    }
    
    .card {
        margin-bottom: 2rem;
    }
    
    .input-group-lg .form-control {
        font-size: 1.1rem;
        padding: 0.75rem 1rem;
    }
    
    .input-group-lg .btn {
        font-size: 1.1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .step-icon i {
        font-size: 3rem !important;
        padding: 25px;
    }
    
    .image-preview {
        margin-bottom: 30px;
    }
    
    .image-info {
        padding: 20px;
    }
}

/* 超大屏幕优化 */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .display-4 {
        font-size: 4rem;
    }
    
    .card-body {
        padding: 2.5rem !important;
    }
}

/* 修复输入框组合样式 */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group > .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group > .btn {
    position: relative;
    z-index: 2;
}

/* 确保按钮不会换行 */
.input-group-lg > .btn {
    white-space: nowrap;
}

/* 修复卡片间距 */
.row.justify-content-center {
    margin-left: 0;
    margin-right: 0;
}

.row.justify-content-center > [class*="col-"] {
    padding-left: 15px;
    padding-right: 15px;
}

/* 修复容器布局 */
.container-fluid {
    padding-left: 0;
    padding-right: 0;
}

.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* 修复导航栏 */
.navbar {
    padding: 0.5rem 0;
}

.navbar .container {
    max-width: 1200px;
}

/* 修复标题区域 */
.display-4 {
    line-height: 1.2;
    margin-bottom: 1rem;
}

/* 修复输入框和按钮对齐 */
.input-group-lg {
    display: flex;
    align-items: stretch;
}

.input-group-lg .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: 0;
}

.input-group-lg .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: 1px solid #007bff;
}

/* 修复卡片布局 */
.card {
    width: 100%;
    margin-bottom: 1.5rem;
}

.card-body {
    flex: 1 1 auto;
    padding: 1.5rem;
}

/* 修复图标对齐 */
.step-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.d-flex {
    display: flex !important;
    align-items: flex-start;
}

.d-flex .fas {
    flex-shrink: 0;
}

/* 修复页脚 */
footer {
    margin-top: 3rem;
}

/* 确保文本不会溢出 */
.text-center {
    text-align: center !important;
}

.text-muted {
    color: #6c757d !important;
}

/* 修复按钮样式 */
.btn {
    display: inline-block;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border-radius: 0.375rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* 减少下载表单卡片的下边距 */
.card.shadow-lg {
    margin-bottom: 0;
}

/* 移动端优化 */
@media (max-width: 767.98px) {
    .image-info {
        margin-top: 1rem;
        padding: 1.5rem;
    }
    
    .image-preview {
        margin-bottom: 0;
    }
    
    .result-image {
        width: 100%;
        max-height: 400px;
        object-fit: cover;
    }
    
    .quality-badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
    
    /* 修复移动端布局错位 */
    .row.align-items-stretch {
        margin-left: 0;
        margin-right: 0;
    }
    
    .row.align-items-stretch > [class*="col-"] {
        padding-left: 15px;
        padding-right: 15px;
        margin-bottom: 1rem;
    }
}

/* 确保图片容器的对齐 */
@media (min-width: 768px) {
    .image-preview,
    .image-info {
        height: 100%;
        min-height: 400px;
    }
    
    .image-preview {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .result-image {
        max-height: 400px;
        width: auto;
        object-fit: contain;
    }
    
    /* 确保桌面端对齐 */
    .row.align-items-stretch {
        align-items: stretch !important;
    }
}

/* 确保桌面端对齐 */
.row.align-items-stretch {
    align-items: stretch !important;
}

/* 结果区域布局修复 */
#resultSection .card-body {
    padding: 1.5rem;
}

/* 修复动态生成的行布局 - 使用通用选择器 */
#resultSection .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
}

#resultSection .row > [class*="col-"] {
    padding-left: 15px !important;
    padding-right: 15px !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 确保图片和信息区域高度一致 - 修复选择器 */
#resultSection .image-preview {
    background: rgba(248, 249, 250, 0.5) !important;
    border-radius: 10px !important;
    padding: 1rem !important;
    min-height: 350px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative !important;
}

#resultSection .image-info {
    background: rgba(248, 249, 250, 0.8) !important;
    border-radius: 10px !important;
    padding: 1.5rem !important;
    min-height: 350px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

/* 图片样式优化 - 修复选择器 */
#resultSection .result-image {
    max-width: 100% !important;
    max-height: 300px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
}

/* 质量标签定位 - 修复选择器 */
#resultSection .quality-badge {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: rgba(0,123,255,0.9) !important;
    color: white !important;
    padding: 6px 12px !important;
    border-radius: 15px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    z-index: 10 !important;
}

/* 信息区域样式 - 修复选择器 */
#resultSection .image-info h5 {
    margin-bottom: 1rem !important;
    color: #495057 !important;
    border-bottom: 2px solid #dee2e6 !important;
    padding-bottom: 0.5rem !important;
    font-weight: 600 !important;
}

#resultSection .image-info p {
    margin-bottom: 0.5rem !important;
    line-height: 1.5 !important;
    color: #6c757d !important;
}

#resultSection .image-info strong {
    color: #495057 !important;
}

/* 下载按钮样式 - 修复选择器 */
#resultSection .download-btn {
    margin-top: auto !important;
    width: 100% !important;
    padding: 12px 20px !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

/* 移动端优化 - 修复选择器 */
@media (max-width: 767.98px) {
    #resultSection .row {
        flex-direction: column !important;
    }
    
    #resultSection .image-preview,
    #resultSection .image-info {
        min-height: auto !important;
        margin-bottom: 1rem !important;
    }
    
    #resultSection .image-preview {
        padding: 1rem !important;
        min-height: 250px !important;
    }
    
    #resultSection .image-info {
        padding: 1rem !important;
    }
    
    #resultSection .result-image {
        max-height: 200px !important;
    }
    
    #resultSection .quality-badge {
        top: 10px !important;
        right: 10px !important;
        font-size: 0.75rem !important;
        padding: 4px 8px !important;
    }
}

/* 桌面端确保等高 - 修复选择器 */
@media (min-width: 768px) {
    #resultSection .row.align-items-stretch {
        align-items: stretch !important;
    }
    
    #resultSection .row.align-items-stretch > [class*="col-"] {
        display: flex !important;
        flex-direction: column !important;
    }
    
    #resultSection .image-preview,
    #resultSection .image-info {
        flex: 1 !important;
        height: 100% !important;
    }
}