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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.textbox-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
    align-items: stretch;
}

.textbox-section {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.textbox-section label {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #4a5568;
    font-size: 1.1rem;
}

.rich-editor {
    width: 100%;
    min-height: 300px;
    max-height: 500px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.6;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
    overflow-y: auto;
    white-space: pre-wrap;
}

.rich-editor:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.rich-editor:empty:before {
    content: attr(data-placeholder);
    color: #a0aec0;
    pointer-events: none;
}

.rich-editor.readonly {
    background: #f7fafc;
    cursor: default;
}

.rich-editor h1 {
    font-size: 2rem;
    font-weight: bold;
    margin: 1rem 0;
    color: #2d3748;
}

.rich-editor h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.8rem 0;
    color: #2d3748;
}

.rich-editor p {
    margin: 0.5rem 0;
}

.rich-editor strong {
    font-weight: bold;
}

.rich-editor em {
    font-style: italic;
}

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.editor-toolbar button {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    transition: all 0.2s ease;
}

.editor-toolbar button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.editor-toolbar button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #d1d5db;
    margin: 0 0.25rem;
}

.summary-section {
    background: linear-gradient(135deg, #e0f2fe 0%, #f3e5f5 100%);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.summary-content h3 {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.summary-content {
    color: #2d3748;
}

.summary-stat {
    background: rgba(255, 255, 255, 0.7);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    min-width: 160px;
    text-align: center;
}

.summary-stat strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: #4a5568;
}

/* Rich text editor enhancements */
.rich-editor ul, .rich-editor ol {
    margin: 1rem 0;
    padding-left: 0;
    list-style: none;
}

.rich-editor ul li {
    position: relative;
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.rich-editor ul li:before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #4a5568;
}

.rich-editor ol {
    counter-reset: list-counter;
}

.rich-editor ol li {
    position: relative;
    margin: 0.5rem 0;
    padding-left: 1.5rem;
    line-height: 1.6;
    counter-increment: list-counter;
}

.rich-editor ol li:before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    font-weight: bold;
    color: #4a5568;
}

.rich-editor li p {
    margin: 0;
    display: inline;
}

/* Nested lists */
.rich-editor ul ul, .rich-editor ol ol, .rich-editor ul ol, .rich-editor ol ul {
    margin: 0.25rem 0;
    padding-left: 1rem;
}

.rich-editor ul ul li:before {
    content: "◦";
}

.rich-editor ul ul ul li:before {
    content: "▪";
}

.rich-editor blockquote {
    border-left: 4px solid #667eea;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #4a5568;
    font-style: italic;
}

.button-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
    gap: 1.5rem;
}

.process-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.typo-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.typo-controls label {
    font-weight: 600;
    color: #4a5568;
    font-size: 1rem;
    white-space: nowrap;
}

.typo-controls input {
    width: 80px;
    height: 48px;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.typo-controls input:focus {
    outline: none;
    border-color: #48bb78;
    background: white;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1);
    transform: scale(1.02);
}

.typo-help {
    font-size: 0.85rem;
    color: #6b7280;
    font-style: italic;
    white-space: nowrap;
}

.process-button {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.4);
    min-height: 48px;
}

.process-button:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.6);
}

.process-button:active {
    transform: translateY(0);
}

.copy-button {
    background: #48bb78;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    transition: all 0.3s ease;
    align-self: flex-start;
}

.copy-button:hover:not(:disabled) {
    background: #38a169;
    transform: translateY(-1px);
}

.copy-button:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
}

.copy-button.copied {
    background: #38a169;
}

footer {
    text-align: center;
    margin-top: 2rem;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .rich-editor {
        min-height: 200px;
    }
    
    .button-container {
        padding: 1rem 0;
    }
    
    .process-controls {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem 1.5rem;
    }
    
    .typo-controls {
        justify-content: center;
    }
    
    .textbox-section {
        padding: 1rem;
    }
}

/* Loading animation for process button */
.process-button.loading {
    pointer-events: none;
}

.process-button.loading span {
    opacity: 0.7;
}

.process-button.loading svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
} 