:root {
    --primary-color: #0052CC;
    --secondary-color: #6554C0;
    --success-color: #36B37E;
    --warning-color: #FFAB00;
    --danger-color: #DE350B;
    --neutral-100: #F7F8F9;
    --neutral-200: #E6E8EA;
    --neutral-300: #C1C7D0;
    --neutral-400: #A5ADBA;
    --neutral-500: #5E6C84;
    --neutral-600: #344563;
    --neutral-700: #253858;
    --neutral-800: #172B4D;
    --neutral-900: #091E42;
    
    /* Component colors */
    --subject-color: #0052CC;
    --predicate-color: #36B37E;
    --object-color: #6554C0;
    --modifier-color: #FFAB00;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Helvetica Neue', sans-serif;
    background-color: var(--neutral-100);
    color: var(--neutral-800);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    color: var(--neutral-900);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--neutral-600);
}

.language-selector {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--neutral-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.lang-btn:hover {
    background: var(--neutral-100);
    border-color: var(--primary-color);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Input Section */
.input-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--neutral-700);
}

textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--neutral-200);
    border-radius: 4px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.example-buttons {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.example-buttons p {
    color: var(--neutral-600);
    font-size: 0.875rem;
}

.example-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--neutral-300);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.example-btn:hover {
    background: var(--neutral-100);
    border-color: var(--primary-color);
}

.primary-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

.primary-btn:hover {
    background: #0747A6;
}

.primary-btn:active {
    transform: translateY(1px);
}

/* Diagram Section */
.diagram-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    min-height: 400px;
}

#diagram-container {
    border: 2px solid var(--neutral-200);
    border-radius: 4px;
    margin-bottom: 2rem;
    background: #fafbfc;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#sentence-diagram {
    width: 100%;
    height: 100%;
}

/* Legend */
.legend {
    display: none;
}

.legend.active {
    display: block;
}

.legend h3 {
    margin-bottom: 1rem;
    color: var(--neutral-700);
}

.legend-items {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid transparent;
}

.legend-color.subject {
    background: var(--subject-color);
}

.legend-color.predicate {
    background: var(--predicate-color);
}

.legend-color.object {
    background: var(--object-color);
}

.legend-color.modifier {
    background: var(--modifier-color);
}

/* Details Section */
.details-section {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none;
}

.details-section.active {
    display: block;
}

.details-section h3 {
    margin-bottom: 1rem;
    color: var(--neutral-700);
}

#analysis-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-item {
    padding: 1rem;
    background: var(--neutral-100);
    border-radius: 4px;
    border-left: 4px solid var(--neutral-300);
}

.detail-item.subject {
    border-left-color: var(--subject-color);
}

.detail-item.predicate {
    border-left-color: var(--predicate-color);
}

.detail-item.object {
    border-left-color: var(--object-color);
}

.detail-item.modifier {
    border-left-color: var(--modifier-color);
}

.detail-item h4 {
    margin-bottom: 0.25rem;
    color: var(--neutral-700);
}

.detail-item p {
    color: var(--neutral-600);
    font-size: 0.875rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--neutral-200);
    color: var(--neutral-600);
    font-size: 0.875rem;
}

/* SVG Styles */
.diagram-line {
    stroke: var(--neutral-400);
    stroke-width: 2;
    fill: none;
}

.diagram-text {
    font-size: 14px;
    text-anchor: middle;
}

.diagram-word {
    font-size: 16px;
    font-weight: 500;
}

.word-box {
    fill: white;
    stroke: var(--neutral-300);
    stroke-width: 2;
    rx: 4;
}

.word-box.subject {
    fill: var(--subject-color);
}

.word-box.predicate {
    fill: var(--predicate-color);
}

.word-box.object {
    fill: var(--object-color);
}

.word-box.modifier {
    fill: var(--modifier-color);
}

.word-text {
    fill: white;
}

.label-text {
    fill: var(--neutral-600);
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .language-selector {
        position: static;
        justify-content: center;
        margin-top: 1rem;
    }
    
    .input-section,
    .diagram-section,
    .details-section {
        padding: 1rem;
    }
    
    .legend-items {
        gap: 1rem;
    }
    
    .example-buttons {
        flex-direction: column;
        align-items: flex-start;
    }
}