/* 复古火车票生成器样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #ffffff;
    color: #2c3e50;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1400px;
    padding: 40px 20px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content {
    flex: 1;
    padding-bottom: 60px;
    animation: fadeIn 0.6s ease;
}

.back-link {
    margin-bottom: 30px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    color: #666;
    text-decoration: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    color: #2c3e50;
    border-color: #2c3e50;
    transform: translateX(-3px);
}

.ticket-section {
    animation: fadeInUp 0.6s ease 0.1s both;
}

.page-title {
    font-size: 42px;
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 15px;
    color: #1a1a1a;
}

.page-subtitle {
    font-size: 16px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 300;
}

.disclaimer {
    font-size: 13px;
    color: #b23a3a;
    background: #fdf1f1;
    border: 1px solid #f2d5d5;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 30px;
}

/* 编辑器容器 - 左右布局 */
.editor-container {
    display: flex;
    gap: 30px;
    margin-top: 10px;
}

.left-panel {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.right-panel {
    flex: 1;
    min-width: 0;
}

.settings-section {
    max-height: 720px;
    overflow-y: auto;
    padding: 25px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.settings-section::-webkit-scrollbar {
    width: 8px;
}

.settings-section::-webkit-scrollbar-track {
    background: #eef1f3;
    border-radius: 4px;
}

.settings-section::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.settings-section::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

.section-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 20px;
    color: #2c3e50;
}

.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-row {
    display: grid;
    gap: 12px;
}

.station-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.station-field {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

.train-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.date-row {
    grid-template-columns: 0.85fr 0.7fr 0.7fr;
}

.time-row {
    grid-template-columns: minmax(0, 1fr);
}

.travel-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.seat-row.berth-hidden {
    grid-template-columns: minmax(0, 1fr);
}

.setting-row .setting-item {
    min-width: 0;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.text-box-toggle {
    align-self: flex-start;
    padding: 8px 14px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #ffffff;
    color: #2c3e50;
    font-size: 14px;
    cursor: pointer;
}

.setting-item span {
    font-size: 14px;
    font-weight: 400;
    color: #495057;
}

.setting-item select,
.setting-item input[type="text"],
.setting-item input[type="number"],
.setting-item input[type="date"],
.setting-item input[type="time"],
.setting-item textarea {
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
}

.setting-item textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.5;
}

.setting-item select:focus,
.setting-item input:focus {
    outline: none;
    border-color: #2c3e50;
}

.checkbox-item {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* 预览区域 */
.preview-section {
    display: flex;
    flex-direction: column;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f9fa;
    padding: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: auto;
    margin-bottom: 20px;
    min-height: 200px;
    max-height: 640px;
}

#ticket-canvas {
    max-width: 100%;
    max-height: 600px;
    height: auto;
    width: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    display: block;
}

/* 按钮 */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.btn-primary:hover {
    background: #1a252f;
    border-color: #1a252f;
}

.btn-secondary {
    background: white;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #f8f9fa;
}

@media (prefers-color-scheme: dark) {
body {
    background: #171a1f;
    color: #e6e9ed;
}

body .back-btn {
    color: #b8c0ca;
    border-color: #3a424c;
}

body .back-btn:hover {
    color: #ffffff;
    border-color: #8d99a8;
}

body .page-title {
    color: #f3f5f7;
}

body .page-subtitle,
body .section-title,
body .setting-item span {
    color: #c1c9d2;
}

body .disclaimer {
    color: #ffb4b4;
    background: #3a2428;
    border-color: #684047;
}

body .settings-section,
body .canvas-container {
    background: #22272e;
    border-color: #3a424c;
}

body .setting-item select,
body .setting-item input,
body .setting-item textarea,
body .text-box-toggle,
body .btn-secondary {
    background: #171a1f;
    color: #e6e9ed;
    border-color: #4b5563;
}

body .setting-item select:focus,
body .setting-item input:focus,
body .setting-item textarea:focus {
    border-color: #8db7e8;
}

body .text-box-toggle:hover,
body .btn-secondary:hover {
    background: #2d343d;
}

body .btn-primary {
    background: #4c78a8;
    border-color: #4c78a8;
}

body .btn-primary:hover {
    background: #6392c5;
    border-color: #6392c5;
}

body .settings-section::-webkit-scrollbar-track {
    background: #2d343d;
}

body .settings-section::-webkit-scrollbar-thumb {
    background: #687585;
}

body .footer {
    color: #8994a2;
    border-color: #343c46;
}

}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: #adb5bd;
    font-size: 13px;
    margin-top: 60px;
    border-top: 1px solid #e9ecef;
}

.footer a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #2c3e50;
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .editor-container {
        flex-direction: column;
    }

    .left-panel {
        flex: none;
        width: 100%;
    }

    .right-panel {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 24px;
    }

    .setting-item input,
    .setting-item select,
    .setting-item textarea {
        font-size: 16px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .station-row,
    .date-row,
    .travel-row,
    .seat-row {
        grid-template-columns: 1fr;
    }

    .time-row .setting-item input[type="time"] {
        width: calc(100% - 16px);
        min-width: 0;
        max-width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }

    .canvas-container {
        min-height: 0;
        max-height: 360px;
        padding: 10px;
    }

    #ticket-canvas {
        width: 100%;
        max-width: 340px;
        height: auto !important;
        max-height: none;
    }
}
