/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #fafafa;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    border-bottom: 1px solid #e5e5e5;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid #e5e5e5;
}

.btn-ghost:hover {
    background: #f9fafb;
    color: #374151;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Main content */
.main {
    flex: 1;
    padding: 2rem;
}

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: calc(100vh - 200px);
    min-height: 600px;
}

.editor-panel,
.preview-panel {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.panel-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

/* Editor */
.editor {
    flex: 1;
    padding: 1.5rem;
    border: none;
    outline: none;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
    background: white;
}

.editor::placeholder {
    color: #9ca3af;
}

/* Preview */
.preview {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: white;
}

.preview h1,
.preview h2,
.preview h3,
.preview h4,
.preview h5,
.preview h6 {
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    line-height: 1.25;
}

.preview h1 {
    font-size: 2rem;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.5rem;
}

.preview h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 0.25rem;
}

.preview h3 {
    font-size: 1.25rem;
}

.preview p {
    margin: 0.75rem 0;
}

.preview ul,
.preview ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.preview li {
    margin: 0.25rem 0;
}

.preview blockquote {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-left: 4px solid #e5e5e5;
    background: #f9fafb;
    color: #6b7280;
}

.preview code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.875em;
}

.preview pre {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
}

.preview pre code {
    background: none;
    padding: 0;
}

.preview a {
    color: #2563eb;
    text-decoration: none;
}

.preview a:hover {
    text-decoration: underline;
}

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

.preview th,
.preview td {
    border: 1px solid #e5e5e5;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.preview th {
    background: #f9fafb;
    font-weight: 600;
}

/* Footer */
.footer {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    border-top: 1px solid #e5e5e5;
    background: white;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.url-container {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.url-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #f9fafb;
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .main {
        padding: 1rem;
    }

    .editor-container {
        grid-template-columns: 1fr;
        gap: 1rem;
        height: auto;
    }

    .editor-panel,
    .preview-panel {
        min-height: 400px;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Hide preview panel by default on mobile */
@media (max-width: 768px) {
    .preview-panel {
        display: none;
    }
    
    .preview-panel.show {
        display: flex;
    }
    
    .editor-panel.hide {
        display: none;
    }
}
