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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #F8F9FA;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Sidebar removed */

/* API Status Sidebar */
.api-status-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    overflow-y: auto;
    z-index: 1000;
}

.api-status-sidebar h3 {
    color: #1a202c;
    font-size: 18px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.api-status-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.api-status-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.api-status-item:hover {
    background: #edf2f7;
    transform: translateX(5px);
}

.api-icon {
    font-size: 24px;
    margin-right: 12px;
}

.api-info {
    flex: 1;
}

.api-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
}

.api-status-text {
    font-size: 12px;
    color: #718096;
    margin-top: 2px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-indicator[data-status="active"] {
    background: #48bb78;
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.5);
}

.status-indicator[data-status="error"] {
    background: #f56565;
    box-shadow: 0 0 10px rgba(245, 101, 101, 0.5);
    animation: pulse-error 1s infinite;
}

.status-indicator[data-status="checking"] {
    background: #ed8936;
    box-shadow: 0 0 10px rgba(237, 137, 54, 0.5);
    animation: pulse-checking 1.5s infinite;
}

.status-indicator[data-status="no-key"] {
    background: #cbd5e0;
    box-shadow: none;
    animation: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes pulse-error {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes pulse-checking {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

.status-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.status-footer small {
    display: block;
    color: #718096;
    margin-bottom: 10px;
}

.refresh-status-btn {
    width: 100%;
    padding: 8px;
    background: #467C9F;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.refresh-status-btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

main {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.config-section {
    margin-bottom: 30px;
}

.api-key-section {
    margin-bottom: 25px;
}

.api-key-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

#apiKey {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

#apiKey:focus {
    outline: none;
    border-color: #467C9F;
}

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

.slider-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

#countDisplay {
    color: #467C9F;
    font-weight: bold;
    font-size: 1.2rem;
}

#emailCount {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

#emailCount::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #467C9F;
    cursor: pointer;
    transition: transform 0.2s;
}

#emailCount::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#emailCount::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #467C9F;
    cursor: pointer;
    transition: transform 0.2s;
}

.parameters-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.parameters-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.param-item {
    display: flex;
    flex-direction: column;
}

.param-item label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.param-item input,
.param-item select {
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.param-item input:focus,
.param-item select:focus {
    outline: none;
    border-color: #467C9F;
}

.rules-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #fff3e0;
    border-radius: 10px;
    border: 2px solid #ffb74d;
}

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

.rules-header h3 {
    color: #e65100;
    font-size: 1.1rem;
    margin: 0;
}

.toggle-btn {
    padding: 6px 15px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-btn:hover {
    background: #f57c00;
}

.rules-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.rules-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

#contentRules {
    width: 100%;
    padding: 12px;
    border: 2px solid #ffcc80;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    background: #fffbf5;
    resize: vertical;
    transition: border-color 0.3s;
}

#contentRules:focus {
    outline: none;
    border-color: #ff9800;
}

.save-rules-btn {
    margin-top: 10px;
    padding: 8px 20px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.save-rules-btn:hover {
    background: #467C9F;
}

.template-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #e8f5e9;
    border-radius: 10px;
    border: 2px solid #66bb6a;
}

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

.template-header h3 {
    color: #2e7d32;
    font-size: 1.1rem;
    margin: 0;
}

.template-content {
    animation: slideDown 0.3s ease;
}

.template-description {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.template-input {
    margin-bottom: 20px;
}

#templatePaste {
    width: 100%;
    padding: 12px;
    border: 2px solid #a5d6a7;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    background: #f9fdf9;
    resize: vertical;
    transition: border-color 0.3s;
    margin-bottom: 10px;
}

#templatePaste:focus {
    outline: none;
    border-color: #66bb6a;
}

.analyze-btn {
    padding: 10px 25px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.analyze-btn:hover {
    background: #467C9F;
}

.template-analysis-section {
    margin-top: 20px;
}

.analysis-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 400px;
}

.left-column, .right-column {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #c8e6c9;
}

