:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ff007a;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.3);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --radius: 16px;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.app-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Sidebar / Form Area */
.sidebar {
    background: rgba(255, 255, 255, 0.5);
    padding: 30px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#app-title {
    font-size: 24px;
    font-weight: 600;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

input[type="text"], textarea {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.3s ease;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 5px 0;
    transition: color 0.2s;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.loading {
    opacity: 0.6 !important;
    cursor: wait !important;
    pointer-events: none;
}

/* Dynamic Item Styles */
.dynamic-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.dynamic-item input {
    flex: 1;
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.category-block {
    background: rgba(0, 0, 0, 0.03);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.category-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

/* Preview Area */
.preview-area {
    padding: 30px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.actions {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn.primary {
    background: var(--primary);
    color: white;
    border: none;
}

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

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

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

.preview-window {
    flex: 1;
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.preview-content {
    background: white;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.placeholder-text {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-style: italic;
}

/* Newsletter Template Styles (Mimicking the generated look) */
/* Note: These will be inlined in JS, but here for the preview container */
.ns-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.ns-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.ns-body {
    padding: 30px;
}

.ns-section {
    margin-bottom: 25px;
}

.ns-section h2 {
    font-size: 18px;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.ns-list {
    list-style-type: none;
}

.ns-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: baseline;
}

.ns-list li::before {
    content: "✦";
    color: #6366f1;
    margin-right: 10px;
    font-size: 12px;
}

.ns-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.ns-metric-card {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.ns-metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #4f46e5;
}

.ns-metric-label {
    font-size: 12px;
    color: #64748b;
    margin-top: 5px;
}
