/* CSS Variables for Design System */
:root {
    --bg-primary: #181818;
    --bg-secondary: #3a3a3a;
    --bg-tertiary: #3a3a3a;
    --bg-editor: #3a3a3a;
    --accent-primary: #ffffff;
    --accent-secondary: #afafaf;
    --accent-gradient: linear-gradient(135deg, #00d9ff 0%, #7c3aed 100%);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-accent: #ffffff;
    --border-color: #707070;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-large: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.header h1 {
    display: block;
    color: var(--text-accent);
    margin: 32px auto;
    text-align: center;
    position: relative;
}

/* Main Container */
.container {
    display: flex;
    width: min(90%, 1400px);
    height: 80vh;
    min-height: 600px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin: 0 auto 40px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    opacity: 0.8;
}

/* Editor Area */
.editor {
    width: 50%;
    padding: 24px;
    background: var(--bg-editor);
    border-right: 1px solid var(--border-color);
    overflow: auto;
    display: flex;
    flex-direction: column;
    position: relative;
}

.editor::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
}

.editor h2 {
    margin-bottom: 8px;
    color: var(--text-accent);
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    position: relative;
}

/* Preview Area */
.preview {
    display: flex;
    flex-direction: column;
    width: 50%;
    min-width: 384px;
    padding: 24px;
    background: var(--bg-secondary);
    position: relative;
}

.preview h2 {
    margin-bottom: 8px;
    color: var(--text-accent);
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
}

#ad {
    height: auto;
    margin-bottom: 24px;
    text-align: center;
}

/* iframe Styling */
iframe {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    flex-grow: 1;
    position: relative;
}

/* Responsive Design */
@media (max-width: 1280px) {
    .container {
        flex-direction: column;
        height: auto;
        width: 95%;
    }

    .editor, .preview {
        width: 100%;
        padding: 20px;
    }

    .editor {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    iframe {
        height: 512px;
    }

    .preview {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    h1 {
        margin: 24px auto;
    }

    h1 img {
        max-width: 100%;
        height: auto;
    }

    .container {
        width: 100%;
        margin: 0 auto 24px;
        border-radius: var(--radius-md);
    }

    .editor, .preview {
        padding: 16px;
    }

    .editor h2, .preview h2 {
        font-size: 16px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1a1a1a;
        --bg-tertiary: #2a2a2a;
        --bg-editor: #111111;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --border-color: #666666;
    }
}