.left-column h4, .right-column h4 {
    color: #2e7d32;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #c8e6c9;
}

#analysisResults {
    font-size: 14px;
    line-height: 1.6;
}

.content-zone {
    padding: 8px;
    margin: 5px 0;
    background: #f1f8e9;
    border-left: 3px solid #8bc34a;
    border-radius: 4px;
}

.zone-title {
    font-weight: bold;
    color: #558b2f;
    margin-bottom: 3px;
}

.zone-variable {
    color: #1976d2;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.template-preview {
    height: 100%;
}

.preview-iframe {
    width: 100%;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

.left-column {
    overflow-y: auto;
    max-height: 600px;
}

.right-column {
    overflow: hidden;
}

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

.clear-btn {
    padding: 8px 20px;
    background: #C7525B;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.clear-btn:hover {
    background: #C7525B;
}

.use-template-btn {
    padding: 8px 20px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.use-template-btn:hover {
    background: #1976d2;
}

.prompt-preview-section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f0f4ff;
    border-radius: 10px;
    border: 2px solid #467C9F;
}

.prompt-preview-section h3 {
    color: #467C9F;
    margin-bottom: 10px;
}

.pain-points-display {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #90caf9;
}

.pain-points-display h4 {
    color: #1565c0;
    margin-bottom: 10px;
    font-size: 1rem;
}

#painPointsList {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.pain-point-item {
    padding: 5px 0;
    border-bottom: 1px solid #bbdefb;
}

.pain-point-item:last-child {
    border-bottom: none;
}

.discovery-section {
    margin-bottom: 20px;
}

.discovery-prompt-container {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
}

.discovery-prompt-container h4 {
    color: #467C9F;
    margin-bottom: 10px;
    font-size: 1rem;
}

.discovery-textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #c5cae9;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: white;
    resize: vertical;
    margin-bottom: 10px;
}

.discovery-textarea:focus {
    outline: none;
    border-color: #467C9F;
}

.discover-btn {
    padding: 8px 20px;
    background: #467C9F;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 10px;
}

.discover-btn:hover {
    background: #467C9F;
}

.discover-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.discovery-results {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #c5cae9;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.6;
    color: #333;
}

#emailPromptSection {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #c5cae9;
}

.preview-description {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.prompt-preview-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.prompt-label {
    font-weight: 600;
    color: #467C9F;
    margin-bottom: 8px;
    margin-top: 15px;
}

.prompt-label:first-child {
    margin-top: 0;
}

.prompt-textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #c5cae9;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #fafbff;
    resize: vertical;
    transition: border-color 0.3s;
}

.prompt-textarea:focus {
    outline: none;
    border-color: #467C9F;
    background: white;
}

.prompt-info {
    margin-top: 15px;
    padding: 10px;
    background: #e8eaf6;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
}

.prompt-info span {
    margin-right: 10px;
}

.prompt-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.cancel-prompt-btn {
    padding: 10px 25px;
    background: #757575;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.cancel-prompt-btn:hover {
    background: #616161;
}

.submit-prompt-btn {
    padding: 10px 30px;
    background: #F8F9FA;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.submit-prompt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(92, 107, 192, 0.3);
}

.submit-prompt-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.editor-section {
    margin-bottom: 25px;
    padding: 25px;
    background: #F8F9FA;
    border-radius: 12px;
    border: 3px solid #2196f3;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.15);
}

.editor-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.variable-panel {
    width: 280px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 2px solid #e3f2fd;
    max-height: 800px;
    overflow-y: auto;
    position: sticky;
    top: 20px;
}

.variable-panel h4 {
    margin: 0 0 15px 0;
    color: #1976d2;
    font-size: 1.1rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e3f2fd;
}

.variable-category {
    margin-bottom: 20px;
}

.variable-category h5 {
    margin: 0 0 10px 0;
    color: #555;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.variable-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.variable-chip {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    background: #F8F9FA;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #1976d2;
    font-weight: bold;
    position: relative;
}

