:root {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #252526;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --accent-primary: #00CEC9;
    --accent-secondary: #81ECEC;
    --accent-hover: #00b5b0;
    --border-color: #333333;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-family);
    height: 100vh;
    overflow: hidden;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Toolbar */
.toolbar {
    height: 60px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--accent-primary);
}

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

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

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

.btn-danger {
    background-color: transparent;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.btn-danger:hover {
    background-color: rgba(255, 107, 107, 0.1);
}

.divider {
    width: 1px;
    height: 24px;
    background-color: var(--border-color);
    margin: 0 8px;
}

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

.sidebar {
    width: 250px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.right-sidebar {
    border-left: 1px solid var(--border-color);
    border-right: none;
}

.sidebar h3 {
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

/* Draggable Items */
.components-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.draggable-item {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: grab;
    transition: all 0.2s ease;
}

.draggable-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.draggable-item i {
    font-size: 1.5rem;
    color: var(--accent-secondary);
}

.draggable-item span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Canvas */
.canvas-container {
    flex: 1;
    background-color: #333; /* Canvas Background Area */
    display: flex;
    justify-content: center;
    padding: 40px;
    overflow-y: auto;
}

.email-canvas {
    width: 600px;
    min-height: 800px;
    background-color: #ffffff; /* Email Body Background */
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    /* Default email styles for consistent editing */
    font-family: Arial, sans-serif;
    color: #333;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
    pointer-events: none;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Blocks on Canvas */
.canvas-block {
    position: relative;
    border: 2px solid transparent; /* Prepare for selection border */
    cursor: pointer;
    transition: border-color 0.2s;
    background: transparent;
}

.canvas-block:hover {
    border-color: var(--accent-secondary); /* Highlight on hover */
    /* Add dotted line to indicate selectable */
    border-style: dashed;
}

.canvas-block.selected {
    border-color: var(--accent-primary); /* Selection color */
    border-style: solid;
    z-index: 10;
}

.block-actions {
    position: absolute;
    top: -30px;
    right: 0;
    background-color: var(--accent-primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    display: none;
    padding: 4px;
    gap: 4px;
}

.canvas-block.selected .block-actions {
    display: flex;
}

.block-action-btn {
    background: none;
    border: none;
    color: #121212;
    cursor: pointer;
    padding: 4px;
    font-size: 0.8rem;
}

.block-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Properties Panel */
.properties-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.property-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.property-input, .property-select, .property-textarea {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
}

.property-input:focus, .property-select:focus, .property-textarea:focus {
    border-color: var(--accent-primary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 800px; /* Default max-width */
    height: 80%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

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

.modal-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
}

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

.modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    background-color: #121212; /* Dark background for modal content */
}

/* Templates Grid */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
}

.template-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.template-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
}

.template-preview {
    height: 120px;
    background-color: #333;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

/* Preview Modal Specifics */
.preview-controls {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.btn-icon.active, .btn-icon:hover {
    background-color: var(--bg-tertiary);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.preview-frame-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    transition: width 0.3s ease;
}

.preview-frame-container.mobile {
    width: 375px; /* Mobile width */
}

.preview-frame-container.desktop {
    width: 100%;
}

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

/* Dragging Placeholder */
.drop-indicator {
    height: 4px;
    background-color: var(--accent-primary);
    margin: 4px 0;
    border-radius: 2px;
    pointer-events: none;
}
