* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

html, body {
    height: 100%;
    overflow-x: hidden;
    background: linear-gradient(135deg, #f0f5ff 0%, #e6f0ff 100%);
}

body {
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
    width: 100%;
}

header {
    text-align: center;
    padding: 15px 0;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: white;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.header-content {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 20%, rgba(255,255,255,0.15) 0%, transparent 20%),
                radial-gradient(circle at 90% 80%, rgba(255,255,255,0.15) 0%, transparent 20%);
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.92;
    max-width: 800px;
    margin: 0 auto;
    font-weight: 300;
    margin-bottom: 15px;
}

.header-nav {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 10px 15px;
    margin-top: 10px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
}

.nav-list {
    display: flex;
    justify-content: center;
    list-style: none;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    gap: 8px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.nav-link i {
    font-size: 16px;
}

.app-container {
    display: flex;
    flex: 1;
    gap: 15px;
    width: 100%;
    padding: 15px;
    height: calc(100vh - 150px);
    overflow-y: auto;
    flex-wrap: wrap;
}

.input-panel {
    flex: 4;
    min-width: 400px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-panel {
    flex: 6;
    min-width: 600px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #1a73e8;
    display: flex;
    align-items: center;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid #eef5ff;
}

.panel-title i {
    margin-right: 10px;
    font-size: 1.3rem;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.data-input {
    width: 100%;
    height: 150px;
    background: #f8f9fa;
    border: 1px solid #d1e0ff;
    border-radius: 10px;
    padding: 12px;
    color: #333;
    font-family: monospace;
    margin-bottom: 15px;
    resize: vertical;
    font-size: 14px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.data-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.25), inset 0 2px 5px rgba(0,0,0,0.05);
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.control-group {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.control-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: #444;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.control-label i {
    margin-right: 8px;
    color: #1a73e8;
    font-size: 14px;
}

select, input[type="text"] {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1e0ff;
    background: white;
    color: #333;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

select:focus, input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.25);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    background: #f0f5ff;
    border-radius: 6px;
}

.checkbox-item input {
    width: auto;
    margin-right: 6px;
}

.checkbox-item label {
    font-size: 14px;
    color: #555;
    white-space: nowrap;
}

button {
    padding: 12px 15px;
    border-radius: 8px;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
}

.btn-secondary {
    background: linear-gradient(135deg, #34a853, #0f9d58);
}

.btn-warning {
    background: linear-gradient(135deg, #f9ab00, #e37400);
}

.btn-info {
    background: linear-gradient(135deg, #00bcd4, #0097a7);
}

.chart-area {
    background: #f8f9fa;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    border: 1px solid #e0e0e0;
    position: relative;
}

.chart-container {
    width: 100%;
    height: 0;
    padding-bottom: 53%; /* 16:9 Aspect Ratio */
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
}

.chart-svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-placeholder {
    text-align: center;
    color: #777;
    padding: 40px;
}

.chart-placeholder i {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: block;
    color: #e0e0e0;
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

footer {
    text-align: center;
    padding: 15px;
    color: #777;
    font-size: 14px;
    flex-shrink: 0;
}

.tooltip {
    position: absolute;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: 8px;
    pointer-events: none;
    font-size: 13px;
    z-index: 100;
    max-width: 260px;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.color-schemes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.color-scheme {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.color-scheme.active {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.35);
}

.compact-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.option-group {
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

input[type="range"] {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.range-value {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.legend-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background: white;
    border-radius: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 6px;
}

.legend-label {
    font-size: 12px;
    color: #555;
}

.error-message {
    color: #c62828;
    font-size: 13px;
    margin-top: 8px;
    display: none;
    padding: 8px;
    background: #ffebee;
    border-radius: 6px;
    border: 1px solid #ffcdd2;
}

.success-message {
    color: #2e7d32;
    font-size: 13px;
    margin-top: 8px;
    display: none;
    padding: 8px;
    background: #e8f5e9;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.data-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.parsed-data-container {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
}

.parsed-table {
    width: 100%;
    border-collapse: collapse;
    font-family: monospace;
    font-size: 12px;
}

.parsed-table th, .parsed-table td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: center;
}

.parsed-table th {
    background-color: #e4edf5;
    font-weight: bold;
}

.parsed-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.row-selection-info {
    margin-top: 12px;
    padding: 8px;
    background: #eef5ff;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    color: #1a73e8;
}

.compact-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 12px;
}

.compact-control {
    flex: 0;
    min-width: 140px;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.compact-control label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

.display-options-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.display-option {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    background: #f0f5ff;
    border-radius: 6px;
}

.display-option label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

.chart-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.legend-position-container {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
}

.legend-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.legend-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.horizontal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.legend-position-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chart-type-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.chart-type-item {
    padding: 8px 12px;
    border-radius: 6px;
    background: #f0f5ff;
    cursor: pointer;
    font-size: 13px;
    border: 1px solid #d1e0ff;
}

.chart-type-item.active {
    background: #1a73e8;
    color: white;
    border-color: #0d47a1;
}

.table-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.table-action-btn {
    flex: 1;
    padding: 8px;
    font-size: 13px;
}

.generate-section {
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.generate-export-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.generate-btn-container {
    min-width: 200px;
}

.export-btn-container {
    flex: 1;
    display: flex;
    gap: 10px;
}

.title-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.title-control {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 140px;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.bar-chart-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
}

.bar-control {
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.bar-control label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

.y-axis-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.y-axis-input {
    width: 80px;
    padding: 6px;
    border-radius: 5px;
    border: 1px solid #d1e0ff;
}

.border-style-controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.border-style {
    padding: 6px 10px;
    background: #eef5ff;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid #d1e0ff;
}

.border-style.active {
    background: #1a73e8;
    color: white;
    border-color: #0d47a1;
}

.aspect-ratio-info {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: #eef5ff;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 13px;
    color: #1a73e8;
    gap: 5px;
}

.color-scheme-preview {
    margin-top: 12px;
    height: 30px;
    border-radius: 6px;
    background: linear-gradient(135deg, #1a73e8, #34a853, #f9ab00, #d93025, #9334e6, #00bcd4);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.scheme-name {
    text-align: center;
    font-size: 12px;
    margin-top: 6px;
    color: #666;
}

.row-selector, .column-selector {
    width: 18px;
    height: 18px;
    transform: scale(1.3);
    margin: 5px;
}

.bottom-controls {
    margin-top: auto;
    padding-top: 20px;
}

.legend-position-container {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
}

.legend-position-label {
    font-size: 13px;
    color: #555;
    font-weight: 600;
    margin-bottom: 6px;
}

.legend-position-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.legend-position-option {
    padding: 6px 10px;
    background: #f0f5ff;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid #d1e0ff;
    font-size: 13px;
}

.legend-position-option.active {
    background: #1a73e8;
    color: white;
    border-color: #0d47a1;
}

.legend-group {
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.gradient-direction-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.gradient-direction {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid #d1e0ff;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.gradient-direction.active {
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.5);
}

.gradient-direction i {
    font-size: 16px;
    color: #555;
}

.legend-position-sliders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.legend-slider {
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.legend-slider label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 600;
}

.column-index, .row-index {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: #1a73e8;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 12px;
    margin-right: 5px;
}

@media (max-width: 1200px) {
    .app-container {
        flex-direction: column;
        height: auto;
    }
    
    .input-panel, .preview-panel {
        flex: 1;
        width: 100%;
        min-height: 300px;
        min-width: unset;
    }
    
    .legend-position-options {
        flex-direction: column;
        gap: 5px;
    }
    
    .data-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    header {
        padding: 15px 0;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .app-container {
        padding: 10px;
        height: auto;
    }
    
    .compact-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .display-options-container {
        flex-direction: column;
    }
    
    .chart-controls {
        grid-template-columns: 1fr;
    }
    
    .option-group {
        width: 100%;
    }
    
    .table-actions {
        flex-direction: column;
    }
    
    .generate-export-container {
        flex-direction: column;
    }
    
    .input-panel, .preview-panel {
        padding: 15px;
    }
    
    .title-controls {
        flex-direction: column;
    }
    
    .bar-chart-controls {
        flex-direction: column;
    }
}

@media (max-width: 500px) {
    .input-panel, .preview-panel {
        min-width: 100%;
        padding: 12px;
    }
    
    .panel-title {
        font-size: 1.1rem;
    }
    
    .data-input {
        height: 100px;
    }
    
    .color-schemes {
        gap: 6px;
    }
    
    .color-scheme {
        width: 24px;
        height: 24px;
    }
}