.variable-chip:hover {
    background: #F8F9FA;
    border-color: #2196f3;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.variable-chip:active {
    transform: translateX(1px);
    box-shadow: 0 1px 4px rgba(33, 150, 243, 0.3);
}

.variable-chip .var-desc {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 10px;
    color: #666;
    font-weight: normal;
    margin-top: 2px;
}

.variable-chip::after {
    content: '← Click to insert';
    position: absolute;
    right: -80px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #999;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
}

.variable-chip:hover::after {
    opacity: 1;
}

.editor-wrapper {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid #ddd;
}

/* Scrollbar styling for variable panel */
.variable-panel::-webkit-scrollbar {
    width: 6px;
}

.variable-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.variable-panel::-webkit-scrollbar-thumb {
    background: #90caf9;
    border-radius: 3px;
}

.variable-panel::-webkit-scrollbar-thumb:hover {
    background: #64b5f6;
}

.editor-section h3 {
    margin-bottom: 15px;
    color: #1976d2;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.editor-section h3::before {
    content: "✉️";
    font-size: 1.6rem;
}

.editor-description {
    margin-bottom: 15px;
    color: #666;
    font-size: 0.9rem;
}

#emailEditor {
    min-height: 500px;
    background: white;
    border: 2px solid #90caf9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.editor-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.placeholder-btn, .preview-btn, .save-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.placeholder-btn {
    background: #ff9800;
    color: white;
}

.placeholder-btn:hover {
    background: #f57c00;
}

.preview-btn {
    background: #9c27b0;
    color: white;
}

.preview-btn:hover {
    background: #7b1fa2;
}

.save-btn {
    background: #4caf50;
    color: white;
}

.save-btn:hover {
    background: #467C9F;
}

.clear-btn {
    padding: 8px 16px;
    background: #C7525B;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: #C7525B;
}

/* CKEditor 5 Custom Styles */
.ck-editor__editable {
    min-height: 500px;
    max-height: 800px;
}

.ck-toolbar {
    flex-wrap: wrap !important;
}

.ck.ck-toolbar.ck-toolbar_grouping > .ck-toolbar__items {
    flex-wrap: wrap !important;
}

/* Hide CKEditor powered by message */
.ck-powered-by {
    display: none !important;
}

.ck.ck-balloon-panel.ck-powered-by-balloon {
    display: none !important;
}

/* Also hide in the editor content if it appears */
.ck-content .ck-powered-by {
    display: none !important;
}

/* Hide any powered by elements */
[class*="powered-by"] {
    display: none !important;
}

/* Admin button styles */
.admin-btn:hover {
    background: #374151 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Font Settings Modal */
.font-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.font-settings-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.font-settings-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.font-settings-header h3 {
    margin: 0;
    color: #1f2937;
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #1f2937;
}

.font-settings-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.font-setting-group {
    margin-bottom: 15px;
}

.font-setting-group label {
    display: block;
    margin-bottom: 5px;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
}

.font-setting-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.font-setting-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Style each font option to display in its actual font */
#fontFamily option {
    padding: 8px;
    font-size: 14px;
}

#fontFamily option[value=""] {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#fontFamily option[value="Arial, sans-serif"] {
    font-family: Arial, sans-serif;
}

#fontFamily option[value="'Helvetica Neue', Helvetica, sans-serif"] {
    font-family: 'Helvetica Neue', Helvetica, sans-serif;
}

#fontFamily option[value="Georgia, serif"] {
    font-family: Georgia, serif;
}

#fontFamily option[value="'Times New Roman', Times, serif"] {
    font-family: 'Times New Roman', Times, serif;
}

#fontFamily option[value="'Courier New', Courier, monospace"] {
    font-family: 'Courier New', Courier, monospace;
}

#fontFamily option[value="Verdana, Geneva, sans-serif"] {
    font-family: Verdana, Geneva, sans-serif;
}

#fontFamily option[value="'Trebuchet MS', sans-serif"] {
    font-family: 'Trebuchet MS', sans-serif;
}

