/* Scoped styles for the Markdown Previewer App */

:root {
    --md-bg: rgba(17, 24, 39, 0.7);
    --md-primary: #10b981;
    --md-primary-hover: #059669;
    --md-border: rgba(255, 255, 255, 0.1);
}

.app-container {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.main-card {
    background: var(--md-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--md-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    width: 100%;
    max-width: 1100px;
    overflow: hidden;
    min-height: 600px;
    margin-top: 2rem;
}

/* Common Section Styles */
.input-section,
.display-section {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Left Section */
.input-section {
    border-right: 1px solid var(--md-border);
}

.brand {
    margin-bottom: 1rem;
}

.brand h1 {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(to right, #34d399, #10b981);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.brand p {
    color: #94a3b8;
    font-size: 1rem;
}

/* Editor Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--md-border);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    flex-wrap: wrap;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: rgba(16, 185, 129, 0.15);
    color: var(--md-primary);
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--md-border);
    margin: 0 0.25rem;
}

/* Markdown Input */
#md-input {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--md-border);
    border-radius: 0 0 12px 12px;
    padding: 1rem;
    color: #f8fafc;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    outline: none;
    resize: none;
    line-height: 1.7;
    transition: border-color 0.3s ease;
    min-height: 300px;
}

#md-input:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}

#md-input::placeholder {
    color: #475569;
}

/* Right Section */
.display-section {
    background: rgba(15, 23, 42, 0.3);
    overflow-y: auto;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.result-header label {
    font-size: 0.9rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--md-primary);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.icon-btn:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* Preview Output */
.preview-output {
    flex: 1;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--md-border);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    color: #e2e8f0;
    line-height: 1.7;
    font-size: 0.95rem;
}

.preview-placeholder {
    color: #475569;
    font-style: italic;
}

/* Markdown rendered content styles */
.preview-output h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--md-border);
}

.preview-output h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 1.5rem 0 0.75rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--md-border);
}

.preview-output h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 1.25rem 0 0.5rem 0;
}

.preview-output h4,
.preview-output h5,
.preview-output h6 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 1rem 0 0.5rem 0;
}

.preview-output p {
    margin: 0 0 1rem 0;
}

.preview-output a {
    color: var(--md-primary);
    text-decoration: underline;
}

.preview-output strong {
    color: #f8fafc;
    font-weight: 700;
}

.preview-output em {
    font-style: italic;
}

.preview-output del {
    text-decoration: line-through;
    color: #94a3b8;
}

.preview-output code {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
}

.preview-output pre {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--md-border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin: 0 0 1rem 0;
}

.preview-output pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
    border-radius: 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

.preview-output blockquote {
    border-left: 3px solid var(--md-primary);
    margin: 0 0 1rem 0;
    padding: 0.5rem 1rem;
    color: #94a3b8;
    background: rgba(16, 185, 129, 0.05);
    border-radius: 0 8px 8px 0;
}

.preview-output blockquote p {
    margin: 0;
}

.preview-output ul,
.preview-output ol {
    margin: 0 0 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.preview-output li {
    line-height: 1.6;
}

.preview-output hr {
    border: none;
    border-top: 1px solid var(--md-border);
    margin: 1.5rem 0;
}

.preview-output img {
    max-width: 100%;
    border-radius: 8px;
}

.preview-output table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
}

.preview-output th,
.preview-output td {
    border: 1px solid var(--md-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.preview-output th {
    background: rgba(15, 23, 42, 0.6);
    color: #f8fafc;
    font-weight: 600;
}

.preview-output td {
    color: #cbd5e1;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .main-card {
        flex-direction: column;
        height: auto;
    }

    .input-section {
        border-right: none;
        border-bottom: 1px solid var(--md-border);
        padding: 1.5rem;
    }

    .display-section {
        padding: 1.5rem;
        min-height: 350px;
    }

    .brand h1 {
        font-size: 1.6rem;
    }
}
