/* General Body Styles */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a2e; /* Dark Purple - Blackish: Main background */
    color: #ffffff; /* White: Primary text color */
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
    line-height: 1.6;
}

/* Converter Container */
.converter-container {
    background-color: #2d2d44; /* Darker Purple: Container background */
    padding: 35px 45px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 800px; /* Slightly wider for better rich text display */
    text-align: left;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Main Title */
h1 {
    color: #e94560; /* Bright Orange: Accent color for title */
    margin-bottom: 35px;
    font-size: 2.2em;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Textarea and Output Area Grouping */
.textarea-group,
.output-area-group {
    margin-bottom: 25px;
}

.textarea-group label,
.output-area-group label {
    display: block;
    color: #e0e0e0; /* Light Grey: Text color for labels */
    margin-bottom: 8px;
    font-size: 0.95em;
    font-weight: 500;
}

/* Markdown Input Textarea Styling */
textarea#markdownInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #4a4a6a; /* Mid Purple: Border color */
    border-radius: 8px;
    background-color: #1f1f32; /* Very Dark Purple: Background */
    color: #e0e0e0; /* Light Grey: Text color */
    font-size: 1em;
    font-family: 'Inter', monospace;
    min-height: 200px;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea#markdownInput:focus {
    border-color: #e94560; /* Bright Orange: Accent for focus */
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.25);
    outline: none;
}

textarea#markdownInput::placeholder {
    color: #88889a; /* Placeholder text color */
    font-style: italic;
}

/* HTML Output Display Area Styling */
.html-output-display {
    width: 100%;
    padding: 15px;
    border: 2px solid #3a3a5a; /* Slightly different border for output */
    border-radius: 8px;
    background-color: #25253a; /* Slightly lighter background for output */
    color: #e0e0e0; /* Light Grey: Text color */
    font-size: 1em;
    min-height: 200px; /* Consistent height */
    box-sizing: border-box;
    overflow-y: auto; /* Add scroll if content overflows */
    line-height: 1.7; /* Improved readability for rich text */
}

.html-output-display .placeholder-text {
    color: #88889a;
    font-style: italic;
}

/* Basic styling for HTML elements generated by Marked.js within the output display */
.html-output-display h1,
.html-output-display h2,
.html-output-display h3,
.html-output-display h4,
.html-output-display h5,
.html-output-display h6 {
    color: #e94560; /* Orange for headings */
    margin-top: 0.8em;
    margin-bottom: 0.4em;
    line-height: 1.3;
}

.html-output-display h1 { font-size: 1.8em; }
.html-output-display h2 { font-size: 1.5em; }
.html-output-display h3 { font-size: 1.3em; }

.html-output-display p {
    margin-bottom: 0.8em;
}

.html-output-display a {
    color: #f08a5d; /* A lighter, distinct orange for links */
    text-decoration: underline;
}
.html-output-display a:hover {
    color: #ffae8a;
}

.html-output-display ul,
.html-output-display ol {
    margin-left: 20px;
    margin-bottom: 0.8em;
}

.html-output-display li {
    margin-bottom: 0.3em;
}

.html-output-display blockquote {
    border-left: 4px solid #4a4a6a;
    padding-left: 15px;
    margin-left: 0;
    color: #b0b0c0; /* Slightly muted color for quotes */
    font-style: italic;
}

.html-output-display pre {
    background-color: #1f1f32; /* Dark background for code blocks */
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto; /* Scroll for long code lines */
    border: 1px solid #4a4a6a;
}

.html-output-display code {
    font-family: 'Courier New', Courier, monospace;
    background-color: #1a1a2e; /* Slightly different for inline code */
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}

.html-output-display pre code {
    background-color: transparent; /* No double background for code within pre */
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

.html-output-display table {
    width: auto; /* Or 100% if you prefer full-width tables */
    border-collapse: collapse;
    margin-bottom: 1em;
}

.html-output-display th,
.html-output-display td {
    border: 1px solid #4a4a6a;
    padding: 8px 12px;
    text-align: left;
}

.html-output-display th {
    background-color: #3a3a5a; /* Header background for tables */
}


/* Button Styling */
.action-button {
    background-color: #e94560; /* Bright Orange: Accent color */
    color: #ffffff; /* White: Text color */
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    display: block;
    width: fit-content;
    margin: 25px auto 0 auto; /* Increased top margin */
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.2);
}

.action-button:hover {
    background-color: #d43c53;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(233, 69, 96, 0.3);
}

.action-button:active {
    background-color: #bf3349;
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.25);
}

/* Copy Message Styling */
.copy-message {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    color: #e94560;
    height: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.copy-message.visible {
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .converter-container {
        padding: 20px;
        margin-top: 15px;
        margin-bottom: 15px;
    }
    h1 {
        font-size: 1.8em;
        margin-bottom: 25px;
    }
    textarea#markdownInput,
    .html-output-display {
        min-height: 180px; /* Adjusted for smaller screens */
    }
    .action-button {
        padding: 12px 24px;
        font-size: 1em;
        width: 100%; /* Full width button on small screens */
        max-width: 300px; /* Max width for centered full-width button */
    }
}
