/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --bg-color: #f5f7fa;
    --border-color: #dfe4ea;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark-color);
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

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

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 400;
}

/* Main Content */
.main-content {
    padding: 30px 50px 50px;
}

/* Control Panel */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 12px 24px;
    background: var(--light-color);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #dfe4ea;
    transform: translateY(-2px);
}

.tab-btn.active {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #45a049;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: var(--light-color);
}

/* Editor Container */
.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    min-height: 600px;
}

.editor-panel,
.preview-panel {
    display: flex;
    flex-direction: column;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.css-panel {
    grid-column: 1;
}

.panel-header {
    background: var(--light-color);
    padding: 15px 20px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

#zoomLevel {
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* Textarea */
#markdownInput,
#customCSS {
    flex: 1;
    padding: 20px;
    border: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    background: #fafafa;
}

#markdownInput:focus,
#customCSS:focus {
    background: white;
}

/* Preview Content */
.preview-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: white;
}

.preview-placeholder {
    color: #999;
    text-align: center;
    font-style: italic;
    padding: 50px 20px;
}

/* Markdown Styling in Preview */
#htmlPreview h1,
#fullscreenPreview h1 {
    font-size: 2.5rem;
    color: var(--dark-color);
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 700;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

#htmlPreview h2,
#fullscreenPreview h2 {
    font-size: 2rem;
    color: var(--dark-color);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.4rem;
}

#htmlPreview h3,
#fullscreenPreview h3 {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
}

#htmlPreview h4,
#fullscreenPreview h4 {
    font-size: 1.25rem;
    color: var(--dark-color);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

#htmlPreview p,
#fullscreenPreview p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

#htmlPreview ul,
#htmlPreview ol,
#fullscreenPreview ul,
#fullscreenPreview ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

#htmlPreview li,
#fullscreenPreview li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

#htmlPreview a,
#fullscreenPreview a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

#htmlPreview a:hover,
#fullscreenPreview a:hover {
    text-decoration: underline;
}

#htmlPreview code,
#fullscreenPreview code {
    background-color: #f4f4f4;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

#htmlPreview pre,
#fullscreenPreview pre {
    background-color: #282c34;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

#htmlPreview pre code,
#fullscreenPreview pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
}

#htmlPreview blockquote,
#fullscreenPreview blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin-left: 0;
    margin-bottom: 1rem;
    color: #666;
    font-style: italic;
}

#htmlPreview table,
#fullscreenPreview table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

#htmlPreview th,
#htmlPreview td,
#fullscreenPreview th,
#fullscreenPreview td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

#htmlPreview th,
#fullscreenPreview th {
    background-color: var(--light-color);
    font-weight: 600;
}

#htmlPreview tr:nth-child(even),
#fullscreenPreview tr:nth-child(even) {
    background-color: #fafafa;
}

#htmlPreview img,
#fullscreenPreview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

#htmlPreview hr,
#fullscreenPreview hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 2rem 0;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--dark-color);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
    z-index: 1000;
    font-weight: 500;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Fullscreen Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    padding: 20px;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    background: var(--light-color);
    padding: 20px 30px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fullscreen-preview {
    flex: 1;
    padding: 50px;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .preview-panel {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .control-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tabs,
    .action-buttons {
        width: 100%;
        flex-direction: column;
    }
    
    .tab-btn,
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .preview-content,
    .fullscreen-preview {
        padding: 20px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-color);
}

::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}
