/* 饼图专属样式 */
.pie-builder {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

header h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.back-btn {
    background: var(--light-gray);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    color: var(--dark-gray);
    transition: background 0.3s;
}

.back-btn:hover {
    background: #e0e0e0;
}

.builder-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
}

.config-panel {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 1rem;
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.form-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--dark-gray);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.style-options {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.style-option {
    flex: 1;
    cursor: pointer;
}

.style-option input {
    display: none;
}

.style-option input:checked + .option-content {
    border-color: var(--primary-color);
}

.option-content {
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: border-color 0.3s;
}

.pie-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.pie-preview.solid {
    background: conic-gradient(
            #4285f4 0% 30%,
            #34a853 30% 60%,
            #fbbc05 60% 90%,
            #ea4335 90% 100%
    );
}

.pie-preview.doughnut {
    background: conic-gradient(
            #4285f4 0% 30%,
            #34a853 30% 60%,
            #fbbc05 60% 90%,
            #ea4335 90% 100%
    );
    -webkit-mask: radial-gradient(circle, transparent 50%, black 51%);
    mask: radial-gradient(circle, transparent 50%, black 51%);
}

.data-table-container {
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.data-table th {
    text-align: left;
    padding: 0.7rem;
    background: #f0f0f0;
    font-weight: 500;
}

.data-table td {
    padding: 0.7rem;
    border-bottom: 1px solid #eee;
}

.data-row input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.remove-data-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.remove-data-btn:hover {
    color: var(--accent-color);
}

.add-data-btn {
    width: 100%;
    padding: 0.7rem;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.add-data-btn:hover {
    background: #2d9249;
}

.generate-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 1rem;
}

.generate-btn:hover {
    background: #3367d6;
}

.chart-container {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 1rem;
}

.chart-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.chart-actions button {
    flex: 1;
    padding: 0.7rem;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s;
}

#download-pie-btn {
    background: var(--secondary-color);
    color: white;
}

#download-pie-btn:hover {
    background: #2d9249;
}

#reset-pie-btn {
    background: var(--light-gray);
    color: var(--dark-gray);
}

#reset-pie-btn:hover {
    background: #e0e0e0;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .builder-container {
        grid-template-columns: 1fr;
    }

    .config-panel {
        position: static;
    }

    .chart-container {
        position: static;
    }
}

@media (max-width: 480px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .style-options {
        flex-direction: column;
    }

    .form-section h2 {
        font-size: 1.1rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }
}

/* 颜色选择器专用样式 */
.data-color {
    -webkit-appearance: none; /* 清除默认样式 */
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 34px;
    padding: 0 !important;
    background: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
}

/* 颜色选择器按钮样式 */
.data-color::-webkit-color-swatch {
    border-radius: 3px;
    border: none;
}

.data-color::-moz-color-swatch {
    border-radius: 3px;
    border: none;
}