* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

.app-container {
    display: grid;
    grid-template-areas: 
        "header header"
        "main sidebar";
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr 300px;
    height: 100vh;
    gap: 1rem;
    padding: 1rem;
}

.app-header {
    grid-area: header;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
}

.upload-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-name {
    color: #64748b;
    font-size: 0.875rem;
}

.reading-area {
    grid-area: main;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.text-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.progress-info {
    display: flex;
    gap: 2rem;
    font-size: 0.875rem;
    color: #64748b;
}

.legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
}

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

.sentence-display {
    flex: 1;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-sentence {
    font-size: 1.25rem;
    line-height: 1.8;
    max-width: 800px;
    margin: 0;
    text-align: center;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 2rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.paragraph-review {
    padding: 2rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.paragraph-review h3 {
    margin-top: 0;
    color: #0f172a;
}

.paragraph-text {
    font-size: 1.125rem;
    line-height: 1.7;
    margin: 1rem 0;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.word-panel {
    grid-area: sidebar;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
}

.word-info h3 {
    margin-top: 0;
    color: #0f172a;
    font-size: 1.125rem;
}

.word-info p {
    color: #64748b;
    margin: 0;
}

/* Button styles */
.btn {
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
}

.btn-accent {
    background: #10b981;
    color: white;
}

.btn-accent:hover:not(:disabled) {
    background: #059669;
}

/* Part of speech colors */
.pos-noun {
    color: #dc2626;
    background-color: #fee2e2;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.pos-verb {
    color: #2563eb;
    background-color: #dbeafe;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.pos-adjective {
    color: #7c3aed;
    background-color: #ede9fe;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.pos-adverb {
    color: #ea580c;
    background-color: #fed7aa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.pos-other {
    color: #64748b;
    background-color: #f1f5f9;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

/* Legend colors (solid squares) */
.legend .pos-noun::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #dc2626;
    margin-right: 0.25rem;
}

.legend .pos-verb::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #2563eb;
    margin-right: 0.25rem;
}

.legend .pos-adjective::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #7c3aed;
    margin-right: 0.25rem;
}

.legend .pos-adverb::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #ea580c;
    margin-right: 0.25rem;
}

.legend .pos-other::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background-color: #64748b;
    margin-right: 0.25rem;
}

/* Word hover effects */
.word:hover {
    transform: scale(1.05);
    transition: transform 0.1s;
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        grid-template-areas: 
            "header"
            "main"
            "sidebar";
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    
    .word-panel {
        max-height: 200px;
        overflow-y: auto;
    }
    
    .text-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .progress-info {
        justify-content: center;
    }
}