/* 页面基础样式 */
.main-content {
    padding-top: 100px;
    padding-bottom: 60px;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 页面标题 */
.page-header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.page-header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.page-header .subtitle {
    font-size: 16px;
    opacity: 0.9;
}

/* 转换区域 */
.converter-section {
    margin-bottom: 30px;
}

.converter-card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.input-group,
.output-group {
    margin-bottom: 20px;
}

.input-group:last-child,
.output-group:last-child {
    margin-bottom: 0;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.input-header label {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-header label i {
    color: #667eea;
}

.input-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f7fa;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #666;
}

.btn-icon:hover {
    background: #667eea;
    color: white;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    resize: vertical;
    transition: border-color 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea[readonly] {
    background: #f8f9fa;
}

.input-stats {
    margin-top: 8px;
    font-size: 13px;
    color: #999;
    display: flex;
    justify-content: space-between;
}

.error-hint {
    color: #ff4757;
}

/* 控制面板 */
.control-panel {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.panel-header h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 i {
    color: #667eea;
}

.switch {
    position: relative;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #667eea;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

.switch-label {
    font-size: 14px;
    color: #666;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-item label {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-wrapper input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #e9ecef;
    border-radius: 3px;
    outline: none;
}

.range-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.range-wrapper span {
    min-width: 50px;
    text-align: right;
    font-size: 14px;
    font-weight: bold;
    color: #667eea;
}

.playback-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.btn-play,
.btn-control {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-play {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
}

.btn-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-control {
    background: #f5f7fa;
    color: #333;
}

.btn-control:hover {
    background: #667eea;
    color: white;
}

.export-controls {
    display: flex;
    gap: 10px;
}

.btn-export {
    flex: 1;
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: #667eea;
    color: white;
}

/* 灯光可视化面板 */
.visual-panel {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.light-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.light-bulb {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.1s ease;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.light-bulb.on {
    background: #ffd700;
    box-shadow: 0 0 60px #ffd700, 0 0 100px #ffa500;
}

.light-glow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.1s ease;
}

.light-bulb.on .light-glow {
    opacity: 1;
}

.light-status {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

.signal-display {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.current-char {
    font-size: 48px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.signal-indicator {
    font-size: 24px;
    color: #667eea;
    font-family: 'Courier New', monospace;
    margin-bottom: 15px;
    min-height: 30px;
}

.progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s linear;
}

/* 键盘敲击面板 */
.keyboard-panel {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.keyboard-panel .panel-header {
    flex-direction: column;
    align-items: flex-start;
}

.keyboard-panel .hint {
    font-size: 13px;
    color: #999;
    margin-top: 5px;
}

.key-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.key-btn {
    padding: 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.key-btn.dot {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.key-btn.dash {
    background: linear-gradient(135deg, #FF9800 0%, #f57c00 100%);
    color: white;
}

.key-btn.space {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
}

.key-btn.clear {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
}

.key-btn:active {
    transform: scale(0.95);
}

.key-label {
    font-size: 16px;
    font-weight: bold;
}

.key-symbol {
    font-size: 24px;
    font-family: 'Courier New', monospace;
}

.key-hint {
    font-size: 11px;
    opacity: 0.8;
}

.morse-input-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
}

.preview-label {
    font-size: 13px;
    color: #666;
    margin-right: 10px;
}

#morsePreviewText {
    font-size: 16px;
    color: #333;
}

/* 高级设置面板 */
.advanced-panel {
    background: white;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.advanced-panel .panel-header {
    padding: 20px 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.advanced-panel .panel-header:hover {
    background: #f8f9fa;
}

.advanced-panel .panel-header i:last-child {
    transition: transform 0.3s ease;
}

.advanced-panel .panel-header.active i:last-child {
    transform: rotate(180deg);
}

.advanced-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.advanced-content.show {
    max-height: 500px;
}

.advanced-content .settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    padding: 0 25px 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-size: 13px;
    color: #666;
}

.setting-item input {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
}

.setting-item input:focus {
    outline: none;
    border-color: #667eea;
}

.charset-selector {
    padding: 0 25px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.charset-selector label {
    font-size: 13px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.charset-selector select {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
}

.charset-selector select:focus {
    outline: none;
    border-color: #667eea;
}

/* 练习模式面板 */
.practice-panel {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.practice-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-practice {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-practice:hover {
    background: #667eea;
    color: white;
}

.practice-question {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.question-type {
    font-size: 13px;
    color: #667eea;
    margin-bottom: 10px;
}

.question-content {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    font-family: 'Courier New', monospace;
}

.practice-input {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.practice-input input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
}

.practice-input input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-check {
    padding: 12px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-check:hover {
    background: #764ba2;
}

.practice-result {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    display: none;
}

.practice-result.correct {
    display: block;
    background: #d4edda;
    color: #155724;
}

.practice-result.incorrect {
    display: block;
    background: #f8d7da;
    color: #721c24;
}

/* 历史记录面板 */
.history-panel {
    background: white;
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.btn-clear-history {
    padding: 8px 16px;
    border: none;
    background: #f5f7fa;
    color: #666;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-clear-history:hover {
    background: #ff4757;
    color: white;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-empty {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.3s ease;
}

.history-item:hover {
    background: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .history-plain {
    font-size: 14px;
    color: #333;
    margin-bottom: 5px;
}

.history-item .history-morse {
    font-size: 13px;
    color: #667eea;
    font-family: 'Courier New', monospace;
}

.history-item .history-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
}

/* 使用说明面板 */
.info-panel {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    margin-bottom: 20px;
}

.info-panel .panel-header {
    padding: 20px 25px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.info-panel .panel-header:hover {
    background: #f8f9fa;
}

.info-panel .panel-header i:last-child {
    transition: transform 0.3s ease;
}

.info-panel .panel-header.active i:last-child {
    transform: rotate(180deg);
}

.info-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.info-content.show {
    max-height: 1000px;
}

.info-section {
    padding: 0 25px 20px;
}

.info-section h4 {
    font-size: 15px;
    color: #333;
    margin-bottom: 10px;
}

.info-section ul {
    margin: 0;
    padding-left: 20px;
}

.info-section li {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
    line-height: 1.6;
}

/* 相关工具推荐样式 */
.related-tools {
    background: #f8f9fa;
    padding: 40px 0;
    margin-top: 60px;
}

.related-tools h3 {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.related-tool-item {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    text-decoration: none;
    color: #333;
    display: flex;
    flex-direction: column;
}

.related-tool-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    color: #2d8cf0;
}

.related-tool-item i {
    font-size: 28px;
    margin-bottom: 15px;
    color: #2d8cf0;
}

.related-tool-item span {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
}

.related-tool-item p {
    font-size: 14px;
    color: #666;
    flex-grow: 1;
}

/* Toast 通知 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #4CAF50;
}

.toast.error {
    background: #f44336;
}

/* 响应式样式 */
@media (max-width: 768px) {
    .main-content {
        padding-top: 80px;
    }
    
    .page-header h1 {
        font-size: 28px;
    }
    
    .converter-card {
        padding: 20px;
    }
    
    .key-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .playback-controls {
        flex-direction: column;
    }
    
    .btn-play,
    .btn-control {
        width: 100%;
        justify-content: center;
    }
    
    .export-controls {
        flex-direction: column;
    }
    
    .practice-controls {
        flex-direction: column;
    }
    
    .practice-input {
        flex-direction: column;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .related-tools-grid {
        grid-template-columns: 1fr;
    }
}