:root {
    --primary-color: #4CAF50; /* Soft Green */
    --secondary-color: #2196F3; /* Soft Blue */
    --accent-color: #FFC107; /* Amber for highlights */
    --bg-light: #f4f7f6;
    --text-dark: #333;
    --text-light: #fff;
    --border-color: #e0e0e0;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--bg-light) 0%, #e0f2f1 100%); /* Soft gradient */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.container {
    background-color: rgba(255, 255, 255, 0.9); /* Slight transparency for glassmorphism */
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-medium);
    padding: 30px;
    max-width: 900px;
    width: 100%;
    margin: 20px auto;
    backdrop-filter: blur(10px); /* Glassmorphism effect */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.quote {
    font-family: 'Poppins', sans-serif;
    font-size: 1.4em;
    font-style: italic;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
}

h2 {
    font-family: 'Poppins', sans-serif;
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-weight: 700;
    text-align: center;
}

section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px var(--shadow-light);
}

.input-section textarea {
    width: 100%;
    min-height: 250px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    font-size: 1em;
    font-family: 'Inter', sans-serif;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s ease;
}

.input-section textarea:focus {
    border-color: var(--primary-color);
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    background-color: var(--secondary-color);
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    padding: 15px 20px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-btn:hover {
    background-color: #1976D2; /* Darker blue */
    transform: translateY(-3px);
}

.mode-btn.active {
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.4);
}

.generate-btn {
    display: block;
    width: 100%;
    padding: 18px;
    background-color: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    font-size: 1.3em;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.generate-btn:hover {
    background-color: #388E3C; /* Darker green */
    transform: translateY(-3px);
}

.generate-btn:active {
    transform: translateY(0);
}

/* Loading animation */
.generate-btn.loading {
    background-color: #607D8B; /* Grey while loading */
    cursor: not-allowed;
}

.generate-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 25px;
    height: 25px;
    margin-top: -12.5px;
    margin-left: -12.5px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.output-box {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    font-size: 1.1em;
    white-space: pre-wrap; /* Preserves whitespace and line breaks */
    word-wrap: break-word; /* Breaks long words */
    line-height: 1.8; /* Improved readability */
    color: var(--text-dark);
    box-shadow: inset 0 2px 5px var(--shadow-light);
}

.output-box ul {
    list-style-type: disc;
    margin-left: 20px;
    margin-bottom: 10px;
}

.output-box ol {
    list-style-type: decimal;
    margin-left: 20px;
    margin-bottom: 10px;
}

.output-box li {
    margin-bottom: 8px;
}

.output-box strong {
    color: var(--secondary-color);
}

.placeholder-text {
    color: #999;
    font-style: italic;
    text-align: center;
    padding-top: 50px;
}

.output-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.action-btn {
    background-color: #607D8B; /* Grey */
    color: var(--text-light);
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.action-btn:hover {
    background-color: #455A64; /* Darker grey */
}

footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: #777;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .mode-buttons {
        grid-template-columns: 1fr; /* Stack buttons on small screens */
    }

    .quote {
        font-size: 1.2em;
    }

    h2 {
        font-size: 1.5em;
    }

    .mode-btn, .generate-btn, .action-btn {
        font-size: 1em;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .container {
        border-radius: 10px;
        margin: 10px auto;
        padding: 15px;
    }

    .input-section textarea {
        min-height: 180px;
    }

    .output-box {
        min-height: 150px;
        padding: 15px;
    }

    .output-actions {
        flex-direction: column;
        gap: 8px;
    }

    .action-btn {
        width: 100%;
    }
}