:root {
    --primary: #00CEC9;
    --secondary: #0984E3;
    --accent: #FDCB6E;
    --bg-color: #0A0F14;
    --panel-bg: rgba(20, 26, 33, 0.7);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-main: #FFFFFF;
    --text-muted: #A0AEC0;
    --success: #00b894;
    --error: #d63031;
    --warning: #fdcb6e;
    --border-radius: 12px;
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(0, 206, 201, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(9, 132, 227, 0.08) 0%, transparent 50%);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
}

.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

header {
    padding: 1rem 1.5rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

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

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-family: inherit;
}

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

.btn.primary:hover {
    background-color: #00dfd8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 206, 201, 0.3);
}

.btn.secondary {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn.secondary:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

main {
    display: flex;
    gap: 1rem;
    flex: 1;
    overflow: hidden;
}

.editor-section, .preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--panel-border);
}

.section-header h2 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.badge {
    background-color: rgba(9, 132, 227, 0.2);
    color: var(--secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
}

select {
    appearance: none;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.4rem 2rem 0.4rem 1rem;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
}

select:focus {
    border-color: var(--primary);
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.6rem;
    color: var(--text-muted);
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.viewport-toggles {
    display: flex;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid var(--panel-border);
    overflow: hidden;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.4rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.icon-btn.active {
    color: var(--primary);
    background-color: rgba(0, 206, 201, 0.1);
}

.icon-btn.active:hover {
    background-color: rgba(0, 206, 201, 0.15);
}

.theme-toggle {
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.2);
}

.theme-toggle.dark-active {
    color: var(--accent);
    border-color: var(--accent);
}

.editor-container {
    flex: 1;
    position: relative;
    padding: 1rem;
}

textarea {
    width: 100%;
    height: 100%;
    background-color: transparent;
    color: #e2e8f0;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    border: none;
    resize: none;
    outline: none;
    padding: 0.5rem;
    tab-size: 2;
}

textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.preview-container {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    background-color: #111827;
}

.client-chrome {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: var(--transition);
}

/* Apple Mail Chrome */
.apple-mail .mac-header {
    background-color: #f1f1f1;
    border-bottom: 1px solid #dcdcdc;
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
}

.apple-mail.dark-preview .mac-header {
    background-color: #2d2d2d;
    border-bottom-color: #1e1e1e;
}

.dots {
    display: flex;
    gap: 6px;
    margin-right: 1rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.close { background-color: #ff5f56; }
.dot.min { background-color: #ffbd2e; }
.dot.max { background-color: #27c93f; }

.subject-line {
    font-size: 0.875rem;
    color: #333;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.dark-preview .subject-line {
    color: #ccc;
}

/* Gmail Chrome */
.gmail .mac-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem;
    display: flex;
    align-items: center;
}

.gmail.dark-preview .mac-header {
    background-color: #202124;
    border-bottom-color: #3c4043;
}

.gmail .dots { display: none; }
.gmail .subject-line {
    font-size: 1.25rem;
    font-weight: 400;
    text-align: left;
    color: #202124;
}
.gmail.dark-preview .subject-line {
    color: #e8eaed;
}

/* Outlook Chrome */
.outlook-desktop .mac-header {
    background-color: #0078d4;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
}

.outlook-desktop.dark-preview .mac-header {
    background-color: #333333;
}

.outlook-desktop .dots { display: none; }
.outlook-desktop .subject-line {
    color: white;
    font-size: 1.1rem;
    text-align: left;
}

.iframe-wrapper {
    flex: 1;
    background-color: #fff;
    width: 100%;
    margin: 0 auto;
    transition: width 0.3s ease;
}

.dark-preview .iframe-wrapper {
    background-color: #121212;
}

.viewport-desktop {
    width: 100%;
}

.viewport-tablet {
    width: 768px;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
}

.dark-preview .viewport-tablet {
    border-color: #333;
}

.viewport-mobile {
    width: 375px;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
}

.dark-preview .viewport-mobile {
    border-color: #333;
}

iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: transparent;
}

.validation-panel {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 400px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.validation-panel.hidden {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

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

.panel-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

.results-list {
    list-style: none;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.result-item {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid transparent;
}

.result-item.success { border-left-color: var(--success); }
.result-item.error { border-left-color: var(--error); }
.result-item.warning { border-left-color: var(--warning); }

.result-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.result-content {
    flex: 1;
}

.result-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.result-desc {
    color: var(--text-muted);
}

@media (max-width: 900px) {
    main {
        flex-direction: column;
    }
    
    .validation-panel {
        bottom: 1rem;
        right: 1rem;
        width: calc(100% - 2rem);
    }
}
