/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

header p {
    font-size: 0.95rem;
    opacity: 0.95;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    height: 600px;
    max-height: 80vh;
}

/* Section Styles */
.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.input-section {
    border-right: 2px solid #e0e0e0;
    box-shadow: inset 0 0 10px rgba(102, 126, 234, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
}

/* Textarea Styles */
#markdownInput {
    flex: 1;
    min-height: 0;
    border: 2px solid transparent;
    padding: 25px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    background: #f5f7ff;
    overflow-y: auto;
    overflow-x: auto;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

#markdownInput:focus {
    border: 2px solid #667eea;
    background: white;
}

#markdownInput::placeholder {
    color: #999;
}

/* Output Display Styles */
.output-display {
    flex: 1;
    min-height: 0;
    padding: 25px;
    overflow-y: auto;
    overflow-x: auto;
    background: white;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.output-display .placeholder {
    color: #999;
    font-style: italic;
}

/* Formatted Content Styles (Google Docs-like) */
.output-display h1 {
    font-size: 2em;
    font-weight: 600;
    margin: 0.67em 0;
    color: #202124;
}

.output-display h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0.75em 0;
    color: #202124;
}

.output-display h3 {
    font-size: 1.17em;
    font-weight: 600;
    margin: 0.83em 0;
    color: #202124;
}

.output-display h4 {
    font-size: 1em;
    font-weight: 600;
    margin: 1.12em 0;
    color: #202124;
}

.output-display h5 {
    font-size: 0.83em;
    font-weight: 600;
    margin: 1.5em 0;
    color: #202124;
}

.output-display h6 {
    font-size: 0.75em;
    font-weight: 600;
    margin: 1.67em 0;
    color: #202124;
}

.output-display p {
    margin: 0.5em 0;
    color: #202124;
}

.output-display strong,
.output-display b {
    font-weight: 700;
}

.output-display em,
.output-display i {
    font-style: italic;
}

.output-display ul,
.output-display ol {
    margin: 0.5em 0;
    padding-left: 30px;
}

.output-display li {
    margin: 0.25em 0;
}

.output-display a {
    color: #1155cc;
    text-decoration: underline;
}

.output-display a:hover {
    color: #0033cc;
}

.output-display code {
    background: #f1f3f4;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.output-display pre {
    background: #f1f3f4;
    padding: 12px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.output-display pre code {
    background: none;
    padding: 0;
}

.output-display blockquote {
    border-left: 4px solid #e0e0e0;
    padding-left: 16px;
    margin: 0.5em 0;
    color: #5f6368;
    font-style: italic;
}

.output-display table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5em 0;
}

.output-display table,
.output-display th,
.output-display td {
    border: 1px solid #e0e0e0;
}

.output-display th,
.output-display td {
    padding: 8px 12px;
    text-align: left;
}

.output-display th {
    background: #f1f3f4;
    font-weight: 600;
}

/* Button Styles */
button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.primary-btn {
    background: #667eea;
    color: white;
}

.primary-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn.copied {
    background: #10b981;
}

.secondary-btn {
    background: #e0e0e0;
    color: #333;
}

.secondary-btn:hover {
    background: #d0d0d0;
}

/* Output Footer */
.output-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px 25px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
}

/* Custom Scrollbar Styling */
#markdownInput::-webkit-scrollbar,
.output-display::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#markdownInput::-webkit-scrollbar-track,
.output-display::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#markdownInput::-webkit-scrollbar-thumb,
.output-display::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#markdownInput::-webkit-scrollbar-thumb:hover,
.output-display::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Design */
@media (max-width: 968px) {
    body {
        padding: 10px;
    }

    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    .input-section {
        border-right: none;
        border-bottom: 2px solid #e0e0e0;
    }

    #markdownInput,
    .output-display {
        height: 300px;
        max-height: 50vh;
        padding: 15px;
    }
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }

    .section-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .section-header h2 {
        font-size: 1rem;
    }

    button {
        padding: 6px 15px;
        font-size: 0.85rem;
        width: 100%;
    }
}
