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

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

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

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px 20px;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

.main-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.input-section {
    display: grid;
    gap: 30px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.input-group h2 {
    font-size: 1.5rem;
    color: #667eea;
    font-weight: 600;
}

.char-count {
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

.analyze-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.analyze-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.analyze-button:active:not(:disabled) {
    transform: translateY(0);
}

.analyze-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.spinner {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.results-header h2 {
    font-size: 2rem;
    color: #667eea;
}

.header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.copy-button, .download-button, .pdf-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.copy-button:hover, .download-button:hover, .pdf-button:hover:not(:disabled) {
    background: #5568d3;
}

.latex-button {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.latex-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

.latex-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.suggestions-section {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.suggestions-section h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.suggestions-section p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.suggestions-section textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.3s;
}

.suggestions-section textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.suggestions-section .latex-button {
    width: 100%;
    margin-top: 15px;
}

.latex-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #e0e0e0;
}

.latex-content {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #333;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

.results-content {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 30px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #333;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #fcc;
    font-weight: 500;
}

/* Scrollbar styling */
.results-content::-webkit-scrollbar {
    width: 8px;
}

.results-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.results-content::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.results-content::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .main-content {
        padding: 20px;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .results-content {
        font-size: 0.85rem;
        padding: 20px;
    }
}

