/* MB银行账单生成器主样式 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 内容布局 - 确保表单在左侧，预览在右侧 */
.content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    align-items: start; /* 确保顶部对齐 */
}

/* 表单内容区域 */
.form-content-section {
    grid-column: 1;
}

/* 预览区域 */
.preview-section {
    grid-column: 2;
}

/* 对于ACB银行，强制使用两列布局 */
#acbBankForm .content {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem !important;
    margin-bottom: 2rem !important;
}

#acbBankForm .form-content-section {
    grid-column: 1 !important;
}

#acbBankForm .preview-section {
    grid-column: 2 !important;
}

@media (max-width: 768px) {
    .content {
        grid-template-columns: 1fr;
    }
    
    .form-content-section,
    .preview-section {
        grid-column: 1;
    }
    
    /* 在手机上，ACB银行也使用单列布局 */
    #acbBankForm .content {
        grid-template-columns: 1fr !important;
    }
    
    #acbBankForm .form-content-section,
    #acbBankForm .preview-section {
        grid-column: 1 !important;
    }
}

/* 卡片 */
.card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f1f3f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: #667eea;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control::placeholder {
    color: #adb5bd;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23495057' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 2px solid transparent;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 8px;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    color: #fff;
    background-color: #667eea;
    border-color: #667eea;
}

.btn-primary:hover {
    background-color: #5a67d8;
    border-color: #5a67d8;
    transform: translateY(-1px);
}

.btn-success {
    color: #fff;
    background-color: #10b981;
    border-color: #10b981;
}

.btn-success:hover {
    background-color: #0da271;
    border-color: #0da271;
    transform: translateY(-1px);
}

.btn-block {
    display: block;
    width: 100%;
}

/* 预览区域 */
.preview-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    border: 2px dashed #dee2e6;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.preview-placeholder {
    color: #adb5bd;
}

.preview-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.preview-image {
    max-width: 100%;
    max-height: 400px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

/* 结果区域 */
.result-section {
    animation: fadeIn 0.5s ease;
    position: relative;
}

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

.result-image {
    max-width: 100%;
    max-height: 500px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* 确保预览区域在右侧 */
.preview-section {
    position: sticky;
    top: 20px;
    height: fit-content;
}

/* 为ACB银行特别优化 */
#acbBankForm .preview-section {
    position: sticky;
    top: 20px;
}

#acbBankForm .result-image {
    max-height: 500px;
    width: auto;
    max-width: 100%;
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* 警告消息 */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    animation: slideIn 0.3s ease;
}

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

/* 警告消息样式 */
.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* 工具类 */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }

/* 响应式调整 */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
}

/* 打印样式 */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .result-image {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}