/* Email HTML Previewer — style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #0f172a;
    --bg2: #1e293b;
    --bg3: #334155;
    --border: #334155;
    --border-subtle: #1e293b;
    --text: #f1f5f9;
    --text2: #94a3b8;
    --text3: #64748b;
    --primary: #ef4444;
    --primary-light: #fca5a5;
    --primary-glow: rgba(239, 68, 68, 0.15);
    --green: #22c55e;
    --yellow: #eab308;
    --blue: #3b82f6;
    --purple: #a855f7;
    --radius: 8px;
    --transition: all 0.18s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    padding: 10px 16px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 50;
}

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

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #f97316);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.brand-sub {
    font-size: 10px;
    color: var(--text3);
    font-family: 'JetBrains Mono', monospace;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg3);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

/* Layout */
.app {
    display: grid;
    grid-template-columns: 420px 1fr;
    height: calc(100vh - 53px);
    overflow: hidden;
}

.left-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow: hidden;
    background: var(--bg);
}

.right-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Editor Toolbar */
.editor-toolbar {
    padding: 8px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.editor-toolbar-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text3);
}

.sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 2px;
}

/* Code Editor */
.code-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#html-input {
    width: 100%;
    height: 100%;
    background: #0a0e1a;
    color: #e2e8f0;
    border: none;
    resize: none;
    padding: 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12.5px;
    line-height: 1.7;
    outline: none;
    overflow-y: auto;
    tab-size: 2;
}

#html-input::placeholder {
    color: var(--text3);
}

/* Preview Toolbar */
.preview-toolbar {
    padding: 8px 12px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.client-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
}

.client-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    background: var(--bg);
    color: var(--text2);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.client-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.client-tab.active {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

.client-tab .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Viewport Toggle */
.viewport-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.vp-btn {
    padding: 5px 10px;
    background: var(--bg);
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 12px;
    transition: var(--transition);
}

.vp-btn.active {
    background: var(--bg3);
    color: var(--text);
}

/* Preview Area */
.preview-area {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #e2e8f0;
}

.preview-frame {
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    transition: width 0.3s ease;
    position: relative;
}

.preview-frame.desktop {
    width: 100%;
    max-width: 640px;
}

.preview-frame.mobile {
    width: 375px;
}

.client-chrome {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 11px;
    font-weight: 500;
    color: #4b5563;
}

.client-chrome-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.email-preview-iframe {
    width: 100%;
    border: none;
    display: block;
    min-height: 400px;
}

/* CSS Compat Panel */
.compat-panel {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--bg2);
    max-height: 200px;
    overflow-y: auto;
}

.compat-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text3);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    background: var(--bg2);
}

.compat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.compat-table th {
    padding: 5px 10px;
    text-align: left;
    color: var(--text3);
    font-weight: 500;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg2);
}

.compat-table td {
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.compat-style {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text2);
}

.compat-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.badge-ok {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}

.badge-warn {
    background: rgba(234, 179, 8, 0.15);
    color: var(--yellow);
}

.badge-no {
    background: rgba(239, 68, 68, 0.15);
    color: var(--primary);
}

/* Sidebar Sections */
.sidebar-section {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text3);
    margin-bottom: 8px;
}

/* Templates */
.template-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
}

.template-item {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text2);
}

.template-item:hover {
    border-color: var(--primary);
    color: var(--text);
    background: var(--primary-glow);
}

/* Warnings */
.warnings-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 120px;
    overflow-y: auto;
}

.warning-item {
    padding: 5px 8px;
    border-radius: 4px;
    border-left: 2px solid var(--yellow);
    background: rgba(234, 179, 8, 0.07);
    font-size: 11px;
    color: var(--text2);
}

.warning-item.error {
    border-color: var(--primary);
    background: rgba(239, 68, 68, 0.07);
}

.empty-msg {
    color: var(--text3);
    font-size: 11px;
    padding: 6px 0;
}

/* Inline CSS Converter */
.inline-output {
    background: #0a0e1a;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10.5px;
    color: #86efac;
    max-height: 100px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Toast */
.toast-wrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    pointer-events: none;
}

.toast {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
    color: var(--text);
    font-size: 12px;
    pointer-events: all;
    transform: translateX(40px);
    opacity: 0;
    transition: all 0.25s ease;
    margin-top: 6px;
}

.toast.show {
    transform: none;
    opacity: 1;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

@media(max-width:768px) {
    .app {
        grid-template-columns: 1fr
    }

    .left-pane {
        max-height: 50vh
    }
}