/* ============================================
   CSS 三角形生成器 - 专用样式
   ============================================ */

/* ===== 主容器布局 ===== */
.triangle-generator-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    margin-bottom: 30px;
}

/* ===== 控制面板样式 ===== */
.control-panel {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 14px;
}

.control-group label i {
    color: #4a90e2;
    font-size: 16px;
}

/* ===== 方向选择器 ===== */
.direction-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.direction-btn {
    padding: 12px;
    border: 2px solid #dee2e6;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
    color: #495057;
}

.direction-btn:hover {
    border-color: #4a90e2;
    background: #f0f7ff;
    transform: translateY(-2px);
}

.direction-btn.active {
    border-color: #4a90e2;
    background: #4a90e2;
    color: white;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

.direction-btn i {
    font-size: 18px;
}

/* ===== 滑块控件 ===== */
.slider-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.slider-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    -webkit-appearance: none;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #357abd;
    transform: scale(1.2);
}

.slider-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.slider-control input[type="range"]::-moz-range-thumb:hover {
    background: #357abd;
    transform: scale(1.2);
}

.slider-control .value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: #4a90e2;
    font-size: 14px;
}

/* ===== 颜色控件 ===== */
.color-control {
    display: flex;
    gap: 10px;
}

.color-control input[type="color"] {
    width: 60px;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-control input[type="color"]:hover {
    border-color: #4a90e2;
    transform: scale(1.05);
}

.color-control input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    font-size: 14px;
    transition: all 0.3s ease;
}

.color-control input[type="text"]:focus {
    outline: none;
    border-color: #4a90e2;
    background: #f0f7ff;
}

/* ===== 重置按钮 ===== */
.btn-reset {
    width: 100%;
    padding: 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-reset:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.btn-reset:active {
    transform: translateY(0);
}

/* ===== 预览和代码区 ===== */
.preview-code-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== 预览容器 ===== */
.preview-container {
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.preview-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 16px;
}

.preview-label i {
    color: #4a90e2;
}

/* 预览舞台（棋盘背景） */
.preview-stage {
    min-height: 250px;
    background:
        linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
        linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
        linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e9ecef;
}

.preview-stage .triangle {
    transition: all 0.3s ease;
}

.preview-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
    color: #6c757d;
    font-size: 14px;
}

.preview-info strong {
    color: #4a90e2;
    font-weight: 600;
}

/* ===== 代码容器 ===== */
.code-container {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e9ecef;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #2c3e50;
    color: white;
}

.code-header span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.code-header i {
    font-size: 16px;
}

.btn-copy {
    padding: 8px 16px;
    background: #4a90e2;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: #357abd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.4);
}

.btn-copy:disabled {
    background: #28a745;
    cursor: not-allowed;
    transform: none;
}

.code-container pre {
    margin: 0;
    padding: 20px;
    background: #282c34;
    overflow-x: auto;
    max-height: 400px;
}

.code-container pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-container pre::-webkit-scrollbar-track {
    background: #1e2127;
}

.code-container pre::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 4px;
}

.code-container code {
    color: #abb2bf;
    font-family: 'Courier New', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1024px) {
    .triangle-generator-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .control-panel {
        padding: 20px;
    }

    .control-group {
        margin-bottom: 18px;
    }

    .direction-selector {
        gap: 8px;
    }

    .direction-btn {
        padding: 10px;
        font-size: 13px;
    }

    .preview-container {
        padding: 20px;
    }

    .preview-stage {
        min-height: 200px;
    }

    .preview-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .code-container pre {
        padding: 15px;
        max-height: 300px;
    }

    .code-container code {
        font-size: 12px;
    }

    .code-header {
        padding: 12px 15px;
    }

    .btn-copy {
        font-size: 12px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .control-panel {
        padding: 15px;
    }

    .control-group label {
        font-size: 13px;
    }

    .direction-btn {
        padding: 8px;
        font-size: 12px;
    }

    .slider-control .value {
        min-width: 50px;
        font-size: 13px;
    }

    .color-control input[type="color"] {
        width: 50px;
        height: 36px;
    }

    .color-control input[type="text"] {
        font-size: 12px;
    }

    .btn-reset {
        font-size: 14px;
        padding: 10px;
    }

    .preview-label {
        font-size: 14px;
    }

    .preview-stage {
        min-height: 180px;
    }

    .code-container pre {
        padding: 12px;
        font-size: 11px;
    }
}
