* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-group {
    display: flex;
    gap: 4px;
}

.toolbar-btn {
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #333;
}

.toolbar-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.toolbar-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.separator {
    color: #d0d0d0;
}

/* Editor Wrapper */
.editor-wrapper {
    padding: 40px 20px;
    background: #f5f5f5;
    min-height: calc(100vh - 140px);
    display: flex;
    justify-content: center;
}

.page {
    width: 100%;
    max-width: 700px;
    min-height: 800px;
    background: white;
    padding: 60px 70px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* Editor */
.editor {
    font-family: 'Merriweather', Georgia, serif;
    font-size: 16px;
    line-height: 1.8;
    color: #1a1a1a;
    outline: none;
    min-height: 680px;
    position: relative;
}

.editor:empty:before {
    content: attr(placeholder);
    color: #aaa;
    pointer-events: none;
    position: absolute;
}

/* Spelling and Grammar Errors */
.spelling-error {
    border-bottom: 2px solid #ff4444;
    border-bottom-style: wavy;
    cursor: pointer;
    background: rgba(255, 68, 68, 0.05);
}

.grammar-error {
    border-bottom: 2px solid #4488ff;
    border-bottom-style: wavy;
    cursor: pointer;
    background: rgba(68, 136, 255, 0.05);
}

/* Suggestion Dropdown */
.suggestion-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 180px;
    max-width: 250px;
    display: none;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion-dropdown.active {
    display: block;
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    color: #333;
}

.suggestion-item:hover {
    background: #f0f0f0;
}

.suggestion-item.selected {
    background: #667eea;
    color: white;
}

.suggestion-header {
    padding: 8px 16px;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 4px;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    background: white;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    min-width: 150px;
    max-width: 200px;
    display: none;
    z-index: 1000;
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.autocomplete-item:hover {
    background: #f0f0f0;
}

.autocomplete-item.selected {
    background: #667eea;
    color: white;
}

.autocomplete-key {
    font-size: 11px;
    color: #999;
    margin-left: auto;
    font-family: monospace;
}

.autocomplete-item.selected .autocomplete-key {
    color: rgba(255, 255, 255, 0.8);
}

/* Scrollbar Styling */
.suggestion-dropdown::-webkit-scrollbar,
.autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.suggestion-dropdown::-webkit-scrollbar-track,
.autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.suggestion-dropdown::-webkit-scrollbar-thumb,
.autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.suggestion-dropdown::-webkit-scrollbar-thumb:hover,
.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        box-shadow: none;
    }

    .toolbar {
        padding: 10px 15px;
    }

    .editor-wrapper {
        padding: 20px 15px;
        min-height: calc(100vh - 120px);
    }

    .page {
        padding: 30px 25px;
        min-height: auto;
        box-shadow: none;
    }

    .editor {
        font-size: 15px;
        min-height: 500px;
    }

    .toolbar-stats {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .page {
        padding: 20px 15px;
    }

    .editor {
        font-size: 14px;
    }

    .toolbar-btn {
        padding: 6px 10px;
    }

    .toolbar-btn svg {
        width: 14px;
        height: 14px;
    }

    .suggestion-dropdown,
    .autocomplete-dropdown {
        min-width: 140px;
        max-width: 200px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .toolbar,
    .suggestion-dropdown,
    .autocomplete-dropdown {
        display: none !important;
    }

    .container {
        box-shadow: none;
    }

    .editor-wrapper {
        background: white;
        padding: 0;
    }

    .page {
        box-shadow: none;
        padding: 40px;
    }
}