/* CSS Variables for theming */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --code-tag: #f472b6;
    --code-attr: #a78bfa;
    --code-string: #34d399;
    --code-comment: #64748b;
    --code-doctype: #fbbf24;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.2);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

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

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Options bar */
.options-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.option-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option-group label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.option-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-light);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.option-group select:hover {
    border-color: var(--primary-color);
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.checkbox-group {
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
}

/* Editor container */
.editor-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-height: 250px;
}

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

.panel-header h2 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Textarea styles */
textarea, #output-html {
    flex: 1;
    width: 100%;
    padding: 1rem;
    border: none;
    background: var(--surface);
    color: var(--text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: none;
}

textarea {
    min-height: 200px;
}

textarea:focus {
    outline: none;
}

textarea::placeholder {
    color: var(--text-secondary);
}

/* Output container */
#output-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

#output-html {
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#output-code {
    display: block;
}

#output-plain {
    flex: 1;
}

.hidden {
    display: none !important;
}

/* Syntax highlighting */
.tag { color: var(--code-tag); }
.attr-name { color: var(--code-attr); }
.attr-value { color: var(--code-string); }
.comment { color: var(--code-comment); font-style: italic; }
.doctype { color: var(--code-doctype); }
.entity { color: var(--code-string); }

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    border-color: var(--secondary-hover);
}

.action-buttons {
    display: flex;
    justify-content: center;
    padding: 0.5rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.875rem 1.5rem;
    background: var(--surface);
    color: var(--text-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

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

/* Responsive design */
@media (min-width: 768px) {
    .editor-container {
        flex-direction: row;
    }

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

    .action-buttons {
        flex-direction: column;
        justify-content: center;
        padding: 0 0.5rem;
    }

    .btn-primary {
        writing-mode: vertical-rl;
        text-orientation: mixed;
        padding: 2rem 0.75rem;
    }

    .btn-primary svg {
        transform: rotate(90deg);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 2rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .editor-panel {
        min-height: 500px;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .logo {
        width: 36px;
        height: 36px;
    }

    .tagline {
        font-size: 0.95rem;
    }

    .options-bar {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .option-group {
        flex-basis: calc(50% - 0.5rem);
        justify-content: center;
    }

    .checkbox-group {
        flex-basis: 100%;
        justify-content: center;
        padding-left: 0;
        padding-top: 0.5rem;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .panel-header {
        padding: 0.5rem 0.75rem;
    }

    textarea, #output-html {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

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

    .btn-primary {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Selection color */
::selection {
    background: rgba(99, 102, 241, 0.3);
}
