:root {
    /* Pink Slate Palette */
    --bg-base: #0F172A;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-surface-solid: #1e293b;
    --bg-hover: rgba(236, 72, 153, 0.1);

    --border-light: rgba(244, 114, 182, 0.2);
    --border-subtle: rgba(255, 255, 255, 0.05);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --primary: #EC4899;
    --primary-hover: #db2777;
    --secondary: #F472B6;
    --accent: #FBCFE8;

    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;

    --font-ui: 'Inter', system-ui, sans-serif;
    --font-code: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Glassmorphism */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-light);
}

/* Typography Utils */
.text-sm {
    font-size: 0.85rem;
}

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

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.font-medium {
    font-weight: 500;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mr-1 {
    margin-right: 0.25rem;
}

.mr-2 {
    margin-right: 0.5rem;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.hidden {
    display: none !important;
}

.relative {
    position: relative;
}

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

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

/* Header */
.app-header {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    font-weight: 500;
}

.logo strong {
    font-weight: 700;
    color: #FFF;
}

.toolbar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.device-toggles {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: #FFF;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

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

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

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

.btn-icon {
    padding: 0.4rem 0.75rem;
    background: transparent;
    color: var(--text-muted);
    border-right: 1px solid var(--border-subtle);
    border-radius: 0;
}

.btn-icon:last-child {
    border-right: none;
}

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

.btn-icon.active {
    background: rgba(236, 72, 153, 0.15);
    color: var(--primary);
}

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

/* Workspace Layout */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Panes */
.pane {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    position: relative;
}

.pane-editor {
    border-right: 1px solid var(--border-light);
    flex: 1;
    background: var(--bg-base);
}

.pane-preview {
    flex: 1.5;
    background: #0b1121;
}

.pane-header {
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    background: var(--bg-surface-solid);
    height: 50px;
}

.pane-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pane-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.pane-content.no-pad {
    padding: 0;
    overflow: hidden;
}

/* Editor */
.code-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    color: #a5d6ff;
    border: none;
    padding: 1rem 1.5rem;
    font-family: var(--font-code);
    font-size: 0.85rem;
    line-height: 1.6;
    resize: none;
    outline: none;
    white-space: pre;
    overflow: auto;
}

.code-editor::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.code-editor::-webkit-scrollbar-corner {
    background: transparent;
}

.code-editor::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

/* Tabs */
.view-tabs {
    display: flex;
    gap: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.badge {
    background: rgba(236, 72, 153, 0.2);
    color: var(--secondary);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

/* Checkered Background for email canvas */
.bg-checkered {
    background-image:
        linear-gradient(45deg, #161e2f 25%, transparent 25%),
        linear-gradient(-45deg, #161e2f 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #161e2f 75%),
        linear-gradient(-45deg, transparent 75%, #161e2f 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Iframe Container */
.iframe-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    height: 90%;
    max-height: 800px;
    overflow: hidden;
    margin: 0 auto;
}

/* Width states controlled by JS classes */
.iframe-container.w-desktop {
    width: 100%;
    max-width: 1000px;
}

.iframe-container.w-tablet {
    width: 768px;
}

.iframe-container.w-mobile {
    width: 320px;
}

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

.dots {
    display: flex;
    gap: 6px;
}

.dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #475569;
}

.dots span:nth-child(1) {
    background: #ef4444;
}

.dots span:nth-child(2) {
    background: #f59e0b;
}

.dots span:nth-child(3) {
    background: #10b981;
}

.resolution-display {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-code);
}

#preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
    transition: background 0.3s;
}

/* Switches */
.sim-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-subtle);
    transition: .4s;
    border-radius: 34px;
    border: 1px solid var(--border-light);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(14px);
}

/* Links Panel */
.links-panel {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: var(--radius-md);
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.links-list::-webkit-scrollbar {
    width: 6px;
}

.links-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.link-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.link-status {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-solid);
}

.link-status.valid {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.link-status.invalid {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.link-details {
    flex: 1;
    min-width: 0;
    word-break: break-all;
}

.link-url {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.link-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Empty States */
.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
}

/* Toasts */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #000;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast.warning {
    background: var(--warning);
}

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

@media (max-width: 900px) {
    .workspace {
        flex-direction: column;
    }

    .pane {
        flex: none;
        height: 50vh;
    }

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