#fontFamily option[value="'Lucida Sans', Geneva, sans-serif"] {
    font-family: 'Lucida Sans', Geneva, sans-serif;
}

#fontFamily option[value="Tahoma, Geneva, sans-serif"] {
    font-family: Tahoma, Geneva, sans-serif;
}

#fontFamily option[value="'Segoe UI', Tahoma, sans-serif"] {
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.size-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-input-group input {
    flex: 1;
}

.size-input-group span {
    color: #6b7280;
    font-size: 14px;
}

.color-input-group {
    display: flex;
    gap: 8px;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 38px;
    padding: 4px;
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
}

.preview-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.font-preview {
    padding: 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #f9fafb;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.font-settings-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.reset-btn {
    padding: 10px 20px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.reset-btn:hover {
    background: #4b5563;
}

.apply-btn {
    padding: 10px 30px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.apply-btn:hover {
    background: #4f46e5;
}

/* Updated Variable Chip Styles */
.variable-chip {
    position: relative;
    padding-right: 30px;
}

.variable-chip .settings-icon {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.variable-chip:hover .settings-icon {
    opacity: 1;
}

.variable-chip .settings-icon:hover {
    background: rgba(99, 102, 241, 0.2);
}

.variable-chip .settings-icon::before {
    content: "⚙";
    font-size: 12px;
    color: #6366f1;
}

.variable-chip.has-styles {
    background: #F8F9FA;
    border: 1px solid #c7d2fe;
}

.variable-chip.has-styles .var-desc {
    font-weight: 500;
}

.ck-content {
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

/* Style variables in the editor without inline styles */
.ck-content [data-variable],
.ck-content .variable {
    background: #e3f2fd;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: bold;
    color: #1976d2;
    font-family: monospace;
}

.ck-content .placeholder {
    background: #ffe082;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-weight: bold;
    color: #f57c00;
}

/* Variable Modal Styles */
.variable-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.variable-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.variable-modal-content {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 25px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.variable-modal-content h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.3rem;
}

.variable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.variable-item {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.variable-item:hover {
    background: #f0f7ff;
    border-color: #2196f3;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.variable-item strong {
    display: block;
    color: #1976d2;
    font-family: monospace;
    font-size: 14px;
    margin-bottom: 5px;
}

.variable-item small {
    color: #666;
    font-size: 12px;
}

.variable-close-btn {
    padding: 10px 20px;
    background: #757575;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.variable-close-btn:hover {
    background: #616161;
}

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

.prompt-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

#promptInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

#promptInput:focus {
    outline: none;
    border-color: #467C9F;
}

.generate-btn {
    width: 100%;
    padding: 15px;
    background: #F8F9FA;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

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

.generate-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.progress-section {
    margin: 30px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: #F8F9FA;
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-weight: 600;
    color: #555;
}

.results-section {
    margin-top: 40px;
}

.results-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.email-grid {
    display: grid;
    gap: 20px;
}

.email-card {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #467C9F;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.email-subject {
    padding: 12px 15px;
    background: #f0f4f8;
    border-left: 4px solid #3b82f6;
    margin: 10px 0;
    font-weight: 600;
    color: #1e40af;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.email-subject:hover {
    background: #e0e7ff;
    border-left-color: #2563eb;
}

.email-subject .subject-label {
    color: #64748b;
    font-weight: normal;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 4px;
}

.email-subject .subject-text {
    margin-top: 4px;
    font-size: 16px;
    line-height: 1.4;
}

.email-number {
    font-weight: bold;
    color: #467C9F;
    font-size: 1.1rem;
}

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

.copy-btn {
    padding: 5px 12px;
    background: #467C9F;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #5a67d8;
}

.copy-btn.copied {
    background: #48bb78;
}

.email-content {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #333;
}

.html-preview {
    background: white;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 400px;
    overflow-y: auto;
}

.html-preview * {
    white-space: normal;
}

.zone-details {
    margin: 3px 0;
    font-size: 13px;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.zone-details:hover {
    background: #f0f8f0;
}

.zone-details.selected {
    background: #e3f2fd;
    border-left: 3px solid #0066ff;
    padding-left: 8px;
}

.zone-actions {
    margin-top: 8px;
    gap: 5px;
    display: none;
}

.zone-action-btn {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.zone-action-btn:hover {
    background: #f5f5f5;
}

.zone-action-btn.rename {
    color: #0066ff;
    border-color: #0066ff;
}

.zone-action-btn.rename:hover {
    background: #e3f2fd;
}

.zone-action-btn.delete {
    color: #ff0000;
    border-color: #ff0000;
}

.zone-action-btn.delete:hover {
    background: #ffebee;
}

.zone-action-btn.edit-tags {
    color: #9c27b0;
    border-color: #9c27b0;
}

.zone-action-btn.edit-tags:hover {
    background: #f3e5f5;
}

/* Zone tags styling */
.zone-main-info {
    margin-bottom: 8px;
}

.zone-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}

.zone-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 12px;
    background: #e0e0e0;
    color: #333;
}

.zone-tag-type {
    background: #e3f2fd;
    color: #1976d2;
}

.zone-tag-type.zone-tag-image {
    background: #fff3e0;
    color: #f57c00;
}

.zone-tag-type.zone-tag-cta {
    background: #e8f5e9;
    color: #2e7d32;
}

.zone-tag-type.zone-tag-footer {
    background: #f3e5f5;
    color: #6a1b9a;
}

.zone-tag-type.zone-tag-header {
    background: #e1f5fe;
    color: #0277bd;
}

.zone-tag-type.zone-tag-social {
    background: #fce4ec;
    color: #c2185b;
}

.zone-tag-type.zone-tag-logo {
    background: #e0f2f1;
    color: #00695c;
}

.zone-tag-type.zone-tag-signature {
    background: #efebe9;
    color: #5d4037;
}

.zone-tag-type.zone-tag-body {
    background: #eceff1;
    color: #455a64;
}

.zone-tag-excluded {
    background: #ffebee;
    color: #c62828;
}

.zone-details.zone-excluded {
    opacity: 0.7;
    background: #f5f5f5;
}

/* Modal styles */
.zone-tags-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    max-width: 500px;
    width: 90%;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

.modal-content {
    padding: 25px;
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
}

.tag-section {
    margin-bottom: 20px;
}

.tag-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.tag-options {
    display: flex;
    gap: 20px;
}

.tag-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 10px;
}

.tag-options label,
.tag-options-grid label {
    display: flex;
    align-items: center;
    font-weight: normal;
    cursor: pointer;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s;
}

.tag-options-grid label:hover {
    background: #f5f5f5;
    border-color: #467C9F;
}

.tag-options input[type="radio"],
.tag-options-grid input[type="radio"] {
    margin-right: 8px;
}

.tag-section input[type="checkbox"] {
    margin-right: 8px;
}

.tag-section input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.tag-help {
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.save {
    background: #4caf50;
    color: white;
}

.modal-btn.save:hover {
    background: #467C9F;
}

.modal-btn.cancel {
    background: #f5f5f5;
    color: #666;
}

.modal-btn.cancel:hover {
    background: #e0e0e0;
}

.add-zone-container {
    margin-bottom: 15px;
    padding: 10px;
    background: #f0f4ff;
    border-radius: 6px;
    border: 2px dashed #467C9F;
}

.add-zone-btn {
    width: 100%;
    padding: 10px;
    background: #467C9F;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.add-zone-btn:hover {
    background: #467C9F;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.3);
}

.zone-desc {
    color: #666;
}

.zone-element {
    color: #999;
    font-style: italic;
}

.error-message {
    padding: 15px;
    background: #fed7d7;
    color: #c53030;
    border-radius: 8px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    main {
        padding: 20px;
    }
    
    /* Hide sidebar on mobile */
    .api-status-sidebar {
        display: none;
    }
    
    body {
        padding-left: 20px;
    }
    
    .container.with-sidebar {
        margin-left: 0;
    }
}