.button-label {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Ensure text sizing doesn't affect button dimensions */
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    height: 100%;
    width: 100%;
    text-align: center;
    vertical-align: middle;
    padding: 4px;
    box-sizing: border-box;
}
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #1a1a1a;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.editor-header {
    background-color: #111113;
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    height: 38px;
    flex-shrink: 0;
}

.editor-logo {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #38B6FF, #1A8FE3);
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 11px;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    font-size: 14px;
    font-weight: 700;
    color: #38B6FF;
}

.page-title {
    color: #888;
    font-size: 12px;
}

a.logo {
    text-decoration: none;
    color: #38B6FF;
}

a.logo:hover {
    opacity: 0.9;
}

.header-nav-mypages {
    text-decoration: none;
    color: #71717a;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,.1);
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-nav-mypages:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.05);
}

.header-nav-mypages i {
    font-size: 10px;
    opacity: 0.85;
}

.header-right {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-items: center;
}

.header-toolbar-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 4px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: #38B6FF;
    color: white;
}

.btn-primary:hover {
    background-color: #2196F3;
}

.btn-secondary {
    background-color: rgba(255,255,255,.06);
    color: #a1a1aa;
    border: 1px solid rgba(255,255,255,.1);
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,.1);
    color: #fafafa;
}

.btn-small {
    padding: 3px 8px;
    font-size: 10px;
}


/* Main Editor Layout */
.editor-container {
    display: flex;
    height: calc(100vh - 38px);
    position: relative;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: #2a2a2a;
    border-right: 1px solid #3a3a3a;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #3a3a3a;
}

.sidebar-header h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 12px;
    color: #888;
}

.elements-list {
    padding: 20px;
    flex-grow: 1;
}

.element-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background-color: #333;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
}

.element-item:hover {
    background-color: #3a3a3a;
    transition: background-color 0.2s ease;
}

.element-item:active {
    cursor: grabbing;
}

.element-item i {
    color: #38B6FF;
    width: 16px;
}

.element-item span {
    font-size: 14px;
    font-weight: 500;
}

/* ENHANCED: Large Floating Properties Panel */
.properties-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 480px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 120px);
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.properties-panel.visible {
    opacity: 1;
    pointer-events: all;
}

.properties-header {
    padding: 20px;
    border-bottom: 1px solid #3a3a3a;
    background-color: #252525;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.properties-header h4 {
    font-size: 16px;
    color: #38B6FF;
    font-weight: 600;
}

.close-properties {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.close-properties:hover {
    color: #38B6FF;
    background-color: rgba(56, 182, 255, 0.1);
}

.properties-content {
    padding: 24px;
}

/* Property Groups */
.property-group {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

/* Properties UI: compact "cards" for complex groups (border/shadow/margins) */
.control-card {
    background: linear-gradient(180deg, #2b2b2b 0%, #262626 100%);
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 12px;
}

.control-card .property-group {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.control-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.control-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #fff;
}

.control-title i {
    color: #38B6FF;
}

.control-card-body {
    display: block;
}

.control-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.control-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Toggle switch (replaces ugly browser checkboxes) */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch-ui {
    width: 44px;
    height: 26px;
    background: #3a3a3a;
    border: 1px solid #4a4a4a;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex: 0 0 auto;
}

.switch-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e5e7eb;
    transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .switch-ui {
    background: rgba(56, 182, 255, 0.35);
    border-color: rgba(56, 182, 255, 0.8);
}

.switch input:checked + .switch-ui::after {
    transform: translateX(18px);
    background: #fff;
}

.switch-label {
    font-weight: 700;
    color: #e5e7eb;
    font-size: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

/* Dot-style toggle (stationary circle; turns blue when enabled) */
.switch.switch--dot {
    gap: 0;
}

.switch.switch--dot .switch-ui {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: rgba(255,255,255,0.04);
    border: 2px solid rgba(229, 231, 235, 0.60);
    box-shadow:
        0 0 0 2px rgba(0,0,0,0.22) inset,
        0 1px 0 rgba(255,255,255,0.08);
}

.switch.switch--dot .switch-ui::after {
    display: none;
}

.switch.switch--dot input:checked + .switch-ui {
    background: #38B6FF;
    border-color: rgba(56, 182, 255, 0.95);
    box-shadow:
        0 0 0 4px rgba(56, 182, 255, 0.16),
        0 0 0 2px rgba(0,0,0,0.22) inset;
}

/* Slider row with numeric value */
.slider-row {
    display: grid;
    grid-template-columns: 1fr 86px;
    gap: 10px;
    align-items: center;
}

.slider-row input[type="number"] {
    padding: 10px 10px;
}

/* Color picker row (swatch + hex) */
.color-row {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 10px;
    align-items: center;
}

.color-swatch {
    width: 52px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.06) inset,
        0 0 0 1px rgba(0,0,0,0.25);
}

.color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 10px;
}

.color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 10px;
}

/* Make hex inputs feel "code-like" and aligned with the picker */
.color-row .property-input,
.color-controls-custom input[type="text"],
.property-input[id$="-hex"] {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    letter-spacing: 0.01em;
}

/* Margin cross layout */
.margin-cross {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px;
    align-items: center;
}

.margin-cell {
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.margin-label {
    font-size: 12px;
    color: #cbd5e1;
    font-weight: 700;
}

.margin-cell.top { grid-column: 2; grid-row: 1; }
.margin-cell.right { grid-column: 3; grid-row: 2; }
.margin-cell.bottom { grid-column: 2; grid-row: 3; }
.margin-cell.left { grid-column: 1; grid-row: 2; }

.margin-center {
    grid-column: 2;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #3a3a3a;
    border-radius: 10px;
    height: 46px;
}

.property-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.property-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.property-value {
    font-size: 14px;
    color: #fff;
    background-color: #333;
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid #444;
}

/* Input Controls */
.property-input {
    width: 100%;
    background-color: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.property-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.2);
}

.property-textarea {
    width: 100%;
    background-color: #333;
    border: 1px solid #444;
    color: #fff;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    min-height: 80px;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s ease;
}

.property-textarea:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.2);
}

/* Alignment Controls */
.alignment-controls {
    display: flex;
    gap: 6px;
}

.alignment-btn {
    background-color: #333;
    border: 1px solid #444;
    color: #888;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
}

.alignment-btn:hover,
.alignment-btn.active {
    background-color: #38B6FF;
    border-color: #38B6FF;
    color: white;
}

/* Color Controls */
.color-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.color-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.05);
    border-color: #38B6FF;
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.3);
}

.color-btn:active {
    transform: scale(0.95);
}

/* Size Controls */
.size-controls {
    display: flex;
    gap: 8px;
}

.size-btn {
    background-color: #333;
    border: 1px solid #444;
    color: #888;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    flex: 1;
    text-align: center;
}

.size-btn:hover,
.size-btn.active {
    background-color: #38B6FF;
    border-color: #38B6FF;
    color: white;
}

/* Spacing Controls */
.spacing-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.spacing-btn {
    background-color: #333;
    border: 1px solid #444;
    color: #888;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.spacing-btn:hover,
.spacing-btn.active {
    background-color: #38B6FF;
    border-color: #38B6FF;
    color: white;
}

.spacing-btn i {
    font-size: 12px;
}

/* File Upload Area */
.file-upload-area {
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    background-color: #333;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #38B6FF;
    background-color: rgba(56, 182, 255, 0.05);
}

.file-upload-area i {
    font-size: 32px;
    color: #38B6FF;
    margin-bottom: 12px;
}

.file-upload-area p {
    color: #888;
    font-size: 14px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background-color: #444;
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-switch.active {
    background-color: #38B6FF;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle-switch.active::after {
    transform: translateX(24px);
}

/* Toggle Group for Contact Forms */
.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toggle-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.toggle-item span {
    font-size: 14px;
    color: #ccc;
}

/* Delete Element Button */
.delete-element-btn {
    width: 100%;
    background-color: #d32f2f;
    border: 1px solid #b71c1c;
    color: white;
    padding: 14px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    margin-top: 20px;
}

.delete-element-btn:hover {
    background-color: #b71c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.3);
}

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

/* Canvas Container - Carrd-style full-width system */
.canvas-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: #1a1a1a;
    overflow: hidden;
    height: 100%;
    max-height: calc(100vh - 40px);
}


.device-toggle {
    display: flex;
    gap: 4px;
}

.device-btn {
    padding: 8px 12px;
    background-color: #333;
    border: 1px solid #444;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.device-btn.active,
.device-btn:hover {
    background-color: #38B6FF;
    color: white;
    border-color: #38B6FF;
}

/* Canvas Wrapper - Carrd-style scrolling */
.canvas-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    display: flex;
    justify-content: center;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    scroll-behavior: smooth;
    position: relative;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 60px !important;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

/* Canvas - Carrd-style centered content container */
.canvas {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    background-color: transparent;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    color: #333;
    padding: 0 !important;
    margin: 0 auto;
    height: auto;
    display: block;
    overflow: visible;
    max-height: none;
}

/* ─── Page element: full-width block wrapper ─── */
.page-element {
    position: relative;
    display: block;
    width: 100%;
    padding: 0 !important;
    margin: 0 !important;
    border: none;
    border-radius: 0;
    background: transparent;
    min-height: auto;
    cursor: default;
    outline: none;
    transition: outline-color 0.15s ease, box-shadow 0.15s ease;
}

.page-element:hover {
    outline: 1px solid rgba(56, 182, 255, 0.2);
    outline-offset: 0px;
}
.page-element[data-type="image"]:hover {
    outline: none !important;
    outline-offset: 0 !important;
}

.page-element.selected {
    outline: 2px solid #38B6FF;
    outline-offset: 0px;
    box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.08);
}

/* Sections are directly draggable */

/* Carrd-style Hero Section */
.hero-section {
    text-align: center;
    background: linear-gradient(135deg, #38B6FF 0%, #1A8FE3 100%);
    color: white;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
    margin: 0 !important;
    padding: 120px 40px !important; /* Carrd-style generous padding */
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.hero-section h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 30px !important; /* Good spacing after title */
    line-height: 1.2;
}

.hero-section p {
    font-size: 18px;
    margin-bottom: 60px !important; /* Large spacing before CTA - Carrd style */
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Carrd-style Features Section */
.features-section {
    background-color: #f8f9fa;
    border-radius: 0;
    margin: 0 !important;
    padding: 120px 40px !important; /* Generous Carrd-style padding */
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.features-section h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 60px !important; /* Large spacing after heading */
    color: #333;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px !important; /* Generous gaps between features */
    max-width: 1000px;
    margin: 0 auto;
}

.feature-item {
    text-align: center;
    padding: 40px 30px !important; /* Generous internal padding */
    background: white;
    border-radius: 12px; /* Carrd-style rounded corners */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); /* Subtle shadow */
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.feature-item i {
    font-size: 48px;
    color: #38B6FF;
    margin-bottom: 30px !important; /* Good spacing after icon */
}

.feature-item h3 {
    font-size: 24px;
    margin-bottom: 20px !important; /* Spacing after title */
    color: #333;
    font-weight: 700;
}

.feature-item p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* Carrd-style CTA Section */
.cta-section {
    background-color: #38B6FF;
    color: white;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
    margin: 0 !important;
    padding: 120px 40px !important; /* Generous padding */
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.cta-section h2 {
    font-size: 36px;
    margin-bottom: 20px !important; /* Good spacing between title and subtitle */
    font-weight: 700;
}

.cta-section p {
    font-size: 18px;
    margin-bottom: 60px !important; /* Large spacing before button - key Carrd pattern */
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Carrd-style Button Styling */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 18px 40px;
    background-color: white;
    color: #38B6FF;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
    filter: brightness(1.08);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hero-section .cta-button {
    color: white;
    border: 2px solid white;
    backdrop-filter: blur(10px);
}

.hero-section .cta-button:not(.sub-element-selected):hover {
    filter: brightness(1.15);
}

/* Container page-elements are invisible pass-throughs.
   display:block prevents the generic flex/align-items:center from shrinking content. */
/* Standalone containers (blank canvas) — visible with rounded boundaries */
.page-element[data-type="container"] {
    display: block;
    position: relative;
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    padding: 24px;
    margin: 8px 0;
    transition: border-color 0.2s ease;
}
.page-element[data-type="container"]:hover {
    border-color: rgba(56, 182, 255, 0.3);
}

/* Container drag handle (always visible, side-mounted) */
.page-element[data-type="container"] > .container-side-drag-handle {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid rgba(56, 182, 255, 0.45);
    background: rgba(31, 41, 55, 0.92);
    color: rgba(191, 219, 254, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 3;
    opacity: 0.88;
    transition: opacity 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    touch-action: none;
}

.page-element[data-type="container"] > .container-side-drag-handle:hover {
    opacity: 1;
    background: rgba(56, 182, 255, 0.26);
    box-shadow: 0 4px 14px rgba(56, 182, 255, 0.30);
}

.page-element[data-type="container"] > .container-side-drag-handle:active {
    cursor: grabbing;
}

/* Template wrappers stay clean while still draggable from blank space */
.template-container .page-element[data-type="container"] > .container-side-drag-handle {
    left: 6px;
    height: 36px;
}

/* Loose elements on the page shrink to fit content, not full-width bands */
.template-container > .page-element:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]):not([data-type="list"]) {
    width: fit-content !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    overflow: visible;
}
/* Block children inside loose elements should also shrink-wrap */
.template-container > .page-element[data-type="text"] > p,
.template-container > .page-element[data-type="text"] > .editable-text {
    display: inline-block;
}

/* Loose elements: suppress wrapper outline — hug the content instead */
.template-container > .page-element:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]):hover,
.template-container > .page-element:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]).selected {
    outline: none !important;
    box-shadow: none !important;
}
/* Hide drag pill on all loose (non-container) elements — show as tiny dot on hover only */
.template-container > .page-element:not([data-type="container"]) > .container-side-drag-handle {
    opacity: 0 !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    left: -24px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 8px !important;
}
.template-container > .page-element:not([data-type="container"]):hover > .container-side-drag-handle {
    opacity: 0.5 !important;
}
.template-container > .page-element:not([data-type="container"]) > .container-side-drag-handle:hover {
    opacity: 1 !important;
}
.template-container > .page-element[data-type="text"]:hover > .editable-text,
.template-container > .page-element[data-type="text"]:hover > p {
    outline: 2px dashed rgba(56, 182, 255, 0.3);
    outline-offset: 4px;
    border-radius: 6px;
}
.template-container > .page-element[data-type="text"].selected > .editable-text,
.template-container > .page-element[data-type="text"].selected > p {
    outline: 3px solid #38B6FF;
    outline-offset: 4px;
    border-radius: 6px;
}
.template-container > .page-element[data-type="button"]:hover > .cta-button {
    outline: 2px dashed rgba(56, 182, 255, 0.3);
    outline-offset: 4px;
    border-radius: 50px;
}
.template-container > .page-element[data-type="button"].selected > .cta-button {
    outline: 3px solid #38B6FF;
    outline-offset: 4px;
    border-radius: 50px;
}

/* Inside section containers: same shrink-wrap + horizontal centering as top-level loose elements */
.template-container .container-layout > .container-item:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]):not([data-type="list"]),
.template-container .container-column > .container-item:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]):not([data-type="list"]) {
    width: fit-content !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    overflow: visible;
}
.template-container .container-item[data-type="text"] > p,
.template-container .container-item[data-type="text"] > .editable-text {
    display: inline-block;
}
.template-container .container-item[data-type="text"]:hover > .editable-text,
.template-container .container-item[data-type="text"]:hover > p {
    outline: 2px dashed rgba(56, 182, 255, 0.3);
    outline-offset: 4px;
    border-radius: 6px;
}
.template-container .container-item[data-type="text"].selected > .editable-text,
.template-container .container-item[data-type="text"].selected > p {
    outline: 3px solid #38B6FF;
    outline-offset: 4px;
    border-radius: 6px;
}
.template-container .container-item[data-type="button"]:hover > .cta-button {
    outline: 2px dashed rgba(56, 182, 255, 0.3);
    outline-offset: 4px;
    border-radius: 50px;
}
.template-container .container-item[data-type="button"].selected > .cta-button {
    outline: 3px solid #38B6FF;
    outline-offset: 4px;
    border-radius: 50px;
}
.template-container .container-item:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]):hover,
.template-container .container-item:not([data-type="container"]):not([data-type="features"]):not([data-type="pricing"]):not([data-type="contact"]):not([data-type="table"]).selected {
    outline: none !important;
    box-shadow: none !important;
}

/* (Drag handle for loose elements is controlled by the unified rule above) */

/* Inside templates, containers are invisible section wrappers */
.template-container .page-element[data-type="container"] {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
}

.container-layout {
    width: 100%;
    background-color: transparent;
    border: none;
    min-height: auto;
    margin: 0;
    padding: 80px 40px;
    position: relative;
}

/* Empty state hover */
.container-empty-state:hover {
    border-color: rgba(56, 182, 255, 0.5) !important;
    background: rgba(56, 182, 255, 0.03);
}

/* Container items — disabled, all container adding/moving code removed */

/* Multi-column Layouts */
.container-layout[data-container-type="two-column"],
.container-layout[data-container-type="three-column"],
.container-layout[data-container-type="four-column"] {
    display: grid;
    align-items: start;
    gap: 32px !important;
    padding: 80px 40px !important;
}

.container-layout[data-container-type="two-column"] {
    grid-template-columns: 1fr 1fr;
}

.container-layout[data-container-type="three-column"] {
    grid-template-columns: repeat(3, 1fr);
}

.container-layout[data-container-type="four-column"] {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {
    .container-layout[data-container-type="two-column"],
    .container-layout[data-container-type="three-column"],
    .container-layout[data-container-type="four-column"] {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }
}

/* Carrd-style Mobile Responsive */
@media (max-width: 768px) {
    .canvas-wrapper {
        padding: 20px;
    }
    
    .canvas {
        max-width: none;
        box-shadow: none;
    }
    
    /* Mobile section padding */
    .hero-section,
    .features-section,
    .cta-section {
        padding: 80px 20px !important;
    }
    
    .container-layout {
        padding: 60px 20px !important;
    }
    
    /* Mobile typography */
    .hero-section h1 {
        font-size: 32px !important;
        margin-bottom: 25px !important;
    }
    
    .hero-section p,
    .cta-section p {
        font-size: 16px !important;
        margin-bottom: 40px !important;
    }
    
    .features-section h2,
    .cta-section h2 {
        font-size: 28px !important;
        margin-bottom: 40px !important;
    }
    
    /* Mobile column layouts */
    .container-layout[data-container-type="two-column"],
    .container-layout[data-container-type="three-column"],
    .container-layout[data-container-type="four-column"] {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    .feature-item {
        padding: 30px 20px !important;
    }
}

/* (Page element base styles consolidated above) */

.page-element.selected {
    border-color: #38B6FF;
}

/* Hero Section */
.hero-section {
    text-align: center;
    background: linear-gradient(135deg, #38B6FF 0%, #1A8FE3 100%);
    color: white;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
    margin: 0 !important;
    padding: 100px 40px !important;
    display: block;
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.hero-section h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-section p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Features Section */
.features-section {
    background-color: #f8f9fa;
    border-radius: 0;
    margin: 0 !important;
    padding: 100px 40px !important;
    display: block;
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.features-section h2 {
    text-align: center;
    font-size: 36px;
    margin-bottom: 40px;
    color: #333;
}

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

.feature-item {
    text-align: center;
    padding: 20px;
}

.feature-item i {
    font-size: 48px;
    color: #38B6FF;
    margin-bottom: 20px;
}

.feature-item h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
}

.feature-item p {
    color: #666;
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    background-color: #38B6FF;
    color: white;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-radius: 0;
    margin: 0 !important;
    padding: 100px 40px !important;
    display: block;
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

.cta-section h2 {
    font-size: 36px;
    margin-bottom: 15px;
}

.cta-section p {
    font-size: 18px;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* CTA Button */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15px 30px;
    background-color: white;
    color: #38B6FF;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}

.cta-button:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.hero-section .cta-button {
    color: white;
    border: 2px solid white;
}

.hero-section .cta-button:not(.sub-element-selected):hover {
    filter: brightness(1.15);
}

/* Editable Text */
.editable-text {
    outline: none;
    position: relative;
}

.editable-text:not(.cta-button):focus {
    background-color: rgba(56, 182, 255, 0.1);
    border-radius: 2px;
}

/* Instructions Panel - ADDED: Close button support */
.instructions-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 15px;
    max-width: 280px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
}

.instructions-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

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

.instructions-content h4 {
    font-size: 14px;
    margin: 0;
    color: #38B6FF;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-instructions {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-instructions:hover {
    color: #38B6FF;
    background-color: rgba(56, 182, 255, 0.1);
}

.instructions-content ul {
    list-style: none;
}

.instructions-content li {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
    padding-left: 16px;
    position: relative;
}

.instructions-content li::before {
    content: "•";
    color: #38B6FF;
    position: absolute;
    left: 0;
}

/* ── Element reorder system ── */

.mv-bar {
    position: fixed;
    background: #38B6FF;
    border-radius: 3px;
    pointer-events: none;
    z-index: 99998;
    display: none;
    transition: top 0.06s ease, left 0.06s ease;
}
.mv-bar::before,
.mv-bar::after {
    content: '';
    position: absolute;
    width: 9px;
    height: 9px;
    background: #38B6FF;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(56,182,255,0.5);
}
.mv-bar[style*="--dot-orient: horizontal"]::before { left: -4px; top: -3px; }
.mv-bar[style*="--dot-orient: horizontal"]::after  { right: -4px; top: -3px; }
.mv-bar[style*="--dot-orient: vertical"]::before   { top: -4px; left: -3px; }
.mv-bar[style*="--dot-orient: vertical"]::after     { bottom: -4px; left: -3px; }

.mv-source {
    opacity: 0.35 !important;
    outline: none !important;
    pointer-events: none;
}

.mv-drop-target {
    outline: 2px dashed rgba(56, 182, 255, 0.5) !important;
    outline-offset: -2px;
    background: rgba(56, 182, 255, 0.04) !important;
    transition: outline 0.15s ease, background 0.15s ease;
}

body.is-dragging,
body.is-dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    cursor: grabbing !important;
}
body.is-dragging ::selection {
    background: transparent !important;
}
body.is-dragging .page-element,
body.is-dragging .container-item {
    transition: transform 0.15s ease, opacity 0.15s ease !important;
}
body.is-dragging .page-element:not(.mv-source),
body.is-dragging .container-item:not(.mv-source) {
    pointer-events: none;
}
body.is-dragging .container-side-drag-handle {
    pointer-events: auto !important;
    cursor: grabbing !important;
}

/* Drop indicator: shows where the container will land */
.container-drop-indicator {
    height: 4px;
    border-radius: 4px;
    background: linear-gradient(90deg, transparent 0%, #38B6FF 15%, #38B6FF 85%, transparent 100%);
    margin: 6px 0;
    position: relative;
    pointer-events: none;
    animation: dropBarPulse 1s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(56, 182, 255, 0.5);
}
.container-drop-indicator::before,
.container-drop-indicator::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #38B6FF;
    box-shadow: 0 0 8px rgba(56, 182, 255, 0.6);
}
.container-drop-indicator::before { left: -6px; }
.container-drop-indicator::after { right: -6px; }

@keyframes dropBarPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.element-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: grab;
    position: relative;
    overflow: hidden;
}

.element-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}

.element-item:hover::before {
    left: 100%;
}

.element-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 32px rgba(56, 182, 255, 0.2);
    border-color: #38B6FF;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.element-item:active,
.element-item.dragging {
    transform: scale(0.95) rotate(2deg);
    opacity: 0.7;
    cursor: grabbing;
    box-shadow: 0 12px 40px rgba(56, 182, 255, 0.3);
}

/* (Page element enhancements consolidated above) */

.page-element.selected:hover {
    outline: 2px solid #38B6FF;
    outline-offset: 0px;
    box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.08);
}

/* Special selection styling for image elements */
.page-element[data-type="image"].selected {
    outline: none !important;
    box-shadow: none !important;
}

/* Images: show exactly ONE selection outline, and only when selected:
   - No image uploaded => outline the frame
   - Image uploaded => outline the actual img (not the frame) */
.page-element[data-type="image"].selected .image-frame:not(:has(img.image-display[style*="display: block"])) {
    outline: 3px solid #38B6FF !important;
    outline-offset: 4px !important;
}

.page-element[data-type="image"].selected img.image-display[style*="display: block"] {
    outline: 3px solid #38B6FF !important;
    outline-offset: 4px !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
}

.page-element[data-type="image"].selected .image-frame:has(img.image-display[style*="display: block"]) {
    outline: none !important;
}

.page-element[data-type="image"] img.image-display {
    outline: none;
}

/* When image is uploaded, hide placeholder and show border on image */
.page-element[data-type="image"].selected:has(img.image-display[style*="display: block"]) .image-placeholder {
    display: none !important;
}

/* When image is displayed, keep frame outline (do not move outline to img) */

/* Remove outline from container when image is selected */
.page-element[data-type="image"].selected .image-container {
    outline: none !important;
    box-shadow: none !important;
    /* Make container fit the image exactly - no fixed size */
    width: auto !important;
    height: auto !important;
    min-width: auto !important;
    min-height: auto !important;
    max-width: none !important;
    max-height: none !important;
    /* Ensure container doesn't interfere with outline */
    padding: 0 !important;
    margin: 0 !important;
    /* Remove any background that might interfere */
    background: transparent !important;
}

/* -------------------------------------------------
   Timers: selection/hover outline should hug the timer content
   (not the full-width .carrd-timer wrapper)
------------------------------------------------- */
.page-element[data-type="timer"]:hover,
.page-element[data-type="timer"].selected {
    outline: none !important;
    box-shadow: none !important;
}

.page-element[data-type="timer"]:hover .carrd-timer .timer-row {
    outline: 2px dashed rgba(56, 182, 255, 0.3);
    outline-offset: 6px;
    border-radius: 10px;
}

.page-element[data-type="timer"].selected .carrd-timer .timer-row {
    outline: 3px solid #38B6FF;
    outline-offset: 6px;
    border-radius: 10px;
    box-shadow: 0 0 0 6px rgba(56, 182, 255, 0.1);
}

/* Note: do NOT outline the full `.carrd-timer` wrapper (it can span the full canvas width).
   We only outline the `.timer-row` so the selection hugs the actual timer content. */

/* Ensure image-element wrapper doesn't interfere
   IMPORTANT: do NOT force padding on selection (it looked like "default padding" appeared when selecting).
   Spacing should come from the element's existing inline styles / margin controls, not selection state. */
.page-element[data-type="image"].selected .image-element {
    padding: inherit;
}

/* Ensure image frame doesn't change position when selected */
.page-element[data-type="image"].selected .image-frame {
    position: relative !important;
    transform: none !important;
    transition: none !important;
}

/* New image component */
.image-frame {
    background: #808080;
    /* No default outline when deselected */
    border: none;
    border-radius: 12px;
    transition: none;
    box-shadow: none;
    position: relative;
}

/* Image border overlay (does not change image size; supports border-style) */
.image-frame::after {
    content: "";
    position: absolute;
    /* Match the image edge (frame size minus padding) */
    inset: var(--image-padding, 0px);
    pointer-events: none;
    box-sizing: border-box;
    /* Border should follow the image's rounding, not the frame's outer rounding */
    border-radius: var(--image-radius, 12px);
    /* Use outline so width grows OUTWARD from the image edge (no inside shrink) */
    outline: var(--image-border-width, 0px) var(--image-border-style, solid) var(--image-border-color, transparent);
    outline-offset: 0;
    /* Shadow belongs to the image edge, and should not imply any border */
    box-shadow: var(--image-shadow, none);
}

/* When image is displayed, make the frame background transparent (outline will go on img when selected) */
.image-frame:has(img.image-display[style*="display: block"]) {
    background: transparent !important;
    /* Do not force border off; border is controlled via image settings */
}

/* When image is displayed, the frame should be transparent */
.page-element[data-type="image"] .image-frame:has(img.image-display[style*="display: block"]) {
    background: transparent !important;
}

/* Hide placeholder when image is displayed */
.image-frame:has(img.image-display[style*="display: block"]) .image-placeholder {
    display: none !important;
}

.image-placeholder {
    color: #808080;
    text-align: center;
    cursor: pointer;
    /* Center the icon/text within the placeholder */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

/* Override color for default images to keep icon white */
.image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder {
    color: #ffffff !important;
}

.image-placeholder:hover {
    color: #808080;
}

.image-placeholder:hover .image-placeholder-icon {
    transform: none;
    box-shadow: none;
}

/* Prevent color changes on default images (no image loaded) */
.image-frame:not(:has(img.image-display[style*="display: block"])) {
    background: #808080 !important;
}

.image-frame:not(:has(img.image-display[style*="display: block"])):hover {
    background: #808080 !important;
}

.page-element[data-type="image"].selected .image-frame:not(:has(img.image-display[style*="display: block"])) {
    background: #808080 !important;
}

/* Keep icon white for default images */
.image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder {
    color: #ffffff !important;
}

.image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder:hover {
    color: #ffffff !important;
    background: transparent !important;
}

.image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder i.fas.fa-image {
    color: #ffffff !important;
}

.image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder:hover i.fas.fa-image {
    color: #ffffff !important;
}

.page-element[data-type="image"].selected .image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder {
    color: #ffffff !important;
    background: transparent !important;
}

.page-element[data-type="image"].selected .image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder i.fas.fa-image {
    color: #ffffff !important;
}

.image-frame .image-display {
    transition: none;
}

/* Simple image container hover effects */
.image-container:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Enhanced Image Slider Controls */
.property-group:has(#image-width-slider) .size-slider-container,
.property-group:has(#image-height-slider) .size-slider-container,
.property-group:has(#image-border-radius-slider) .spacing-slider-container,
.property-group:has(#image-roundness-slider) .spacing-slider-container,
.property-group:has(#image-padding-slider) .spacing-slider-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.property-group:has(#image-width-slider) .size-slider-container:hover,
.property-group:has(#image-height-slider) .size-slider-container:hover,
.property-group:has(#image-border-radius-slider) .spacing-slider-container:hover,
.property-group:has(#image-roundness-slider) .spacing-slider-container:hover,
.property-group:has(#image-padding-slider) .spacing-slider-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #38B6FF;
}

.property-group:has(#image-width-slider) .size-slider,
.property-group:has(#image-height-slider) .size-slider {
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    height: 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.property-group:has(#image-border-radius-slider) .spacing-slider,
.property-group:has(#image-roundness-slider) .spacing-slider,
.property-group:has(#image-padding-slider) .spacing-slider {
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    height: 8px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.property-group:has(#image-width-slider) .size-slider::-webkit-slider-thumb,
.property-group:has(#image-height-slider) .size-slider::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
    border: 3px solid #ffffff;
    transition: all 0.3s ease;
}

.property-group:has(#image-border-radius-slider) .spacing-slider::-webkit-slider-thumb,
.property-group:has(#image-roundness-slider) .spacing-slider::-webkit-slider-thumb,
.property-group:has(#image-padding-slider) .spacing-slider::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
    border: 3px solid #ffffff;
    transition: all 0.3s ease;
}

.property-group:has(#image-width-slider) .size-slider::-webkit-slider-thumb:hover,
.property-group:has(#image-height-slider) .size-slider::-webkit-slider-thumb:hover,
.property-group:has(#image-border-radius-slider) .spacing-slider::-webkit-slider-thumb:hover,
.property-group:has(#image-roundness-slider) .spacing-slider::-webkit-slider-thumb:hover,
.property-group:has(#image-padding-slider) .spacing-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 12px rgba(56, 182, 255, 0.4);
}

.property-group:has(#image-width-slider) .size-slider::-webkit-slider-thumb:active,
.property-group:has(#image-height-slider) .size-slider::-webkit-slider-thumb:active,
.property-group:has(#image-border-radius-slider) .spacing-slider::-webkit-slider-thumb:active,
.property-group:has(#image-roundness-slider) .spacing-slider::-webkit-slider-thumb:active,
.property-group:has(#image-padding-slider) .spacing-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
}

.property-group:has(#image-width-slider) .size-display,
.property-group:has(#image-height-slider) .size-display,
.property-group:has(#image-border-radius-slider) .spacing-display,
.property-group:has(#image-roundness-slider) .spacing-display,
.property-group:has(#image-padding-slider) .spacing-display {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 80px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.property-group:has(#image-width-slider) .size-input,
.property-group:has(#image-height-slider) .size-input,
.property-group:has(#image-border-radius-slider) .spacing-input,
.property-group:has(#image-roundness-slider) .spacing-input,
.property-group:has(#image-padding-slider) .spacing-input {
    border: none;
    background: transparent;
    font-weight: 600;
    color: #38B6FF;
    text-align: center;
    width: 60px;
}

.property-group:has(#image-width-slider) .size-unit,
.property-group:has(#image-height-slider) .size-unit,
.property-group:has(#image-border-radius-slider) .spacing-unit,
.property-group:has(#image-roundness-slider) .spacing-unit,
.property-group:has(#image-padding-slider) .spacing-unit {
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
}

.page-element.moving {
    opacity: 0.6;
    transform: rotate(1deg) scale(0.98);
    z-index: 1000;
}

/* Legacy DnD states removed — using pointer-based .mv-* system now */

.dropdown-item.dragging {
    opacity: 0.5;
    background: rgba(56, 182, 255, 0.12) !important;
}

.dropdown-item {
    cursor: grab;
}
.dropdown-item:active {
    cursor: grabbing;
}

/* Inside a loaded template, containers are invisible pass-throughs.
   Suppress hover/selection outlines so they don't double-up with
   the inner element's own selection state. */
.template-container .page-element[data-type="container"]:hover {
    outline: none !important;
    box-shadow: none !important;
}
.template-container .page-element[data-type="container"].selected {
    outline: none !important;
    box-shadow: none !important;
}

/* Template inline icon elements — keep them inline within flex rows */
.template-container .page-element[data-type="icon"] {
    display: inline-block !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    border-radius: 0 !important;
    vertical-align: middle;
}
/* Template-imported bare icons only: strip badge styling so they render
   as inline glyphs matching their original template appearance.
   User-added icons (no data-template-icon) keep full badge styling. */
.template-container .page-element[data-template-icon] .icon-element {
    display: inline-block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
}
.template-container .page-element[data-template-icon] .icon-row {
    display: inline-flex !important;
    gap: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}
.template-container .page-element[data-template-icon] .icon-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
}
.template-container .page-element[data-template-icon] .icon-glyph {
    display: inline-block !important;
}

/* ═══════════════════════════════════════════════════════════════
   TEMPLATE SELECTION OVERRIDES
   Inside templates, selection must NEVER shift content.
   These rules use high specificity to beat the many duplicate
   .sub-element-selected / .actively-editing blocks later in the file.
   ═══════════════════════════════════════════════════════════════ */

/* Base selection — covers direct .sub-element-selected hits (excludes buttons) */
.template-container .sub-element-selected:not(.cta-button):not(button),
.template-container .editable-text:not(.cta-button):focus,
.template-container .editable-text:not(.cta-button).actively-editing,
.template-container .actively-editing:not(.cta-button),
/* High-specificity — beats .page-element.selected .sub-element-selected (0,3,0) */
.template-container .page-element.selected .sub-element-selected:not(.cta-button):not(button),
.template-container .page-element .sub-element-selected:not(.cta-button):not(button),
.template-container .container-item.selected .sub-element-selected:not(.cta-button):not(button),
.template-container .page-element .editable-text:not(.cta-button):focus,
.template-container .page-element .actively-editing:not(.cta-button),
/* Gradient text elements */
.template-container .editable-text:not(.cta-button).sub-element-selected[data-gradient-enabled="true"],
/* Focus states */
.template-container .sub-element-selected:not(.cta-button):not(button):focus,
.template-container .sub-element-selected:not(.cta-button):not(button)[contenteditable]:focus {
    position: static !important;
    background-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    animation: none !important;
    transform: none !important;
    z-index: auto !important;
    border-radius: inherit !important;
    outline: 2px solid rgba(56, 182, 255, 0.5) !important;
    outline-offset: 1px !important;
}
/* Buttons keep their native styling when selected inside templates */
.template-container .cta-button.sub-element-selected,
.template-container .page-element.selected .cta-button.sub-element-selected,
.template-container .container-item.selected .cta-button.sub-element-selected {
    outline: 2px solid rgba(56, 182, 255, 0.5) !important;
    outline-offset: 1px !important;
}
/* Preserve the element's natural width inside templates — never override it.
   Using fit-content here would break grid/flex item sizing. */
/* Kill ALL pseudo-element badges inside templates */
.template-container .sub-element-selected::after,
.template-container .sub-element-selected::before,
.template-container .actively-editing::before,
.template-container .actively-editing::after,
.template-container .page-element.selected .sub-element-selected::after,
.template-container .page-element.selected .sub-element-selected::before,
.template-container .container-item.selected .sub-element-selected::after,
.template-container .container-item.selected .sub-element-selected::before,
.template-container .container-item:has(.sub-element-selected)::before {
    display: none !important;
    content: none !important;
}
/* Never dim siblings inside templates */
.template-container .page-element.selected > *:not(.sub-element-selected),
.template-container .container-item.selected > *:not(.sub-element-selected),
.template-container .page-element.selected > * {
    opacity: 1 !important;
}
/* Parent page-element should not gain outlines/shadows when child is selected */
.template-container .page-element.selected:has(.sub-element-selected),
.template-container .container-item.selected:has(.sub-element-selected) {
    outline: none !important;
    box-shadow: none !important;
    border-color: inherit !important;
}
/* Template elements must inherit text-align from their inline styles,
   not from the editor's global centering rules. */
.template-container .editable-text,
.template-container h1,
.template-container h2,
.template-container h3,
.template-container h4,
.template-container h5,
.template-container h6,
.template-container p,
.template-container span,
.template-container li,
.template-container blockquote,
.template-container label,
.template-container button {
    text-align: inherit !important;
}
.template-container .cta-button,
.template-container button {
    margin: inherit;
}

/* Template container sections — subtle hover/select feedback */
.template-container .page-element[data-type="container"]:hover {
    outline: 1px dashed rgba(56, 182, 255, 0.3) !important;
    outline-offset: -1px;
}
.template-container .page-element[data-type="container"].selected {
    outline: 2px solid rgba(56, 182, 255, 0.5) !important;
    outline-offset: -1px;
}

/* Template card containers (stat cards, feature cards, etc.) */
.template-card[data-type="container"] {
    cursor: pointer;
    transition: outline 0.15s ease;
}
.template-card[data-type="container"]:hover {
    outline: 1px dashed rgba(56, 182, 255, 0.4);
    outline-offset: -1px;
}
.template-card[data-type="container"].selected {
    outline: 2px solid #38B6FF !important;
    outline-offset: -1px;
}

/* Container interaction states (editor only — blank canvas containers) */

/* Container hover state is handled by the rule near line 1040 */

/* Container drag-over state removed — using pointer-based .mv-* system */

/* Container selection state */
.page-element[data-type="container"].selected {
    border-color: #38B6FF;
    box-shadow: 0 0 0 1px rgba(56, 182, 255, 0.3);
}

/* Container columns styling */
.container-column {
    transition: border-color 0.2s ease, background 0.2s ease;
    position: relative;
    background: transparent !important;
    border: 1px dashed rgba(56, 182, 255, 0.2);
    border-radius: 8px;
    min-height: 80px;
    padding: 16px;
}

.container-column:hover {
    border-color: rgba(56, 182, 255, 0.4) !important;
    background: rgba(56, 182, 255, 0.02) !important;
}

/* Container column drag-over removed — pointer-based .mv-* system */
.container-column._unused_placeholder {
    display: none;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.3);
}

/* Container text — placeholder, system disabled */

/* Container layout grid improvements */
.container-layout {
    position: relative;
    width: 100%;
}

.container-layout[data-container-type="two-column"],
.container-layout[data-container-type="three-column"],
.container-layout[data-container-type="four-column"] {
    display: grid;
    align-items: start;
}

.container-layout[data-container-type="two-column"] {
    grid-template-columns: 1fr 1fr;
}

.container-layout[data-container-type="three-column"] {
    grid-template-columns: repeat(3, 1fr);
}

.container-layout[data-container-type="four-column"] {
    grid-template-columns: repeat(4, 1fr);
}

/* Mobile responsive container layouts */
@media (max-width: 768px) {
    .container-layout[data-container-type="three-column"],
    .container-layout[data-container-type="four-column"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .container-layout[data-container-type="two-column"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Container animations */
@keyframes containerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Enhanced template sections */
.hero-section .cta-button:not(.sub-element-selected):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.features-section .feature-item:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 50px rgba(0,0,0,0.12) !important;
}

.cta-section .cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Better editable text styling */
.editable-text[contenteditable]:focus {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .canvas-wrapper {
        padding: 20px;
    }
    
    .canvas {
        max-width: none;
    }
    
    .instructions-panel {
        display: none;
    }
    
    .properties-panel {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        max-height: 60vh;
    }
    
    .color-controls {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* (Page element transitions consolidated above) */

.page-element.moving {
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar for Properties Panel */
.properties-panel::-webkit-scrollbar {
    width: 8px;
}

.properties-panel::-webkit-scrollbar-track {
    background: #333;
    border-radius: 4px;
}

.properties-panel::-webkit-scrollbar-thumb {
    background: #38B6FF;
    border-radius: 4px;
}

.properties-panel::-webkit-scrollbar-thumb:hover {
    background: #2196F3;
}

/* Sub-element Selection Styles */
.sub-element-selected:not(.cta-button):not(button) {
    outline: 2px solid #38B6FF !important;
    outline-offset: 2px;
    background-color: rgba(56, 182, 255, 0.05) !important;
    border-radius: 4px !important;
    position: relative;
}
.cta-button.sub-element-selected,
button.sub-element-selected {
    outline: 2px solid #38B6FF !important;
    outline-offset: 2px;
}
/* Disable all hover visual effects on selected buttons so background stays solid */
.cta-button.sub-element-selected:hover,
button.sub-element-selected:hover,
.hero-section .cta-button.sub-element-selected:hover,
.cta-section .cta-button.sub-element-selected:hover,
.page-element .cta-button.sub-element-selected:hover,
.container-item .cta-button.sub-element-selected:hover,
.template-container .cta-button.sub-element-selected:hover {
    transform: none !important;
    box-shadow: none !important;
    outline: 2px solid rgba(56, 182, 255, 0.5) !important;
    outline-offset: 1px !important;
}

.sub-element-selected:not(.cta-button):not(button)::after {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    background-color: #38B6FF;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 10;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background-color: #333;
    border-radius: 6px;
    font-size: 14px;
    color: #ccc;
    border: 1px solid #444;
}

.breadcrumb .section-name {
    color: #38B6FF;
    font-weight: 600;
}

.breadcrumb .element-name {
    color: #fff;
    font-weight: 500;
}

.breadcrumb i {
    color: #666;
    font-size: 12px;
}

/* Section Controls */
.section-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-controls button {
    width: 100%;
}

/* Enhanced Element Hover States for Sub-element Selection */
.feature-item:hover,
.editable-text:hover,
.cta-button:not(.sub-element-selected):hover {
    outline: 1px dashed #38B6FF;
    outline-offset: 2px;
    cursor: pointer;
    transition: outline 0.2s ease;
}

/* Feature Item Specific Styles */
.feature-item {
    position: relative;
    transition: all 0.2s ease;
    padding: 20px;
    border-radius: 8px;
}

.feature-item:hover {
    background-color: rgba(56, 182, 255, 0.02);
}

/* Individual Text Element Hover */
.page-element .editable-text:not(.cta-button):hover {
    background-color: rgba(56, 182, 255, 0.05);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

/* Button Elements in Sections */
.page-element .cta-button {
    position: relative;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.page-element .cta-button:hover {
    box-shadow: 0 2px 8px rgba(56, 182, 255, 0.15);
    transition: box-shadow 0.2s ease;
}

/* Selection Hierarchy Indicators */
.page-element.selected .sub-element-selected {
    outline-width: 3px;
    outline-color: #28a745;
}

.page-element.selected .sub-element-selected:not(.cta-button):not(button)::after {
    background-color: #28a745;
}

/* Properties Panel Specific Styles for Sub-elements */
.properties-panel .breadcrumb:hover {
    background-color: #3a3a3a;
    cursor: default;
}

/* Enhanced Visual Feedback — only dim siblings when sub-element selection is active */
.page-element.selected:has(.sub-element-selected) > *:not(.sub-element-selected) {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.page-element.selected .sub-element-selected {
    opacity: 1;
    z-index: 5;
    position: relative;
}

/* Small Enhancement for Property Labels */
.property-group label[style*="color: #38B6FF"] {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.property-group label[style*="color: #38B6FF"]::before {
    content: "⚙";
    font-size: 16px;
}

/* Responsive Adjustments for Sub-element Editing */
@media (max-width: 768px) {
    .breadcrumb {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .breadcrumb i {
        transform: rotate(90deg);
    }
    
    .sub-element-selected {
        outline-width: 3px;
    }
}

/* Clean hover for containers */
.container-element:hover {
    border-color: #38B6FF;
    transition: border-color 0.2s ease;
}

/* Clean table hover */
.custom-table:hover {
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.1);
    transition: box-shadow 0.2s ease;
}

/* Clean list hover */
.custom-list:hover {
    background-color: rgba(56, 182, 255, 0.02);
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

/* Clean divider hover */
.custom-divider:hover {
    background-color: #38B6FF;
    transition: background-color 0.2s ease;
}

/* Ensure template sections also have no spacing */
.hero-section, .features-section, .cta-section {
    margin: 0 !important;
    padding: 100px 40px !important;
    display: block;
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

/* About section styling */
.page-element[data-type="about"] {
    margin: 0 !important;
    padding: 100px 40px !important;
    display: block;
    width: 100%;
    position: relative;
    flex-shrink: 0;
}

/* Container drop feedback for empty containers */
.page-element[data-type="container"]:empty::after {
    content: "Drop elements here to organize content";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #38B6FF;
    font-size: 16px;
    font-weight: 500;
    opacity: 0.6;
    pointer-events: none;
    text-align: center;
    z-index: 1;
}

/* Tablet Device Preview Styling */
.tablet-preview {
    border-radius: 25px !important;
    border: 6px solid #2c2c2e !important;
    box-shadow:
        0 0 0 1px #1c1c1e,
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 12px 25px rgba(0, 0, 0, 0.3) !important;
    position: relative !important;
    background: white !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.tablet-preview:before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background: #2c2c2e;
    border-radius: 50%;
    z-index: 10;
}

/* Enhanced device frame system */
.canvas-wrapper:has(.tablet-preview) {
    background: linear-gradient(135deg, #29ABE2 0%, #38B6FF 100%) !important;
    padding: 50px 30px !important;
}

/* Responsive breakpoint controls */
.responsive-controls {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #2a2a2a;
    border-radius: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.responsive-controls .label {
    color: #ccc;
    font-size: 14px;
    margin-right: 10px;
}

.breakpoint-indicator {
    position: fixed;
    top: 60px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.breakpoint-indicator.show {
    opacity: 1;
}

/* Mobile-specific enhancements */
.mobile-preview {
    border-radius: 30px !important;
    border: 8px solid #2c2c2e !important;
    box-shadow: 
        0 0 0 1px #1c1c1e,
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 10px 20px rgba(0, 0, 0, 0.2) !important;
    position: relative !important;
    background: white !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.mobile-preview:before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 30px;
    background: #2c2c2e;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

.mobile-preview:after {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: #1c1c1e;
    border-radius: 2px;
    z-index: 11;
}

/* Mobile and tablet preview specific canvas wrapper overrides */
.canvas-wrapper:has(.mobile-preview) {
    background: linear-gradient(135deg, #38B6FF 0%, #1A8FE3 100%) !important;
    padding: 40px 20px !important;
    height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
}

.canvas-wrapper:has(.tablet-preview) {
    background: linear-gradient(135deg, #29ABE2 0%, #38B6FF 100%) !important;
    padding: 50px 30px !important;
    height: calc(100vh - 40px) !important;
    overflow-y: auto !important;
}

/* Device orientation controls */
.orientation-controls {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #2a2a2a;
    border-radius: 6px;
    margin-top: 10px;
}

.orientation-btn {
    padding: 6px 12px;
    border: 1px solid #3a3a3a;
    background: #2a2a2a;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.orientation-btn:hover {
    background: #3a3a3a;
}

.orientation-btn.active {
    background: #38B6FF;
    border-color: #38B6FF;
}

/* Enhanced device controls */
.device-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-right: 15px;
}

.device-btn {
    padding: 8px 12px;
    background-color: #333;
    border: 1px solid #444;
    color: #888;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.device-btn:hover {
    background: #3a3a3a;
    border-color: #4a4a4a;
    transform: translateY(-1px);
}

.device-btn.active {
    background: linear-gradient(135deg, #38B6FF, #2196F3);
    border-color: #38B6FF;
    color: white;
    box-shadow: 0 4px 15px rgba(56, 182, 255, 0.3);
}

.device-btn i {
    font-size: 16px;
}

/* Add Element Button and Dropdown */
.add-element-container {
    position: relative;
    margin-left: 12px;
}

.add-element-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(56,182,255,.1);
    color: #38B6FF;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
    min-width: auto;
    justify-content: center;
    white-space: nowrap;
}

.add-element-btn:hover {
    background: rgba(56,182,255,.18);
    border-color: rgba(56,182,255,.3);
}

.add-element-btn.active {
    background: linear-gradient(135deg, #38B6FF, #2196F3);
    border-color: #38B6FF;
    color: white;
    box-shadow: 0 4px 15px rgba(56, 182, 255, 0.3);
}

.add-element-btn i {
    font-size: 16px;
}

.add-element-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    max-height: 400px;
    overflow-y: auto;
}

.add-element-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #333;
}

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

.dropdown-item:hover {
    background-color: #3a3a3a;
    color: #38B6FF;
}

.dropdown-item i {
    color: #38B6FF;
    width: 16px;
    font-size: 14px;
}

.dropdown-item span {
    font-size: 14px;
    font-weight: 500;
}

/* Responsive typography for all devices */
.mobile-preview h1, .mobile-preview .h1-style,
.tablet-preview h1, .tablet-preview .h1-style {
    font-size: clamp(28px, 8vw, 40px) !important;
}

.mobile-preview h2, .mobile-preview .h2-style,
.tablet-preview h2, .tablet-preview .h2-style {
    font-size: clamp(24px, 6vw, 32px) !important;
}

.mobile-preview h3, .mobile-preview .h3-style,
.tablet-preview h3, .tablet-preview .h3-style {
    font-size: clamp(20px, 5vw, 26px) !important;
}

.mobile-preview p, .tablet-preview p {
    font-size: clamp(14px, 4vw, 18px) !important;
    line-height: 1.6 !important;
}

/* Touch-friendly elements for all devices */
.mobile-preview button, .mobile-preview .cta-button,
.tablet-preview button, .tablet-preview .cta-button {
    min-height: 44px !important;
    font-size: 16px !important;
    padding: 12px 24px !important;
    touch-action: manipulation !important;
}

.mobile-preview input, .mobile-preview textarea, .mobile-preview select,
.tablet-preview input, .tablet-preview textarea, .tablet-preview select {
    font-size: 16px !important;
    padding: 16px !important;
    min-height: 44px !important;
    border-radius: 8px !important;
}

/* Device-specific grid layouts */
.tablet-preview .container-layout[data-container-type="two-column"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 30px !important;
}

.tablet-preview .container-layout[data-container-type="three-column"],
.tablet-preview .container-layout[data-container-type="four-column"] {
    display: block !important;
}

/* Mobile accessibility improvements */
.mobile-preview *:focus, .tablet-preview *:focus {
    outline: 3px solid #38B6FF !important;
    outline-offset: 2px !important;
}

.mobile-preview .editable-text, .tablet-preview .editable-text {
    -webkit-tap-highlight-color: rgba(56, 182, 255, 0.3);
}

/* Disable problematic hover effects on touch devices */
.mobile-preview .container-item:hover, .tablet-preview .container-item:hover {
    transform: none !important;
    box-shadow: none !important;
}

.mobile-preview .cta-button:hover, .tablet-preview .cta-button:hover {
    transform: none !important;
}

/* Enhanced scrolling for all preview modes */
.mobile-preview, .tablet-preview {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    scrollbar-color: rgba(0,0,0,0.2) transparent !important;
}

.mobile-preview::-webkit-scrollbar, .tablet-preview::-webkit-scrollbar {
    width: 4px !important;
}
.mobile-preview::-webkit-scrollbar-track, .tablet-preview::-webkit-scrollbar-track {
    background: transparent !important;
}
.mobile-preview::-webkit-scrollbar-thumb, .tablet-preview::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15) !important;
    border-radius: 4px !important;
}
.mobile-preview::-webkit-scrollbar-thumb:hover, .tablet-preview::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3) !important;
}

/* Device-specific animations */
.mobile-preview .fade-in, .tablet-preview .fade-in {
    animation: deviceSlideIn 0.6s ease-out !important;
}

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

/* Responsive grid system */
.mobile-preview [style*="display: grid"], .tablet-preview [style*="display: grid"] {
    display: block !important;
}

.mobile-preview [style*="grid-template-columns"], .tablet-preview [style*="grid-template-columns"] {
    display: block !important;
}

.mobile-preview .grid-item, .tablet-preview .grid-item {
    margin-bottom: 20px !important;
}

/* Enhanced spacing for mobile and tablet */
.mobile-preview .container-item, .tablet-preview .container-item {
    padding: 30px 20px !important;
}

.mobile-preview [style*="padding: 80px"], .mobile-preview [style*="padding: 100px"],
.tablet-preview [style*="padding: 80px"], .tablet-preview [style*="padding: 100px"] {
    padding: 40px 20px !important;
}

.mobile-preview [style*="margin: 60px 0"], .mobile-preview [style*="margin: 80px 0"],
.tablet-preview [style*="margin: 60px 0"], .tablet-preview [style*="margin: 80px 0"] {
    margin: 30px 0 !important;
}

/* Canvas wrapper fixes for all device modes */
.canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: all 0.3s ease;
    height: calc(100vh - 40px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Enhanced Property Panel Styles */
.property-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.property-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: white;
}

.property-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.property-textarea:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: white;
}

.size-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.size-btn:hover {
    border-color: #38B6FF;
    background: #f8faff;
}

.size-btn.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
}

.color-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: border-color 0.2s ease;
}

.color-btn:hover::after {
    border-color: #38B6FF;
}

.spacing-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spacing-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.spacing-btn:hover {
    border-color: #38B6FF;
    background: #f8faff;
}

.spacing-btn.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
}

.spacing-btn i {
    font-size: 14px;
}

.section-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.section-controls .spacing-btn {
    flex: 1;
    min-width: 120px;
}

/* Property group improvements */
.property-group {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.property-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.property-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-value {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* Enhanced delete button */
.delete-element-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.delete-element-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* Form styling improvements */
.property-input[type="url"],
.property-input[type="email"] {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

select.property-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Responsive improvements for mobile */
@media (max-width: 768px) {
    .size-controls,
    .color-controls,
    .spacing-controls {
        gap: 6px;
    }
    
    .size-btn {
        min-width: 50px;
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .color-btn {
        width: 32px;
        height: 32px;
    }
    
    .spacing-btn {
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .property-input,
    .property-textarea {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Enhanced visual feedback */
.property-input:invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.property-input:valid {
    border-color: #22c55e;
}

/* Loading states */
.spacing-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spacing-btn.loading {
    position: relative;
}

.spacing-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Better hover states for interactive elements */
.editable-text:not(.cta-button):hover {
    background: rgba(56, 182, 255, 0.05);
    border-radius: 4px;
    cursor: text;
}

.editable-text:not(.cta-button):focus {
    background: rgba(56, 182, 255, 0.1);
    outline: 2px solid rgba(56, 182, 255, 0.3);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Enhanced styling for specific control groups */
.property-group[data-type="advanced"] {
    background: #f8faff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.property-group[data-type="advanced"] label {
    color: #38B6FF;
}

/* File upload styling */
input[type="file"] {
    display: none;
}

.upload-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed #38B6FF;
    border-radius: 8px;
    background: #f8faff;
    color: #38B6FF;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.upload-trigger:hover {
    background: #f0f7ff;
    border-color: #3b82f6;
}

/* Tooltip improvements */
[title] {
    position: relative;
    cursor: default; /* Changed from cursor: help */
}

/* Enhanced focus indicators for accessibility */
.size-btn:focus,
.color-btn:focus,
.spacing-btn:focus {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

/* Dark mode support for properties panel */
@media (prefers-color-scheme: dark) {
    .property-input,
    .property-textarea {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .property-input:focus,
    .property-textarea:focus {
        background: #1f2937;
        border-color: #60a5fa;
    }
    
    .size-btn,
    .spacing-btn {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .size-btn:hover,
    .spacing-btn:hover {
        background: #4b5563;
        border-color: #60a5fa;
    }
} 

/* Breadcrumb Navigation for Nested Element Editing */
.breadcrumb-navigation {
    margin-top: 15px;
    padding: 12px 0;
    border-top: 1px solid #3a3a3a;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(56, 182, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #ccc;
    border: 1px solid rgba(56, 182, 255, 0.2);
}

.breadcrumb .section-name {
    color: #38B6FF;
    font-weight: 600;
    font-size: 13px;
}

.breadcrumb .element-name {
    color: #fff;
    font-weight: 500;
    font-size: 13px;
}

.breadcrumb i {
    color: #666;
    font-size: 10px;
}

/* Sub-element Selection Styles */
.sub-element-selected:not(.cta-button):not(button) {
    outline: 2px solid #22c55e !important;
    outline-offset: 2px;
    background-color: rgba(34, 197, 94, 0.05) !important;
    border-radius: 4px !important;
    position: relative;
    z-index: 10;
}
.cta-button.sub-element-selected,
button.sub-element-selected {
    outline: 2px solid #22c55e !important;
    outline-offset: 2px;
}

.sub-element-selected:not(.cta-button):not(button)::after {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    background-color: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Enhanced container item selection when sub-element is selected */
.container-item.selected:has(.sub-element-selected) {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.02) !important;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.15);
}

/* Visual hierarchy for nested selection */
.container-item.selected > *:not(.sub-element-selected) {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.container-item.selected .sub-element-selected {
    opacity: 1;
    z-index: 15;
    position: relative;
}

/* Enhanced hover states for nested elements */
.container-item .editable-text:hover,
.container-item .cta-button:not(.sub-element-selected):hover,
.container-item img:hover,
.container-item .image-placeholder:hover,
.container-item .feature-item:hover,
.container-item input:hover,
.container-item textarea:hover,
.container-item select:hover,
.container-item table:hover,
.container-item ul:hover,
.container-item ol:hover {
    outline: 1px dashed #38B6FF;
    outline-offset: 2px;
    cursor: pointer;
    transition: outline 0.2s ease;
    background-color: rgba(56, 182, 255, 0.03) !important;
    border-radius: 4px;
}

/* Prevent hover effects on already selected sub-elements */
.sub-element-selected:not(.cta-button):not(button):hover {
    outline: 2px solid #22c55e !important;
    background-color: rgba(34, 197, 94, 0.05) !important;
}

/* Enhanced breadcrumb styling */
.breadcrumb:hover {
    background-color: rgba(56, 182, 255, 0.15);
    border-color: rgba(56, 182, 255, 0.3);
    cursor: default;
}

/* Better visual feedback for container selection with sub-elements */
.page-element.selected:has(.sub-element-selected) {
    outline: 2px solid #38B6FF !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.1), 0 0 0 6px rgba(34, 197, 94, 0.1);
}

/* Improved element type indicators */
.property-group:has(.breadcrumb-navigation) label {
    color: #38B6FF;
    display: flex;
    align-items: center;
    gap: 6px;
}

.property-group:has(.breadcrumb-navigation) label::before {
    content: "🎯";
    font-size: 14px;
}

/* Responsive adjustments for nested editing */
@media (max-width: 768px) {
    .breadcrumb {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px;
    }
    
    .breadcrumb i {
        transform: rotate(90deg);
        margin: 2px 0;
    }
    
    .sub-element-selected {
        outline-width: 3px;
        outline-offset: 3px;
    }
    
    .sub-element-selected::after {
        width: 16px;
        height: 16px;
        top: -8px;
        right: -8px;
    }
    
    .breadcrumb .section-name,
    .breadcrumb .element-name {
        font-size: 12px;
    }
}

/* Enhanced focus states for accessibility */
.sub-element-selected:focus,
.sub-element-selected[contenteditable]:focus {
    outline: 3px solid #22c55e !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.2);
}

/* Animation for smooth transitions — exclude buttons to prevent transparency flash */
.sub-element-selected:not(.cta-button):not(button) {
    animation: selectElement 0.3s ease-out;
}

.cta-button.sub-element-selected,
button.sub-element-selected {
    animation: selectButtonElement 0.2s ease-out;
}

@keyframes selectElement {
    0% {
        outline-color: transparent;
        background-color: transparent;
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        outline-color: #22c55e;
        background-color: rgba(34, 197, 94, 0.05);
        transform: scale(1);
    }
}

@keyframes selectButtonElement {
    0% {
        outline-color: transparent;
    }
    100% {
        outline-color: #22c55e;
    }
}

/* Breadcrumb entrance animation */
.breadcrumb-navigation {
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Better contrast for dark theme */
.properties-panel .breadcrumb {
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
}

.properties-panel .breadcrumb .section-name {
    color: #38B6FF;
}

.properties-panel .breadcrumb .element-name {
    color: #ffffff;
}

.properties-panel .breadcrumb i {
    color: #888;
}

/* Improved nested element indicators */
.container-item:has(.sub-element-selected)::before {
    content: "📝 Editing nested element";
    position: absolute;
    top: -25px;
    left: 0;
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    z-index: 20;
    pointer-events: none;
    opacity: 0.9;
}

/* Enhanced visual separation between container and sub-element */
.container-item.selected {
    border-style: dashed;
    border-width: 2px;
}

.container-item.selected:has(.sub-element-selected) {
    border-style: solid;
    border-width: 2px;
}

/* Fix cursor issues - Remove problematic cursor styles */
[title] {
    position: relative;
    cursor: default; /* Changed from cursor: help */
}

/* Ensure proper cursors for interactive elements */
.container-item .editable-text,
.container-item .cta-button,
.container-item img,
.container-item .image-placeholder,
.container-item .feature-item,
.container-item input,
.container-item textarea,
.container-item select,
.container-item table,
.container-item ul,
.container-item ol {
    cursor: pointer !important;
}

.sub-element-selected {
    cursor: default !important;
}

.editable-text:hover {
    cursor: text !important;
}

.editable-text:focus {
    cursor: text !important;
}

.cta-button:hover,
.cta-button:focus {
    cursor: pointer !important;
}

/* Custom Color Controls - Carrd Style */
.color-controls-custom {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-picker {
    width: 100%;
    height: 40px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 6px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.preset-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Icon Grid for Icon Selection */
.icon-selector {
    width: 100%;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #38B6FF;
}

.icon-option:hover {
    border-color: #38B6FF;
    background: #f8faff;
    transform: scale(1.05);
}

.icon-option.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.3);
}

.container-layout {
    width: 100%;
}

/* Images: center the image within its element */
.image-element {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

.image-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

img {
    display: block;
    margin: 0 auto;
}

/* Images: disable dashed hover outlines on placeholder/img inside image elements */
.page-element[data-type="image"] img:hover,
.page-element[data-type="image"] .image-placeholder:hover {
    outline: none !important;
    outline-offset: 0 !important;
    background-color: transparent !important;
}

/* Images: if something accidentally marks placeholder/img as sub-element-selected, don't show the green outline */
.page-element[data-type="image"] .image-placeholder.sub-element-selected,
.page-element[data-type="image"] img.image-display.sub-element-selected {
    outline: none !important;
    box-shadow: none !important;
}

/* Feature grid centering */
.features-grid,
div[style*="grid-template-columns"] {
    margin: 0 auto;
    display: grid;
    justify-items: center;
}

.feature-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Table centering */
table {
    margin: 0 auto;
}

/* List centering (for generic template content, NOT the editor List element) */
.page-element:not([data-type="list"]) ul,
.page-element:not([data-type="list"]) ol,
.container-item:not([data-type="list"]) ul,
.container-item:not([data-type="list"]) ol {
    max-width: 600px;
    margin: 0 auto;
}

/* Form centering */
.contact form,
div[style*="display: grid"] {
    max-width: 600px;
    margin: 0 auto;
}

/* Pricing card centering */
div[style*="border: 3px solid"] {
    margin: 0 auto;
}

/* Icon hover effects within containers */
.container-item i[class*="fa"]:hover,
.container-item .icon:hover {
    outline: 1px dashed #38B6FF;
    outline-offset: 2px;
    cursor: pointer;
    transition: outline 0.2s ease;
    background-color: rgba(56, 182, 255, 0.03) !important;
    border-radius: 4px;
    padding: 2px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .icon-option {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .color-picker {
        height: 36px;
    }
    
    .preset-colors {
        gap: 6px;
    }
}

/* Enhanced centering for template sections */
.hero-section,
.features-section,
.cta-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.hero-section > *,
.features-section > *,
.cta-section > * {
    margin-left: auto;
    margin-right: auto;
}

/* Ensure all headings are centered */
h1, h2, h3, h4, h5, h6 {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure all paragraphs in sections are centered */
.page-element p {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Override specific centering for editable elements */
.container-item .editable-text[contenteditable]:focus {
    text-align: inherit;
}

/* Divider centering */
.divider,
.divider-element {
    margin: 0 auto;
    text-align: center;
}

/* Divider element styling - True line without box appearance */
.divider-element {
    transition: all 0.3s ease;
    cursor: pointer;
    background: transparent !important;
    padding: 0 !important;
    border: none;
}

.divider-element:hover {
    opacity: 0.7;
}

.divider-element.selected {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

.divider-element.sub-element-selected {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

/* Property input styling */
.property-input {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.property-input input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.property-input input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.property-input input[type="text"]:focus {
    outline: none;
    border-color: #38B6FF;
}

/* Enhanced device controls */
.device-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-right: 15px;
}

/* Markdown controls styling */
.markdown-controls {
    margin-bottom: 10px;
}

.markdown-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
    align-items: center;
}

.markdown-toolbar:last-child {
    margin-bottom: 8px;
}

.markdown-btn {
    padding: 6px 8px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    position: relative;
}

.markdown-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.markdown-btn:active {
    background: #dee2e6;
    transform: translateY(0);
}

.markdown-btn span {
    font-weight: 600;
    line-height: 1;
}

.markdown-btn i {
    font-size: 12px;
}

.markdown-btn[data-markdown-action="bold-italic"] i:last-child {
    margin-left: -2px;
    font-size: 10px;
    opacity: 0.8;
}

.markdown-btn[data-markdown-action="subscript"] span,
.markdown-btn[data-markdown-action="superscript"] span {
    font-family: 'Times New Roman', serif;
    font-size: 11px;
    font-weight: 700;
}

.markdown-btn[data-markdown-action^="color-"] span {
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
}

.markdown-btn[data-markdown-action="nbsp"] span {
    font-family: monospace;
    font-size: 9px;
    font-weight: 600;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 2px;
    padding: 1px 3px;
}

.markdown-editor {
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 13px;
    line-height: 1.4;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    color: #495057;
}

.markdown-editor:focus {
    background: white;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    outline: none;
}

.markdown-preview {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    padding: 12px;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
    color: #495057;
}

.markdown-preview strong {
    font-weight: 600;
}

.markdown-preview em {
    font-style: italic;
}

.markdown-preview code {
    background: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.markdown-preview a {
    color: #38B6FF;
    text-decoration: underline;
}

.markdown-preview u {
    text-decoration: underline;
    text-decoration-color: #38B6FF;
}

.markdown-preview del {
    text-decoration: line-through;
    text-decoration-color: #dc3545;
}

.markdown-preview mark {
    background-color: #ffeb3b;
    padding: 2px 4px;
    border-radius: 3px;
}

.markdown-preview sub {
    font-size: 0.75em;
    vertical-align: sub;
}

.markdown-preview sup {
    font-size: 0.75em;
    vertical-align: super;
}

.markdown-help {
    font-size: 11px;
    color: #6c757d;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #38B6FF;
    line-height: 1.4;
}

.markdown-help strong {
    color: #495057;
    font-weight: 600;
}

/* Responsive adjustments for markdown toolbar */
@media (max-width: 768px) {
    .markdown-toolbar {
        gap: 3px;
        padding: 6px;
    }
    
    .markdown-btn {
        min-width: 24px;
        height: 24px;
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .markdown-btn i {
        font-size: 11px;
    }
    
    .markdown-btn[data-markdown-action^="color-"] span {
        font-size: 12px;
    }
    
    .markdown-help {
        font-size: 10px;
        padding: 6px 8px;
    }
}

/* Enhanced editable text styling */
.editable-text {
    outline: none;
    position: relative;
    transition: all 0.2s ease;
}

.editable-text:not(.cta-button):hover {
    background: rgba(56, 182, 255, 0.05);
    border-radius: 4px;
    cursor: text;
}

.editable-text:not(.cta-button):focus,
.editable-text:not(.cta-button).actively-editing {
    background: rgba(56, 182, 255, 0.1) !important;
    outline: 2px solid rgba(56, 182, 255, 0.5) !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
    box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.15) !important;
    position: relative !important;
    z-index: 1000 !important;
}

/* Prevent element deletion visual cues when actively editing */
.actively-editing {
    outline: 2px solid #22c55e !important;
    outline-offset: 2px !important;
    background: rgba(34, 197, 94, 0.1) !important;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15) !important;
    position: relative !important;
    z-index: 1001 !important;
}

.actively-editing::before {
    content: "✏️ Editing...";
    position: absolute;
    top: -25px;
    left: 0;
    background: #22c55e;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    z-index: 1002;
    pointer-events: none;
    white-space: nowrap;
}

/* Enhanced Property Panel Styles */
.property-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.property-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: white;
}

.property-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.property-textarea:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: white;
}

/* Font Family Dropdown */
select.property-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Size Slider Controls */
.size-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.size-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #38B6FF;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.size-slider::-webkit-slider-thumb:hover {
    background: #2196F3;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #38B6FF;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.size-display {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 72px;
}

.size-input {
    width: 46px;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    background: white;
}

.size-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.1);
}

.size-unit {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Spacing Slider Controls */
.spacing-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 1px solid #bee3f8;
}

.spacing-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #bee3f8;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spacing-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3182ce;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.spacing-slider::-webkit-slider-thumb:hover {
    background: #2c5282;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.spacing-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3182ce;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.spacing-display {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 72px;
}

.spacing-input {
    width: 46px;
    padding: 6px 8px;
    border: 1px solid #bee3f8;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    background: white;
}

/* Keep slider controls from overflowing the properties panel */
.properties-panel .control-grid-2,
.properties-panel .control-grid-3 {
    grid-template-columns: 1fr !important;
}

/* Slider layout handled by final override block at end of file */

.spacing-input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

.spacing-unit {
    font-size: 12px;
    color: #4a5568;
    font-weight: 500;
}

.size-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.size-btn:hover {
    border-color: #38B6FF;
    background: #f8faff;
}

.size-btn.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
}

.color-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: border-color 0.2s ease;
}

.color-btn:hover::after {
    border-color: #38B6FF;
}

.spacing-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spacing-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.spacing-btn:hover {
    border-color: #38B6FF;
    background: #f8faff;
}

.spacing-btn.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
}

.spacing-btn i {
    font-size: 14px;
}

.section-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.section-controls .spacing-btn {
    flex: 1;
    min-width: 120px;
}

/* Property group improvements */
.property-group {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.property-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.property-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-value {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* Enhanced delete button */
.delete-element-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.delete-element-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* Form styling improvements */
.property-input[type="url"],
.property-input[type="email"] {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

select.property-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Responsive improvements for mobile */
@media (max-width: 768px) {
    .size-controls,
    .color-controls,
    .spacing-controls {
        gap: 6px;
    }
    
    .size-btn {
        min-width: 50px;
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .color-btn {
        width: 32px;
        height: 32px;
    }
    
    .spacing-btn {
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .property-input,
    .property-textarea {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Enhanced visual feedback */
.property-input:invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.property-input:valid {
    border-color: #22c55e;
}

/* Loading states */
.spacing-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spacing-btn.loading {
    position: relative;
}

.spacing-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Better hover states for interactive elements */
.editable-text:not(.cta-button):hover {
    background: rgba(56, 182, 255, 0.05);
    border-radius: 4px;
    cursor: text;
}

.editable-text:not(.cta-button):focus {
    background: rgba(56, 182, 255, 0.1);
    outline: 2px solid rgba(56, 182, 255, 0.3);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Enhanced styling for specific control groups */
.property-group[data-type="advanced"] {
    background: #f8faff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.property-group[data-type="advanced"] label {
    color: #38B6FF;
}

/* File upload styling */
input[type="file"] {
    display: none;
}

.upload-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed #38B6FF;
    border-radius: 8px;
    background: #f8faff;
    color: #38B6FF;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.upload-trigger:hover {
    background: #f0f7ff;
    border-color: #3b82f6;
}

/* Tooltip improvements */
[title] {
    position: relative;
    cursor: default; /* Changed from cursor: help */
}

/* Enhanced focus indicators for accessibility */
.size-btn:focus,
.color-btn:focus,
.spacing-btn:focus {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

/* Dark mode support for properties panel */
@media (prefers-color-scheme: dark) {
    .property-input,
    .property-textarea {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .property-input:focus,
    .property-textarea:focus {
        background: #1f2937;
        border-color: #60a5fa;
    }
    
    .size-btn,
    .spacing-btn {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .size-btn:hover,
    .spacing-btn:hover {
        background: #4b5563;
        border-color: #60a5fa;
    }
} 

/* Breadcrumb Navigation for Nested Element Editing */
.breadcrumb-navigation {
    margin-top: 15px;
    padding: 12px 0;
    border-top: 1px solid #3a3a3a;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(56, 182, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
    color: #ccc;
    border: 1px solid rgba(56, 182, 255, 0.2);
}

.breadcrumb .section-name {
    color: #38B6FF;
    font-weight: 600;
    font-size: 13px;
}

.breadcrumb .element-name {
    color: #fff;
    font-weight: 500;
    font-size: 13px;
}

.breadcrumb i {
    color: #666;
    font-size: 10px;
}

/* Sub-element Selection Styles */
.sub-element-selected:not(.cta-button):not(button) {
    outline: 2px solid #22c55e !important;
    outline-offset: 2px;
    background-color: rgba(34, 197, 94, 0.05) !important;
    border-radius: 4px !important;
    position: relative;
    z-index: 10;
}
.cta-button.sub-element-selected,
button.sub-element-selected {
    outline: 2px solid #22c55e !important;
    outline-offset: 2px;
}

.sub-element-selected:not(.cta-button):not(button)::after {
    content: '';
    position: absolute;
    top: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    background-color: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Enhanced container item selection when sub-element is selected */
.container-item.selected:has(.sub-element-selected) {
    border-color: #22c55e !important;
    background: rgba(34, 197, 94, 0.02) !important;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.15);
}

/* Visual hierarchy for nested selection */
.container-item.selected > *:not(.sub-element-selected) {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.container-item.selected .sub-element-selected {
    opacity: 1;
    z-index: 15;
    position: relative;
}

/* Enhanced hover states for nested elements */
.container-item .editable-text:hover,
.container-item .cta-button:not(.sub-element-selected):hover,
.container-item img:hover,
.container-item .image-placeholder:hover,
.container-item .feature-item:hover,
.container-item input:hover,
.container-item textarea:hover,
.container-item select:hover,
.container-item table:hover,
.container-item ul:hover,
.container-item ol:hover {
    outline: 1px dashed #38B6FF;
    outline-offset: 2px;
    cursor: pointer;
    transition: outline 0.2s ease;
    background-color: rgba(56, 182, 255, 0.03) !important;
    border-radius: 4px;
}

/* Prevent hover effects on already selected sub-elements */
.sub-element-selected:not(.cta-button):not(button):hover {
    outline: 2px solid #22c55e !important;
    background-color: rgba(34, 197, 94, 0.05) !important;
}

/* Enhanced breadcrumb styling */
.breadcrumb:hover {
    background-color: rgba(56, 182, 255, 0.15);
    border-color: rgba(56, 182, 255, 0.3);
    cursor: default;
}

/* Better visual feedback for container selection with sub-elements */
.page-element.selected:has(.sub-element-selected) {
    outline: 2px solid #38B6FF !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.1), 0 0 0 6px rgba(34, 197, 94, 0.1);
}

/* Improved element type indicators */
.property-group:has(.breadcrumb-navigation) label {
    color: #38B6FF;
    display: flex;
    align-items: center;
    gap: 6px;
}

.property-group:has(.breadcrumb-navigation) label::before {
    content: "🎯";
    font-size: 14px;
}

/* Responsive adjustments for nested editing */
@media (max-width: 768px) {
    .breadcrumb {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px;
    }
    
    .breadcrumb i {
        transform: rotate(90deg);
        margin: 2px 0;
    }
    
    .sub-element-selected {
        outline-width: 3px;
        outline-offset: 3px;
    }
    
    .sub-element-selected::after {
        width: 16px;
        height: 16px;
        top: -8px;
        right: -8px;
    }
    
    .breadcrumb .section-name,
    .breadcrumb .element-name {
        font-size: 12px;
    }
}

/* Enhanced focus states for accessibility */
.sub-element-selected:focus,
.sub-element-selected[contenteditable]:focus {
    outline: 3px solid #22c55e !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.2);
}

/* Animation for smooth transitions — exclude buttons to prevent transparency flash */
.sub-element-selected:not(.cta-button):not(button) {
    animation: selectElement 0.3s ease-out;
}

.cta-button.sub-element-selected,
button.sub-element-selected {
    animation: selectButtonElement 0.2s ease-out;
}

@keyframes selectElement {
    0% {
        outline-color: transparent;
        background-color: transparent;
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        outline-color: #22c55e;
        background-color: rgba(34, 197, 94, 0.05);
        transform: scale(1);
    }
}

@keyframes selectButtonElement {
    0% {
        outline-color: transparent;
    }
    100% {
        outline-color: #22c55e;
    }
}

/* Breadcrumb entrance animation */
.breadcrumb-navigation {
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Better contrast for dark theme */
.properties-panel .breadcrumb {
    background-color: #3a3a3a;
    border: 1px solid #4a4a4a;
}

.properties-panel .breadcrumb .section-name {
    color: #38B6FF;
}

.properties-panel .breadcrumb .element-name {
    color: #ffffff;
}

.properties-panel .breadcrumb i {
    color: #888;
}

/* Improved nested element indicators */
.container-item:has(.sub-element-selected)::before {
    content: "📝 Editing nested element";
    position: absolute;
    top: -25px;
    left: 0;
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    z-index: 20;
    pointer-events: none;
    opacity: 0.9;
}

/* Enhanced visual separation between container and sub-element */
.container-item.selected {
    border-style: dashed;
    border-width: 2px;
}

.container-item.selected:has(.sub-element-selected) {
    border-style: solid;
    border-width: 2px;
}

/* Fix cursor issues - Remove problematic cursor styles */
[title] {
    position: relative;
    cursor: default; /* Changed from cursor: help */
}

/* Ensure proper cursors for interactive elements */
.container-item .editable-text,
.container-item .cta-button,
.container-item img,
.container-item .image-placeholder,
.container-item .feature-item,
.container-item input,
.container-item textarea,
.container-item select,
.container-item table,
.container-item ul,
.container-item ol {
    cursor: pointer !important;
}

.sub-element-selected {
    cursor: default !important;
}

.editable-text:hover {
    cursor: text !important;
}

.editable-text:focus {
    cursor: text !important;
}

.cta-button:hover,
.cta-button:focus {
    cursor: pointer !important;
}

/* Custom Color Controls - Carrd Style */
.color-controls-custom {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.color-picker {
    width: 100%;
    height: 40px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 6px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.preset-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Icon Grid for Icon Selection */
.icon-selector {
    width: 100%;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 18px;
    color: #38B6FF;
}

.icon-option:hover {
    border-color: #38B6FF;
    background: #f8faff;
    transform: scale(1.05);
}

.icon-option.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.3);
}

.container-layout {
    width: 100%;
}

/* Images: center the image within its element */
.image-element {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

.image-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

img {
    display: block;
    margin: 0 auto;
}

/* Feature grid centering */
.features-grid,
div[style*="grid-template-columns"] {
    margin: 0 auto;
    display: grid;
    justify-items: center;
}

.feature-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Table centering */
table {
    margin: 0 auto;
}

/* List centering (for generic template content, NOT the editor List element) */
.page-element:not([data-type="list"]) ul,
.page-element:not([data-type="list"]) ol,
.container-item:not([data-type="list"]) ul,
.container-item:not([data-type="list"]) ol {
    max-width: 600px;
    margin: 0 auto;
}

/* (List element layout is handled by the dedicated `.list-element` / `.carrd-list` rules below) */

/* Form centering */
.contact form,
div[style*="display: grid"] {
    max-width: 600px;
    margin: 0 auto;
}

/* Pricing card centering */
div[style*="border: 3px solid"] {
    margin: 0 auto;
}

/* Icon hover effects within containers */
.container-item i[class*="fa"]:hover,
.container-item .icon:hover {
    outline: 1px dashed #38B6FF;
    outline-offset: 2px;
    cursor: pointer;
    transition: outline 0.2s ease;
    background-color: rgba(56, 182, 255, 0.03) !important;
    border-radius: 4px;
    padding: 2px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .icon-option {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .color-picker {
        height: 36px;
    }
    
    .preset-colors {
        gap: 6px;
    }
}

/* Enhanced centering for template sections */
.hero-section,
.features-section,
.cta-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.hero-section > *,
.features-section > *,
.cta-section > * {
    margin-left: auto;
    margin-right: auto;
}

/* Ensure all headings are centered */
h1, h2, h3, h4, h5, h6 {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Ensure all paragraphs in sections are centered */
.page-element p {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* Override specific centering for editable elements */
.container-item .editable-text[contenteditable]:focus {
    text-align: inherit;
}

/* Divider centering */
.divider,
.divider-element {
    margin: 0 auto;
    text-align: center;
}

/* Divider element styling - True line without box appearance */
.divider-element {
    transition: all 0.3s ease;
    cursor: pointer;
    background: transparent !important;
    padding: 0 !important;
    border: none;
}

.divider-element:hover {
    opacity: 0.7;
}

.divider-element.selected {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

.divider-element.sub-element-selected {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

/* Property input styling */
.property-input {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.property-input input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.property-input input[type="color"] {
    width: 40px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.property-input input[type="text"]:focus {
    outline: none;
    border-color: #38B6FF;
}

/* Enhanced device controls */
.device-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-right: 15px;
}

/* Markdown controls styling */
.markdown-controls {
    margin-bottom: 10px;
}

.markdown-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    flex-wrap: wrap;
    align-items: center;
}

.markdown-toolbar:last-child {
    margin-bottom: 8px;
}

.markdown-btn {
    padding: 6px 8px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    position: relative;
}

.markdown-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.markdown-btn:active {
    background: #dee2e6;
    transform: translateY(0);
}

.markdown-btn span {
    font-weight: 600;
    line-height: 1;
}

.markdown-btn i {
    font-size: 12px;
}

.markdown-btn[data-markdown-action="bold-italic"] i:last-child {
    margin-left: -2px;
    font-size: 10px;
    opacity: 0.8;
}

.markdown-btn[data-markdown-action="subscript"] span,
.markdown-btn[data-markdown-action="superscript"] span {
    font-family: 'Times New Roman', serif;
    font-size: 11px;
    font-weight: 700;
}

.markdown-btn[data-markdown-action^="color-"] span {
    font-weight: 700;
    font-size: 14px;
    text-shadow: 0 1px 1px rgba(255,255,255,0.5);
}

.markdown-btn[data-markdown-action="nbsp"] span {
    font-family: monospace;
    font-size: 9px;
    font-weight: 600;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 2px;
    padding: 1px 3px;
}

.markdown-editor {
    resize: vertical;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 13px;
    line-height: 1.4;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    padding: 12px;
    color: #495057;
}

.markdown-editor:focus {
    background: white;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    outline: none;
}

.markdown-preview {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    padding: 12px;
    min-height: 100px;
    font-family: inherit;
    line-height: 1.5;
    color: #495057;
}

.markdown-preview strong {
    font-weight: 600;
}

.markdown-preview em {
    font-style: italic;
}

.markdown-preview code {
    background: #f1f3f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.markdown-preview a {
    color: #38B6FF;
    text-decoration: underline;
}

.markdown-preview u {
    text-decoration: underline;
    text-decoration-color: #38B6FF;
}

.markdown-preview del {
    text-decoration: line-through;
    text-decoration-color: #dc3545;
}

.markdown-preview mark {
    background-color: #ffeb3b;
    padding: 2px 4px;
    border-radius: 3px;
}

.markdown-preview sub {
    font-size: 0.75em;
    vertical-align: sub;
}

.markdown-preview sup {
    font-size: 0.75em;
    vertical-align: super;
}

.markdown-help {
    font-size: 11px;
    color: #6c757d;
    margin-top: 8px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #38B6FF;
    line-height: 1.4;
}

.markdown-help strong {
    color: #495057;
    font-weight: 600;
}

/* Responsive adjustments for markdown toolbar */
@media (max-width: 768px) {
    .markdown-toolbar {
        gap: 3px;
        padding: 6px;
    }
    
    .markdown-btn {
        min-width: 24px;
        height: 24px;
        padding: 4px 6px;
        font-size: 11px;
    }
    
    .markdown-btn i {
        font-size: 11px;
    }
    
    .markdown-btn[data-markdown-action^="color-"] span {
        font-size: 12px;
    }
    
    .markdown-help {
        font-size: 10px;
        padding: 6px 8px;
    }
}

/* Enhanced editable text styling */
.editable-text {
    outline: none;
    position: relative;
    transition: all 0.2s ease;
}

.editable-text:not(.cta-button):hover {
    background: rgba(56, 182, 255, 0.05);
    border-radius: 4px;
    cursor: text;
}

.editable-text:not(.cta-button):focus,
.editable-text:not(.cta-button).actively-editing {
    background: rgba(56, 182, 255, 0.1) !important;
    outline: 2px solid rgba(56, 182, 255, 0.5) !important;
    outline-offset: 2px !important;
    border-radius: 4px !important;
    box-shadow: 0 0 0 4px rgba(56, 182, 255, 0.15) !important;
    position: relative !important;
    z-index: 1000 !important;
}

/* Prevent element deletion visual cues when actively editing */
.actively-editing {
    outline: 2px solid #22c55e !important;
    outline-offset: 2px !important;
    background: rgba(34, 197, 94, 0.1) !important;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15) !important;
    position: relative !important;
    z-index: 1001 !important;
}

.actively-editing::before {
    content: "✏️ Editing...";
    position: absolute;
    top: -25px;
    left: 0;
    background: #22c55e;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    z-index: 1002;
    pointer-events: none;
    white-space: nowrap;
}

/* Enhanced Property Panel Styles */
.property-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.property-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: white;
}

.property-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.property-textarea:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: white;
}

/* Font Family Dropdown */
select.property-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

/* Size Slider Controls */
.size-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.size-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e9ecef;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #38B6FF;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.size-slider::-webkit-slider-thumb:hover {
    background: #2196F3;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.size-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #38B6FF;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.size-display {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.size-input {
    width: 50px;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    background: white;
}

.size-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.1);
}

.size-unit {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
}

/* Spacing Slider Controls */
.spacing-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    padding: 12px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 1px solid #bee3f8;
}

.spacing-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #bee3f8;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spacing-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3182ce;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.spacing-slider::-webkit-slider-thumb:hover {
    background: #2c5282;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.spacing-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3182ce;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.spacing-display {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 85px;
}

.spacing-input {
    width: 55px;
    padding: 6px 8px;
    border: 1px solid #bee3f8;
    border-radius: 4px;
    font-size: 13px;
    text-align: center;
    background: white;
}

.spacing-input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 2px rgba(49, 130, 206, 0.1);
}

.spacing-unit {
    font-size: 12px;
    color: #4a5568;
    font-weight: 500;
}

.size-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-btn {
    flex: 1;
    min-width: 60px;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.size-btn:hover {
    border-color: #38B6FF;
    background: #f8faff;
}

.size-btn.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
}

.color-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: border-color 0.2s ease;
}

.color-btn:hover::after {
    border-color: #38B6FF;
}

.spacing-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.spacing-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.spacing-btn:hover {
    border-color: #38B6FF;
    background: #f8faff;
}

.spacing-btn.active {
    border-color: #38B6FF;
    background: #38B6FF;
    color: white;
}

.spacing-btn i {
    font-size: 14px;
}

.section-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.section-controls .spacing-btn {
    flex: 1;
    min-width: 120px;
}

/* Property group improvements */
.property-group {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}

.property-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.property-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.property-value {
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* Enhanced delete button */
.delete-element-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.delete-element-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

/* Typography Preview Section */
.typography-preview {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.typography-preview h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.typography-preview .preview-text {
    margin: 0;
    padding: 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
}

/* Responsive improvements for mobile */
@media (max-width: 768px) {
    .size-controls,
    .color-controls,
    .spacing-controls {
        gap: 6px;
    }
    
    .size-btn {
        min-width: 50px;
        padding: 8px 10px;
        font-size: 11px;
    }
    
    .color-btn {
        width: 32px;
        height: 32px;
    }
    
    .spacing-btn {
        padding: 10px 12px;
        font-size: 11px;
    }
    
    .property-input,
    .property-textarea {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .size-slider-container,
    .spacing-slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .size-display,
    .spacing-display {
        justify-content: center;
        min-width: auto;
    }
    
    .size-input,
    .spacing-input {
        width: 60px;
    }
}

/* Enhanced visual feedback */
.property-input:invalid {
    border-color: #ef4444;
    background: #fef2f2;
}

.property-input:valid {
    border-color: #22c55e;
}

/* Loading states */
.spacing-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spacing-btn.loading {
    position: relative;
}

.spacing-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Better hover states for interactive elements */
.editable-text:not(.cta-button):hover {
    background: rgba(56, 182, 255, 0.05);
    border-radius: 4px;
    cursor: text;
}

.editable-text:not(.cta-button):focus {
    background: rgba(56, 182, 255, 0.1);
    outline: 2px solid rgba(56, 182, 255, 0.3);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Enhanced styling for specific control groups */
.property-group[data-type="advanced"] {
    background: #f8faff;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.property-group[data-type="advanced"] label {
    color: #38B6FF;
}

/* File upload styling */
input[type="file"] {
    display: none;
}

.upload-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed #38B6FF;
    border-radius: 8px;
    background: #f8faff;
    color: #38B6FF;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.upload-trigger:hover {
    background: #f0f7ff;
    border-color: #3b82f6;
}

/* Tooltip improvements */
[title] {
    position: relative;
    cursor: default; /* Changed from cursor: help */
}

/* Enhanced focus indicators for accessibility */
.size-btn:focus,
.color-btn:focus,
.spacing-btn:focus {
    outline: 2px solid #38B6FF;
    outline-offset: 2px;
}

/* Dark mode support for properties panel */
@media (prefers-color-scheme: dark) {
    .property-input,
    .property-textarea {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .property-input:focus,
    .property-textarea:focus {
        background: #1f2937;
        border-color: #60a5fa;
    }
    
    .size-btn,
    .spacing-btn {
        background: #374151;
        border-color: #4b5563;
        color: white;
    }
    
    .size-btn:hover,
    .spacing-btn:hover {
        background: #4b5563;
        border-color: #60a5fa;
    }
    
    .size-slider-container {
        background: #374151;
        border-color: #4b5563;
    }
    
    .spacing-slider-container {
        background: #1e3a8a;
        border-color: #3b82f6;
    }
}

/* Ensure page elements containing dividers have no padding/background */
.page-element[data-type="divider"] {
    padding: 0 !important;
    background: transparent !important;
    margin: 0 !important;
    min-height: auto !important;
}
/* Template Container Full Width Support */
.template-container {
    box-sizing: border-box;
}

/* Preserve inline grid/flex layouts inside templates — undo global
   centering and max-width caps that break multi-column template sections. */
.template-container div[style*="grid-template-columns"],
.template-container div[style*="display:grid"],
.template-container div[style*="display: grid"] {
    justify-items: stretch;
    max-width: none;
}
.template-container div[style*="display:flex"],
.template-container div[style*="display: flex"] {
    justify-content: inherit;
}

.template-container[style*="max-width: 100%"] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Ensure canvas can expand to full viewport width */
.canvas {
    min-width: 100%;
    box-sizing: border-box;
}

/* Canvas wrapper full width support */
.canvas-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Canvas wrapper default background (the area behind the page) */
.canvas-wrapper {
    background-color: #e8e8e8;
}

/* Template Container Background (the page itself) */
.template-container {
    background-color: #ffffff;
    min-height: 100vh;
    margin: 0 auto;
}

/* Enhanced Width Property Panel CSS */
.width-controls {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.width-controls:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #38B6FF;
}

.width-controls input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #38B6FF 0%, #2196F3 100%);
    outline: none;
    cursor: pointer;
    margin-bottom: 8px;
}

.width-controls input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
    border: 3px solid white;
    transition: all 0.2s ease;
}

.width-controls input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(56, 182, 255, 0.4);
}

.width-controls input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
}

.width-presets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.preset-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

.preset-btn:hover {
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    color: white;
    border-color: #38B6FF;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
}

.preset-btn.active {
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    color: white;
    border-color: #38B6FF;
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
}

.preset-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 2px;
}

.preset-value {
    display: block;
    font-size: 10px;
    opacity: 0.8;
}

/* Enhanced size slider container */
.size-slider-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.size-slider-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #38B6FF;
}

.size-slider {
    background: linear-gradient(90deg, #38B6FF 0%, #2196F3 100%);
    height: 8px;
    border-radius: 4px;
}

.size-slider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
}

.size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(56, 182, 255, 0.4);
}

.size-display {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.size-input {
    border: none;
    background: transparent;
    font-weight: 600;
    color: #38B6FF;
    text-align: center;
    width: 60px;
}

.size-input:focus {
    outline: none;
    background: rgba(56, 182, 255, 0.1);
    border-radius: 4px;
}

.size-unit {
    color: #6c757d;
    font-weight: 500;
    font-size: 12px;
}

/* Enhanced property group styling */
.property-group {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.property-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #38B6FF;
}

.property-group label {
    color: #495057;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 12px;
    display: block;
}

/* Enhanced color picker styling */
.color-picker {
    width: 100%;
    height: 40px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.color-picker:hover {
    border-color: #38B6FF;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.2);
}

/* Enhanced gradient controls */
.gradient-controls {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.gradient-stops {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.gradient-stop {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gradient-stop label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.gradient-stop-picker {
    width: 100%;
    height: 32px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gradient-stop-picker:hover {
    border-color: #38B6FF;
    transform: translateY(-1px);
}

.gradient-angle {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gradient-angle label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin: 0;
}

.gradient-angle-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #38B6FF 0%, #2196F3 100%);
    outline: none;
    cursor: pointer;
}

.gradient-angle-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
}

/* Enhanced font family dropdown */
.font-family-dropdown {
    position: relative;
    display: inline-block;
    width: 100%;
}

.font-family-dropdown select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%234A90F2' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.font-family-dropdown select:hover {
    border-color: #38B6FF;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.2);
}

.font-family-dropdown select:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
}

/* Font preview styling */
.font-preview {
    font-size: 14px;
    color: #6c757d;
    margin-top: 4px;
    font-style: italic;
}

/* Enhanced toggle switches */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    background: #dee2e6;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::after {
    transform: translateX(26px);
}

/* Enhanced button styling */
.enhanced-btn {
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
}

.enhanced-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.4);
}

.enhanced-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
}

/* Dark mode support for enhanced controls */
@media (prefers-color-scheme: dark) {
    .width-controls,
    .size-slider-container,
    .gradient-controls {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
        border-color: #4b5563;
    }
    
    .property-group {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
        border-color: #4b5563;
    }
    
    .property-group label {
        color: #e5e7eb;
    }
    
    .preset-btn {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
        border-color: #4b5563;
        color: #e5e7eb;
    }
    
    .preset-btn:hover {
        background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
        color: white;
    }
    
    .size-display {
        background: #374151;
        border-color: #4b5563;
    }
    
    .size-input {
        color: #38B6FF;
    }
    
    .size-unit {
        color: #9ca3af;
    }
    
    .font-family-dropdown select {
        background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
        border-color: #4b5563;
        color: #e5e7eb;
    }
    
    .font-preview {
        color: #9ca3af;
    }
}

/* Enhanced Width Element Property Panel Styling */
.property-group[data-type="width-controls"] {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.property-group[data-type="width-controls"]:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.property-group[data-type="width-controls"] label {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    text-transform: none;
    letter-spacing: 0.3px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.property-group[data-type="width-controls"] label::before {
    content: '📏';
    font-size: 16px;
}

/* Enhanced Size Slider Container */
.property-group[data-type="width-controls"] .size-slider-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.property-group[data-type="width-controls"] .size-slider-container:focus-within {
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1), inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Enhanced Slider Styling */
.property-group[data-type="width-controls"] .size-slider {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.property-group[data-type="width-controls"] .size-slider::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
    border: 3px solid #ffffff;
    transition: all 0.3s ease;
}

.property-group[data-type="width-controls"] .size-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 12px rgba(56, 182, 255, 0.4);
}

.property-group[data-type="width-controls"] .size-slider::-webkit-slider-thumb:active {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
}

.property-group[data-type="width-controls"] .size-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    cursor: pointer;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 8px rgba(56, 182, 255, 0.3);
}

/* Enhanced Size Display */
.property-group[data-type="width-controls"] .size-display {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 100px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.property-group[data-type="width-controls"] .size-input {
    width: 60px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.3s ease;
}

.property-group[data-type="width-controls"] .size-input:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    background: #ffffff;
}

.property-group[data-type="width-controls"] .size-unit {
    font-size: 13px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Size Controls */
.property-group[data-type="width-controls"] .size-controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.property-group[data-type="width-controls"] .size-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    color: #475569;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.property-group[data-type="width-controls"] .size-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s ease;
}

.property-group[data-type="width-controls"] .size-btn:hover {
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    border-color: #38B6FF;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.3);
}

.property-group[data-type="width-controls"] .size-btn:hover::before {
    left: 100%;
}

.property-group[data-type="width-controls"] .size-btn.active {
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    border-color: #38B6FF;
    color: white;
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.3);
}

.property-group[data-type="width-controls"] .size-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(56, 182, 255, 0.3);
}

/* Width Value Indicator */
.width-value-indicator {
    position: absolute;
    top: -8px;
    right: 12px;
    background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(56, 182, 255, 0.3);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.property-group[data-type="width-controls"]:hover .width-value-indicator {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .property-group[data-type="width-controls"] {
        padding: 16px;
    }
    
    .property-group[data-type="width-controls"] .size-controls {
        grid-template-columns: 1fr;
    }
    
    .property-group[data-type="width-controls"] .size-slider-container {
        padding: 12px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .property-group[data-type="width-controls"] {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-color: #334155;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .property-group[data-type="width-controls"] label {
        color: #e2e8f0;
    }
    
    .property-group[data-type="width-controls"] .size-slider-container {
        background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
        border-color: #475569;
    }
    
    .property-group[data-type="width-controls"] .size-slider {
        background: linear-gradient(90deg, #475569 0%, #334155 100%);
    }
    
    .property-group[data-type="width-controls"] .size-display {
        background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
        border-color: #475569;
    }
    
    .property-group[data-type="width-controls"] .size-input {
        background: #1e293b;
        border-color: #475569;
        color: #e2e8f0;
    }
    
    .property-group[data-type="width-controls"] .size-unit {
        color: #94a3b8;
    }
    
    .property-group[data-type="width-controls"] .size-btn {
        background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
        border-color: #475569;
        color: #cbd5e1;
    }
    
    .property-group[data-type="width-controls"] .size-btn:hover {
        background: linear-gradient(135deg, #38B6FF 0%, #2196F3 100%);
        color: white;
    }
}

/* Animation for smooth transitions */
@keyframes widthControlFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.property-group[data-type="width-controls"] {
    animation: widthControlFadeIn 0.3s ease-out;
}

/* Loading state for width controls */
.property-group[data-type="width-controls"].loading {
    position: relative;
    pointer-events: none;
}

/* --- Cropper modal hardening (prevents editor styles from interfering) --- */
#image-crop-modal,
#image-cropper-modal,
#video-poster-cropper-modal {
    pointer-events: auto;
}

#image-crop-modal #loading-indicator,
#image-cropper-modal #loading-indicator,
#video-poster-cropper-modal #loading-indicator {
    pointer-events: none !important;
}

/* Ensure cropper drag/resize is interactive */
#image-crop-modal .cropper-container,
#image-crop-modal .cropper-container *,
#image-cropper-modal .cropper-container,
#image-cropper-modal .cropper-container *,
#video-poster-cropper-modal .cropper-container,
#video-poster-cropper-modal .cropper-container * {
    pointer-events: auto !important;
}

/* Keep gestures inside the cropper from triggering browser behaviors */
#image-crop-modal #image-preview-container,
#image-cropper-modal #image-preview-container,
#video-poster-cropper-modal #image-preview-container {
    touch-action: none;
}

/* Keep action buttons clickable above any cropper overlays */
#image-crop-modal button,
#image-cropper-modal button,
#video-poster-cropper-modal button {
    position: relative;
    z-index: 10001;
}

/* Crop box visibility (helps when Cropper.css is missing/overridden) */
#image-crop-modal .cropper-crop-box,
#image-crop-modal .cropper-view-box,
#image-cropper-modal .cropper-crop-box,
#image-cropper-modal .cropper-view-box,
#video-poster-cropper-modal .cropper-crop-box,
#video-poster-cropper-modal .cropper-view-box {
    outline: 2px solid rgba(99, 102, 241, 0.95) !important;
}

#image-crop-modal .cropper-face,
#image-cropper-modal .cropper-face,
#video-poster-cropper-modal .cropper-face {
    background-color: rgba(99, 102, 241, 0.14) !important;
    opacity: 1 !important;
}

#image-crop-modal .cropper-line,
#image-crop-modal .cropper-point,
#image-cropper-modal .cropper-line,
#image-cropper-modal .cropper-point,
#video-poster-cropper-modal .cropper-line,
#video-poster-cropper-modal .cropper-point {
    background-color: rgba(99, 102, 241, 0.95) !important;
    opacity: 1 !important;
}

#image-crop-modal .cropper-point,
#image-cropper-modal .cropper-point,
#video-poster-cropper-modal .cropper-point {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
}

/* Minimal Cropper.css essentials (scoped) — ensures the crop box exists even if CDN CSS fails */
#image-crop-modal .cropper-container,
#image-cropper-modal .cropper-container,
#video-poster-cropper-modal .cropper-container {
    position: relative !important;
    direction: ltr !important;
    font-size: 0 !important;
    line-height: 0 !important;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    overflow: hidden !important;
    background: transparent !important;
}

#image-crop-modal .cropper-container img,
#image-cropper-modal .cropper-container img,
#video-poster-cropper-modal .cropper-container img {
    display: block !important;
    /* IMPORTANT: don't override Cropper's runtime sizing/positioning; it uses inline styles */
}

#image-crop-modal .cropper-wrap-box,
#image-cropper-modal .cropper-wrap-box,
#image-crop-modal .cropper-canvas,
#image-cropper-modal .cropper-canvas,
#image-crop-modal .cropper-drag-box,
#image-cropper-modal .cropper-drag-box,
#image-crop-modal .cropper-modal,
#image-cropper-modal .cropper-modal,
#video-poster-cropper-modal .cropper-wrap-box,
#video-poster-cropper-modal .cropper-canvas,
#video-poster-cropper-modal .cropper-drag-box,
#video-poster-cropper-modal .cropper-modal {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
}

#image-crop-modal .cropper-drag-box,
#image-cropper-modal .cropper-drag-box,
#video-poster-cropper-modal .cropper-drag-box {
    opacity: 0 !important;
    background-color: #fff !important;
    cursor: move !important;
}

#image-crop-modal .cropper-modal,
#image-cropper-modal .cropper-modal,
#video-poster-cropper-modal .cropper-modal {
    opacity: 0.5 !important;
    background-color: #000 !important;
}

#image-crop-modal .cropper-view-box,
#image-cropper-modal .cropper-view-box,
#video-poster-cropper-modal .cropper-view-box {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    outline: 1px solid rgba(255, 255, 255, 0.6) !important;
}

#image-crop-modal .cropper-face,
#image-cropper-modal .cropper-face,
#video-poster-cropper-modal .cropper-face {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    cursor: move !important;
}

/* Handle positioning (common Cropper.js classes) */
#image-crop-modal .cropper-point,
#image-cropper-modal .cropper-point,
#video-poster-cropper-modal .cropper-point {
    position: absolute !important;
}
#image-crop-modal .cropper-point.point-nw,
#image-cropper-modal .cropper-point.point-nw,
#video-poster-cropper-modal .cropper-point.point-nw { left: -5px !important; top: -5px !important; cursor: nwse-resize !important; }
#image-crop-modal .cropper-point.point-ne,
#image-cropper-modal .cropper-point.point-ne,
#video-poster-cropper-modal .cropper-point.point-ne { right: -5px !important; top: -5px !important; cursor: nesw-resize !important; }
#image-crop-modal .cropper-point.point-sw,
#image-cropper-modal .cropper-point.point-sw,
#video-poster-cropper-modal .cropper-point.point-sw { left: -5px !important; bottom: -5px !important; cursor: nesw-resize !important; }
#image-crop-modal .cropper-point.point-se,
#image-cropper-modal .cropper-point.point-se,
#video-poster-cropper-modal .cropper-point.point-se { right: -5px !important; bottom: -5px !important; cursor: nwse-resize !important; }

#image-crop-modal .cropper-line,
#image-cropper-modal .cropper-line,
#video-poster-cropper-modal .cropper-line {
    position: absolute !important;
}
#image-crop-modal .cropper-line.line-n,
#image-cropper-modal .cropper-line.line-n,
#video-poster-cropper-modal .cropper-line.line-n { top: -3px !important; left: 0 !important; right: 0 !important; height: 6px !important; cursor: ns-resize !important; }
#image-crop-modal .cropper-line.line-s,
#image-cropper-modal .cropper-line.line-s,
#video-poster-cropper-modal .cropper-line.line-s { bottom: -3px !important; left: 0 !important; right: 0 !important; height: 6px !important; cursor: ns-resize !important; }
#image-crop-modal .cropper-line.line-e,
#image-cropper-modal .cropper-line.line-e,
#video-poster-cropper-modal .cropper-line.line-e { right: -3px !important; top: 0 !important; bottom: 0 !important; width: 6px !important; cursor: ew-resize !important; }
#image-crop-modal .cropper-line.line-w,
#image-cropper-modal .cropper-line.line-w,
#video-poster-cropper-modal .cropper-line.line-w { left: -3px !important; top: 0 !important; bottom: 0 !important; width: 6px !important; cursor: ew-resize !important; }

.property-group[data-type="width-controls"].loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.property-group[data-type="width-controls"].loading::before {
    content: '⏳';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    z-index: 11;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Font Selector Styles */
.font-selector-container {
    position: relative;
    margin-bottom: 10px;
}

.font-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.font-selector:hover {
    border-color: #38B6FF;
}

.font-selector:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.2);
}

.font-selector optgroup {
    font-weight: 600;
    color: #666;
    background: #f5f5f5;
}

.font-selector option {
    padding: 4px 8px;
    font-size: 14px;
}

.font-preview {
    margin-top: 8px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    min-height: 40px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.font-preview:hover {
    background: #e9ecef;
    border-color: #38B6FF;
}

.preview-text {
    font-size: 16px;
    line-height: 1.4;
    color: #333;
    font-weight: 400;
}

/* Dark mode support for font selector */
@media (prefers-color-scheme: dark) {
    .font-selector {
        background: #2a2a2a;
        border-color: #3a3a3a;
        color: #ffffff;
    }
    
    .font-selector:hover {
        border-color: #38B6FF;
    }
    
    .font-selector:focus {
        border-color: #38B6FF;
        box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.3);
    }
    
    .font-selector optgroup {
        background: #1a1a1a;
        color: #888;
    }
    
    .font-preview {
        background: #1a1a1a;
        border-color: #3a3a3a;
    }
    
    .font-preview:hover {
        background: #2a2a2a;
        border-color: #38B6FF;
    }
    
    .preview-text {
        color: #ffffff;
    }
}

/* Font preview animations */
.font-preview {
    animation: fontPreviewFadeIn 0.3s ease-out;
}

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

/* Responsive font selector */
@media (max-width: 768px) {
    .font-selector-container {
        margin-bottom: 8px;
    }
    
    .font-preview {
        padding: 8px;
        min-height: 32px;
    }
    
    .preview-text {
        font-size: 14px;
    }
}

/* Modern Gradient Controls Styles */
.gradient-controls {
    margin-top: 12px;
}

.gradient-toggle {
    margin-bottom: 16px;
}

.gradient-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
    padding: 4px 0;
}

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

.gradient-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: #e1e5e9;
    border-radius: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-right: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.gradient-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.gradient-switch input:checked + .gradient-slider {
    background: linear-gradient(135deg, #38B6FF, #2196F3);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 0 0 3px rgba(56, 182, 255, 0.1);
}

.gradient-switch input:checked + .gradient-slider:before {
    transform: translateX(20px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.gradient-label {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
}

.gradient-settings {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
    border: 1px solid #e2e8f0;
}

/* Gradient Preview */
.gradient-preview-container {
    margin-bottom: 28px;
}

.gradient-preview {
    background-color: #f1f5f9 !important;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.preview-text {
    font-weight: 700;
    font-size: 18px;
    text-align: center;
    background: linear-gradient(45deg, #38B6FF, #2196F3);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    z-index: 1;
    position: relative;
}

/* Gradient Sections */
.gradient-section {
    margin-bottom: 28px;
}

.gradient-section:last-child {
    margin-bottom: 0;
}

.gradient-section-header {
    margin-bottom: 16px;
}

.section-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.section-subtitle {
    display: block;
    font-size: 12px;
    color: #718096;
    font-weight: 400;
}

/* Direction Controls */
.gradient-direction-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 8px;
}

.gradient-direction-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 60px;
    height: 60px;
    justify-content: center;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.gradient-direction-btn:hover {
    border-color: #38B6FF;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.2);
}

.gradient-direction-btn.active {
    border-color: #38B6FF;
    background: linear-gradient(135deg, rgba(56, 182, 255, 0.1), rgba(53, 122, 189, 0.1));
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.1);
    transform: translateY(-1px);
}

.direction-icon {
    font-size: 18px;
    font-weight: bold;
    color: #38B6FF;
    margin-bottom: 4px;
    line-height: 1;
}

.direction-label {
    font-size: 11px;
    font-weight: 500;
    color: #4a5568;
    text-align: center;
    line-height: 1.2;
}

/* Color Controls */
.gradient-color-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.color-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.color-label {
    font-size: 16px;
    font-weight: 700;
    color: #000000 !important;
    margin-bottom: 10px;
    text-align: center;
    text-transform: none !important;
}

.gradient-color-picker {
    width: 48px;
    height: 48px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    background: white;
    transition: all 0.2s ease;
    box-shadow: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.gradient-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 6px;
    overflow: hidden;
}

.gradient-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
    width: 100%;
    height: 100%;
}

.gradient-color-picker::-moz-color-swatch {
    border: none;
    border-radius: 6px;
    width: 100%;
    height: 100%;
}

.gradient-color-picker:hover {
    border-color: #38B6FF;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

/* Preset Grid */
.gradient-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 8px;
}

.gradient-preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 60px;
    justify-content: center;
}

.gradient-preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.preset-gradient {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: none;
}

.preset-label {
    font-size: 14px;
    font-weight: 700;
    color: #000000 !important;
    text-align: center;
    text-shadow: none;
}

/* Ensure gradient text is visible above selection highlights */
.editable-text.sub-element-selected[data-gradient-enabled="true"] {
    z-index: 100 !important;
    position: relative !important;
}

.editable-text.sub-element-selected[data-gradient-enabled="true"] * {
    z-index: inherit !important;
}

/* Force gradient text to be visible above selection outline */
.editable-text.sub-element-selected[data-gradient-enabled="true"] {
    outline: none !important;
    box-shadow: none !important;
}

/* Alternative selection indicator for gradient text - transparent blue like before */
.editable-text.sub-element-selected[data-gradient-enabled="true"]::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(56, 182, 255, 0.6);
    border-radius: 4px;
    pointer-events: none;
    z-index: 99;
    background: rgba(56, 182, 255, 0.1);
}

/* Ensure gradient text content is always visible */
.editable-text.sub-element-selected[data-gradient-enabled="true"] {
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    z-index: 101 !important;
    mix-blend-mode: normal !important;
}

/* Force gradient visibility above selection indicator */
.editable-text.sub-element-selected[data-gradient-enabled="true"] {
    isolation: isolate !important;
}

/* Ensure gradient text is always visible for elements with gradient-enabled class */
.editable-text.gradient-enabled {
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    z-index: 101 !important;
}

/* Override any conflicting styles for gradient text */
.editable-text.gradient-enabled[style*="background"] {
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

/* Button-specific gradient label styles */
#button-text-gradient-section .color-label,
#button-icon-gradient-section .color-label,
#button-background-gradient-section .color-label {
    color: #ffffff !important;
    font-size: 18px !important;
    font-weight: 700 !important;
}

#button-text-gradient-section .preset-label,
#button-icon-gradient-section .preset-label,
#button-background-gradient-section .preset-label {
    color: #ffffff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}

/* Font Preview Styles */
.font-preview {
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9f9f9;
    font-size: 14px;
    min-height: 24px;
    line-height: 1.4;
    color: #333;
    transition: all 0.2s ease;
}

.font-preview:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

/* Font Selector Dropdown Styles */
.font-preview-select {
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.font-preview-select:hover {
    border-color: #38B6FF;
}

.font-preview-select:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.2);
}

/* Font option styles */
.font-preview-select option {
    padding: 8px;
    font-size: 14px;
}

.font-preview-select optgroup {
    font-weight: 600;
    color: #38B6FF;
    background: #f8f9fa;
}

.font-preview-select optgroup option {
    font-weight: normal;
    color: #333;
    background: white;
}

/* Prevent text elements from shifting when selected */
.editable-text.sub-element-selected {
    position: static !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    margin-left: inherit !important;
    margin-right: inherit !important;
    text-align: inherit !important;
    outline-offset: 4px !important;
    box-sizing: border-box !important;
}

/* Override for gradient text elements to ensure visibility */
.editable-text.sub-element-selected[data-gradient-enabled="true"] {
    z-index: 100 !important;
    position: relative !important;
}

/* Override any positioning changes from parent selection states */
/* Override any positioning changes from parent selection states */
.page-element.selected .editable-text.sub-element-selected,
.container-item.selected .editable-text.sub-element-selected {
    position: static !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    margin-left: inherit !important;
    margin-right: inherit !important;
    text-align: inherit !important;
}

/* CRITICAL FIX: Override the .editable-text.gradient-enabled rule specifically for buttons */
.cta-button.editable-text.gradient-enabled,
button.editable-text.gradient-enabled,
.cta-button.editable-text.background-gradient-enabled,
button.editable-text.background-gradient-enabled {
    background-clip: border-box !important;
    -webkit-background-clip: border-box !important;
    -webkit-text-fill-color: unset !important;
    color: inherit !important;
}

/* Ensure all children of gradient buttons remain visible */
.cta-button.editable-text.gradient-enabled *,
button.editable-text.gradient-enabled *,
.cta-button.editable-text.background-gradient-enabled *,
button.editable-text.background-gradient-enabled * {
    color: inherit !important;
    -webkit-text-fill-color: unset !important;
    background-clip: border-box !important;
    -webkit-background-clip: border-box !important;
}

/* Button gradient section text styling - ensure all text is white */
#individual-button-gradient-section .color-label,
#individual-button-gradient-section .preset-label,
#individual-button-gradient-section .direction-label {
    color: white !important;
}

#individual-button-gradient-section .color-label {
    font-size: 16px !important;
    font-weight: 600 !important;
}

#individual-button-gradient-section .preset-label {
    font-size: 16px !important;
    font-weight: 600 !important;
}

#individual-button-gradient-section .direction-label {
    font-size: 14px !important;
    font-weight: 600 !important;
}

/* CRITICAL FIX: Ensure text gradients work properly even when buttons have background gradients */
.cta-button span.gradient-enabled,
button span.gradient-enabled {
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    position: relative !important;
    z-index: 10 !important;
    display: inline-block !important;
}

/* Override any conflicting styles from button background gradients */
.cta-button.background-gradient-enabled span.gradient-enabled,
button.background-gradient-enabled span.gradient-enabled {
    background-clip: text !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    position: relative !important;
    z-index: 10 !important;
    display: inline-block !important;
}


/* Icon Dropdown Styles */
.icon-dropdown-container {
    position: relative;
    width: 100%;
}

.icon-dropdown {
    position: relative;
    width: 100%;
}

.icon-dropdown-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.icon-dropdown-selected:hover {
    background: #333;
    border-color: #38B6FF;
}

.icon-dropdown-selected i:first-child {
    font-size: 16px;
    color: #38B6FF;
    width: 20px;
    text-align: center;
}

.icon-dropdown-selected span {
    flex: 1;
    color: #fff;
}

.dropdown-arrow {
    font-size: 12px;
    color: #888;
    transition: transform 0.2s ease;
}

.icon-dropdown-selected.active .dropdown-arrow {
    transform: rotate(180deg);
}

.icon-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
}

.icon-search-container {
    padding: 8px;
    border-bottom: 1px solid #3a3a3a;
}

.icon-search-input {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.icon-search-input:focus {
    border-color: #38B6FF;
}

.icon-search-input::placeholder {
    color: #666;
}

.icon-dropdown-list {
    max-height: 240px;
    overflow-y: auto;
}

.icon-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #333;
}

.icon-dropdown-item:last-child {
    border-bottom: none;
}

.icon-dropdown-item:hover {
    background: #333;
}

.icon-dropdown-item i {
    font-size: 16px;
    color: #38B6FF;
    width: 20px;
    text-align: center;
}

.icon-dropdown-item span {
    color: #fff;
    font-size: 14px;
}

/* Scrollbar styling for dropdown */
.icon-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.icon-dropdown-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.icon-dropdown-list::-webkit-scrollbar-thumb {
    background: #38B6FF;
    border-radius: 3px;
}

.icon-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #2196F3;
}

/* New Element Styles */
.image-element, .video-element, .timer-element {
    position: relative;
    transition: all 0.3s ease;
}

.image-element:hover {
    transform: none;
}

/* Hover lift looks like a "jump" when moving over the full-width wrapper's blank space.
   Keep it for timers, but disable for videos (videos already have a frame hover outline). */
.timer-element:hover {
    transform: translateY(-2px);
}

.image-container, .video-container {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-placeholder, .video-placeholder {
    transition: all 0.3s ease;
    cursor: pointer;
}

.image-placeholder:hover {
    background: #f0f0f0 !important;
    border-color: #38B6FF !important;
}

/* Video placeholders: keep dark styling on hover (avoid "turns white" look) */
.video-placeholder:hover {
    background: radial-gradient(900px circle at 10% 10%, rgba(56, 182, 255, 0.24), transparent 55%),
                radial-gradient(700px circle at 90% 30%, rgba(125, 211, 252, 0.18), transparent 60%),
                rgba(15, 23, 42, 0.94) !important;
}

.video-placeholder:hover .video-placeholder-icon {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.18);
}

.video-placeholder:hover .video-placeholder-title {
    color: rgba(255,255,255,0.96);
}

.video-placeholder:hover .video-placeholder-subtitle {
    color: rgba(255,255,255,0.76);
}

/* Override hover background for default images (no image loaded) */
.image-frame:not(:has(img.image-display[style*="display: block"])) .image-placeholder:hover {
    background: transparent !important;
    border-color: transparent !important;
}

.image-display, .video-display {
    width: 100%;
    height: auto;
    transition: all 0.3s ease;
    image-rendering: high-quality;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: bicubic;
}

.video-thumbnail {
    transition: all 0.3s ease;
}

.video-thumbnail:hover .play-button {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(0,0,0,0.8);
}

/* -------------------------------------------------
   Carrd-style video (v2) - image-like frame system
------------------------------------------------- */
.video-element {
    width: 100%;
    display: flex;
    justify-content: center;
    /* Outer spacing handled via margins; inner padding handled via --video-inner-pad on .video-frame */
    padding: 0;
    box-sizing: border-box;
}

/* -------------------------------------------------
   Carrd-style list (v2) - simpler, cleaner, less "designed"
------------------------------------------------- */
/* Flex wrapper so .list-element centers via align-self without JS transform hacks
   (transform + margin:auto + left:50% caused jump/shift on select). */
.page-element[data-type="list"],
.container-item[data-type="list"] {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-element[data-type="list"]:hover,
.page-element[data-type="list"].selected,
.container-item[data-type="list"]:hover,
.container-item[data-type="list"].selected {
    /* Don't outline the full-width wrapper; hug the actual list block */
    outline: none !important;
    box-shadow: none !important;
    border-color: transparent !important;
}

.page-element[data-type="list"]:hover .list-element,
.container-item[data-type="list"]:hover .list-element {
    outline: 2px dashed rgba(56, 182, 255, 0.35);
    outline-offset: 0;
}

.page-element[data-type="list"].selected .list-element,
.container-item[data-type="list"].selected .list-element {
    /* outline-offset and outer rings were shifting the list visually vs unselected */
    outline: 2px solid #38B6FF;
    outline-offset: 0;
    box-shadow: none;
}

.list-element {
    /* The list "block" should be the thing that changes width (and gets outlined),
       not just the inner <ul>. This makes bullets/numbers and text move together. */
    width: min(100%, var(--list-width, 600px));
    display: flex;
    justify-content: flex-start;
    padding: 0;
    box-sizing: border-box;
    /* Lists should be left-aligned even though the editor centers most content */
    text-align: left;
    /* Typography */
    --list-font-family: inherit;
    --list-font-size: 16px;
    --list-text-color: #334155;
    /* Unitless so it scales cleanly with font size */
    --list-line-height: 1.55;
    /* Marker sizing (separate from text font size) */
    --list-marker-size: 20px;
    --list-marker-font-size: 16px;
    /* Indent from the left edge to the marker/text block */
    --list-bullet-indent: 0px;
    /* Spacing between marker and text */
    --list-marker-gap: 8px;
    /* User-controllable directional margins */
    margin: var(--list-mt, 24px) var(--list-mr, 0px) var(--list-mb, 24px) var(--list-ml, 0px);
}

.list-element .list-title {
    width: min(600px, 100%);
    margin: 24px 24px 14px;
    font-size: 22px;
    line-height: 1.25;
    font-weight: 800;
    color: #111827;
}

.list-element .carrd-list {
    width: 100%;
    /* Width is controlled by `.list-element` so the whole element resizes together */
    max-width: 100%;
    margin: 0;
    padding: 0 0 0 var(--list-bullet-indent, 0px);
    list-style: none;
    display: grid;
    gap: var(--list-gap, 12px);
    /* Accent is set by JS on the <ul> via inline style (--list-accent) */
}

.list-element .carrd-list > li {
    display: grid;
    grid-template-columns: var(--list-marker-size) 1fr;
    column-gap: var(--list-marker-gap, 8px);
    /* Align from the top so marker can be centered within the first line box */
    align-items: start;
    color: var(--list-text-color, #334155);
    line-height: var(--list-line-height, 1.55);
    font-family: var(--list-font-family, inherit);
    /* Make `em/ch/lh` sizing consistent and keep baseline behavior stable */
    font-size: var(--list-font-size, 16px);
    text-align: left;
}

.list-element .carrd-list > li .list-item-content {
    /* Inline content gives a reliable text baseline for grid baseline alignment */
    display: inline;
    padding-left: 0;
    /* Text font size should NOT resize markers */
    font-size: inherit;
}

.list-element .carrd-list > li::before {
    content: "•";
    color: rgba(51, 65, 85, 0.6);
    font-weight: 900;
    font-size: var(--list-marker-font-size, 16px);
    /* Center marker within the FIRST line of the text block (not the whole item).
       Use a calc() fallback instead of `1lh` for broader compatibility. */
    line-height: 1;
    height: calc(var(--list-font-size, 16px) * var(--list-line-height, 1.55));
    display: grid;
    place-items: center;
    transform: none;
    /* Keep markers snug to the text edge even when marker column width grows */
    justify-self: end;
    text-align: right;
    align-self: start;
}

.list-element .carrd-list[data-list-style="checkmark"] > li::before {
    content: "✓";
    color: var(--list-accent);
}

.list-element .carrd-list[data-list-style="arrow"] > li::before {
    content: "→";
    color: var(--list-accent);
}

.list-element .carrd-list[data-list-style="bullet"] > li::before {
    content: "•";
    color: var(--list-accent);
}

.list-element .carrd-list[data-list-style="number"] {
    counter-reset: carrdList;
}

.list-element .carrd-list[data-list-style="number"] > li {
    counter-increment: carrdList;
}

.list-element .carrd-list[data-list-style="number"] > li::before {
    content: counter(carrdList) ".";
    color: var(--list-accent);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------
   Carrd-style icon element
------------------------------------------------- */
.page-element[data-type="icon"],
.container-item[data-type="icon"] {
    /* Defaults (overridden by inline CSS vars set from JS) */
    --icon-size: 64px;
    --icon-font-size: 28px;
    --icon-bg: #38B6FF;
    --icon-color: #ffffff;
    --icon-gap: 12px;
    --icon-radius: 999px;
    --icon-border-width: 0px;
    --icon-border-color: rgba(15, 23, 42, 0.12);
    --icon-shadow: 0 10px 25px rgba(2, 6, 23, 0.18);
    --icon-mt: 24px;
    --icon-mr: 0px;
    --icon-mb: 24px;
    --icon-ml: 0px;
}

.page-element[data-type="icon"] .icon-element,
.container-item[data-type="icon"] .icon-element {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: var(--icon-mt, 24px) var(--icon-mr, 0px) var(--icon-mb, 24px) var(--icon-ml, 0px);
    box-sizing: border-box;
}

.page-element[data-type="icon"] .icon-row,
.container-item[data-type="icon"] .icon-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--icon-gap, 12px);
    /* default: shrink to content, but allow wrapping when constrained by max-width */
    width: max-content;
    max-width: 100%;
    box-sizing: border-box;
}

.page-element[data-type="icon"] .icon-row[data-direction="vertical"],
.container-item[data-type="icon"] .icon-row[data-direction="vertical"] {
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.page-element[data-type="icon"] .icon-row[data-align="left"],
.container-item[data-type="icon"] .icon-row[data-align="left"] {
    justify-content: flex-start;
}

.page-element[data-type="icon"] .icon-row[data-align="center"],
.container-item[data-type="icon"] .icon-row[data-align="center"] {
    justify-content: center;
}

.page-element[data-type="icon"] .icon-row[data-align="right"],
.container-item[data-type="icon"] .icon-row[data-align="right"] {
    justify-content: flex-end;
}

.page-element[data-type="icon"] .icon-row[data-direction="vertical"][data-align="left"],
.container-item[data-type="icon"] .icon-row[data-direction="vertical"][data-align="left"] {
    align-items: flex-start;
}

.page-element[data-type="icon"] .icon-row[data-direction="vertical"][data-align="center"],
.container-item[data-type="icon"] .icon-row[data-direction="vertical"][data-align="center"] {
    align-items: center;
}

.page-element[data-type="icon"] .icon-row[data-direction="vertical"][data-align="right"],
.container-item[data-type="icon"] .icon-row[data-direction="vertical"][data-align="right"] {
    align-items: flex-end;
}

.page-element[data-type="icon"] .icon-link,
.container-item[data-type="icon"] .icon-link,
.page-element[data-type="icon"] .icon-item,
.container-item[data-type="icon"] .icon-item {
    display: inline-flex;
    text-decoration: none;
}

.page-element[data-type="icon"] .icon-row-break,
.container-item[data-type="icon"] .icon-row-break {
    flex-basis: 100%;
    width: 100%;
    height: 0;
    pointer-events: none;
}

.page-element[data-type="icon"] .icon-row[data-direction="vertical"] .icon-row-break,
.container-item[data-type="icon"] .icon-row[data-direction="vertical"] .icon-row-break {
    height: 10px;
}

.page-element[data-type="icon"] .icon-element[data-align="left"],
.container-item[data-type="icon"] .icon-element[data-align="left"] {
    justify-content: flex-start;
}

.page-element[data-type="icon"] .icon-element[data-align="right"],
.container-item[data-type="icon"] .icon-element[data-align="right"] {
    justify-content: flex-end;
}

.page-element[data-type="icon"] .icon-badge,
.container-item[data-type="icon"] .icon-badge {
    width: var(--icon-size, 64px);
    height: var(--icon-size, 64px);
    border-radius: var(--icon-radius, 999px);
    background: var(--icon-bg, #38B6FF);
    border: var(--icon-border-width, 0px) solid var(--icon-border-color, rgba(15, 23, 42, 0.12));
    box-shadow: var(--icon-shadow, 0 10px 25px rgba(2, 6, 23, 0.18));
    display: grid;
    place-items: center;
    box-sizing: border-box;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.page-element[data-type="icon"] .icon-badge .icon-glyph,
.container-item[data-type="icon"] .icon-badge .icon-glyph {
    font-size: var(--icon-font-size, 28px);
    color: var(--icon-color, #ffffff);
    line-height: 1;
}

/* Icon element: suppress full-width wrapper outline; hug the icon-row instead */
.page-element[data-type="icon"]:hover,
.page-element[data-type="icon"].selected,
.container-item[data-type="icon"]:hover,
.container-item[data-type="icon"].selected {
    outline: none !important;
    box-shadow: none !important;
}

.page-element[data-type="icon"]:hover .icon-row,
.container-item[data-type="icon"]:hover .icon-row {
    outline: 2px dashed rgba(56, 182, 255, 0.30);
    outline-offset: 6px;
}

.page-element[data-type="icon"].selected .icon-row,
.container-item[data-type="icon"].selected .icon-row {
    outline: 3px solid #38B6FF;
    outline-offset: 6px;
}

.page-element[data-type="icon"].selected:hover .icon-row,
.container-item[data-type="icon"].selected:hover .icon-row {
    outline: 3px solid #38B6FF;
    outline-offset: 6px;
}

/* Subtle editor affordances */
.page-element[data-type="icon"]:hover .icon-badge,
.container-item[data-type="icon"]:hover .icon-badge {
    filter: brightness(1.02);
}

/* Prevent the generic "container icon hover" outline from affecting icon badges */
.page-element[data-type="icon"] .icon-badge i[class*="fa"]:hover,
.container-item[data-type="icon"] .icon-badge i[class*="fa"]:hover {
    outline: none;
    outline-offset: 0;
    padding: 0;
    background-color: transparent !important;
    border-radius: 0;
}

/* Icon row controls */
.icon-row-card .icon-row-section {
    margin-bottom: 0;
    padding-bottom: 16px;
}

.icon-row-card .icon-row-section label {
    margin-bottom: 8px;
}

.icon-row-card .icon-row-panel-section {
    padding: 18px 16px 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0%, rgba(255, 255, 255, 0.025) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.icon-row-card .icon-row-panel-section label {
    margin-bottom: 10px;
}

.icon-row-card .icon-row-panel-section-icons {
    min-height: 260px;
}

.icon-row-card .icon-row-panel-section-alignment,
.icon-row-card .icon-row-panel-section-gap {
}

.icon-row-card .icon-row-panel-section-row-width {
}

.icon-row-card .icon-row-panel-section-direction,
.icon-row-card .icon-row-panel-section-border {
    min-height: 124px;
}

.icon-row-card .icon-row-panel-section-alignment .icon-segmented-controls,
.icon-row-card .icon-row-panel-section-row-width .icon-segmented-controls,
.icon-row-card .icon-row-panel-section-gap .slider-row {
    margin-top: 8px;
}

.icon-row-card .icon-row-panel-section-row-width .property-hint {
    margin-top: 16px;
}

.icon-row-card .icon-row-panel-section-row-width .icon-row-width-px-wrap {
    margin-top: 18px;
}

.icon-row-card .icon-row-panel-section-alignment,
.icon-row-card .icon-row-panel-section-row-width,
.icon-row-card .icon-row-panel-section-gap {
    box-sizing: border-box !important;
}

.icon-row-card .icon-row-panel-section-alignment {
    padding-bottom: 18px !important;
}

.icon-row-card .icon-row-panel-section-row-width {
    padding-bottom: 18px !important;
}

.icon-row-card .icon-row-panel-section-gap {
    padding-bottom: 18px !important;
}

.icon-row-card .icon-row-intro {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: #94a3b8;
}

.icon-row-card .icon-items-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.icon-row-card .icon-item-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.03) 100%);
}

.icon-row-card .icon-item-row--break {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
}

.icon-row-card .icon-item-preview {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.icon-row-card .icon-item-preview i {
    font-size: 20px;
    color: #0f172a;
}

.icon-row-card .icon-item-preview--break {
    background: linear-gradient(180deg, rgba(56, 182, 255, 0.18) 0%, rgba(56, 182, 255, 0.08) 100%);
    border-color: rgba(56, 182, 255, 0.28);
}

.icon-row-card .icon-item-preview--break i {
    color: #93c5fd;
}

.icon-row-card .icon-item-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.icon-row-card .icon-item-main--break {
    gap: 4px;
}

.icon-row-card .icon-item-break-label {
    font-size: 13px;
    font-weight: 700;
    color: #e5e7eb;
}

.icon-row-card .icon-item-break-help {
    font-size: 12px;
    line-height: 1.45;
    color: #94a3b8;
}

.icon-row-card .icon-item-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.icon-row-card .icon-item-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.icon-row-card .icon-item-toolbar .property-input,
.icon-row-card .icon-item-fields .property-input {
    min-width: 0;
    height: 40px;
}

.icon-row-card .icon-item-remove-btn {
    min-width: 96px;
    height: 40px;
    justify-content: center;
    padding: 0 12px;
    color: #fca5a5;
}

.icon-row-card .icon-item-remove-btn:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.icon-row-card .icon-item-remove-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-row-card .icon-item-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.icon-row-card .icon-item-add-btn,
.icon-row-card .icon-item-add-row-btn,
.icon-row-card .icon-item-reset-btn {
    justify-content: center;
    min-height: 44px;
}

.icon-row-card .icon-item-reset-btn {
    min-width: 0;
}

.icon-row-card .icon-segmented-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.icon-row-card .icon-direction-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.icon-row-card .icon-segment-btn {
    min-height: 38px;
    padding: 8px 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #cbd5e1;
}

.icon-row-card .icon-segment-btn i {
    font-size: 12px;
}

.icon-row-card .icon-row-width-px-wrap {
    margin-top: 16px;
}

.icon-row-card .icon-control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px;
}

.icon-row-card .slider-row {
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 10px;
}

.icon-row-card .property-hint {
    margin-top: 12px;
    color: rgba(226, 232, 240, 0.72);
}

.icon-row-card .shadow-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-row-card .shadow-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
}

.icon-row-card .shadow-toggle:has(.shadow-checkbox:checked) {
    background: rgba(56, 182, 255, 0.08);
    border-color: rgba(56, 182, 255, 0.25);
}

.icon-row-card .shadow-toggle .shadow-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 34px;
    min-width: 34px;
    height: 18px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.12);
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
}

.icon-row-card .shadow-toggle .shadow-checkbox::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #9ca3af;
    transition: transform 0.2s ease, background 0.2s ease;
}

.icon-row-card .shadow-toggle .shadow-checkbox:checked {
    background: #38B6FF;
}

.icon-row-card .shadow-toggle .shadow-checkbox:checked::after {
    transform: translateX(16px);
    background: #fff;
}

.icon-row-card .shadow-toggle .shadow-label {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: #e5e7eb;
    cursor: pointer;
    user-select: none;
}

@media (max-width: 640px) {
    .icon-row-card .icon-item-row {
        grid-template-columns: 1fr;
    }

    .icon-row-card .icon-item-preview {
        width: 52px;
        height: 52px;
    }

    .icon-row-card .icon-item-fields,
    .icon-row-card .icon-control-grid,
    .icon-row-card .icon-item-actions {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 520px) {
    .icon-row-card .icon-item-toolbar,
    .icon-row-card .icon-segmented-controls {
        grid-template-columns: 1fr;
    }

    .icon-row-card .icon-item-remove-btn,
    .icon-row-card .icon-item-reset-btn {
        width: 100%;
    }
}

.video-frame {
    position: relative;
    /* Base (uninitialized) default should match the initial selected defaults: 240px square */
    width: 240px;
    max-width: 100%;
    /* Fallback spacing before JS applies dataset-driven margins */
    margin: 24px 0;
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: var(--video-radius, 16px);
    overflow: hidden;
    background: transparent;
    box-sizing: border-box;
    border: var(--video-border-width, 0px) var(--video-border-style, solid) var(--video-border-color, transparent);
    /* Shadow is applied on the frame itself (reliable and matches image behavior) */
    box-shadow: var(--video-shadow, none);
}

/* Inner clipping wrapper: absolute within .video-frame (which has inline position:relative + overflow:hidden) */
.video-inner {
    position: absolute;
    inset: var(--video-inner-pad, 0px);
    border-radius: max(0px, calc(var(--video-radius, 16px) - var(--video-border-width, 0px) - var(--video-inner-pad, 0px)));
    overflow: hidden;
    background: #0b1220;
}

/* NOTE:
   Historically "video padding" was implemented as an OUTER gap (`--video-border-gap`) that made the element footprint grow.
   We now use `--video-inner-pad` + `.video-inner` inset so width stays stable when padding changes. */

.video-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 24px;
    gap: 10px;
    background: radial-gradient(900px circle at 10% 10%, rgba(56, 182, 255, 0.20), transparent 55%),
                radial-gradient(700px circle at 90% 30%, rgba(125, 211, 252, 0.16), transparent 60%),
                rgba(15, 23, 42, 0.92);
    color: rgba(255,255,255,0.92);
    cursor: pointer;
    z-index: 4;
}

.video-placeholder-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    margin: 0 auto;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.14);
}

.video-placeholder-icon i {
    font-size: 28px;
    color: rgba(255,255,255,0.95);
}

.video-placeholder-title {
    font-weight: 800;
    letter-spacing: 0.01em;
    font-size: 18px;
}

.video-placeholder-subtitle {
    font-size: 13px;
    color: rgba(255,255,255,0.70);
    line-height: 1.35;
    max-width: 34ch;
    margin: 0 auto;
}

.video-poster {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    z-index: 2;
}

.video-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    /* Keep the play affordance usable at large sizes but never overflowing at small sizes */
    --video-play-size: min(82px, 70%);
    border: none;
    background: transparent;
    cursor: pointer;
    z-index: 3;
}

.video-play i {
    width: var(--video-play-size);
    height: var(--video-play-size);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0.58);
    color: white;
    font-size: calc(var(--video-play-size) * 0.27);
    transform: translateX(calc(var(--video-play-size) * 0.024));
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    transition: transform 120ms ease, background 120ms ease;
}

.video-frame:hover .video-play i {
    background: rgba(0,0,0,0.70);
    transform: translateX(calc(var(--video-play-size) * 0.024)) scale(1.04);
}

.video-native,
.video-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: inherit;
    background: black;
    z-index: 1;
}

/* -------------------------------------------------
   Video UX: make embeds selectable (iframe clicks don't bubble)
   - When NOT selected: disable pointer events on the media so a click selects the element
   - When selected: re-enable so the user can interact with playback controls
------------------------------------------------- */
.page-element[data-type="video"] .video-embed,
.page-element[data-type="video"] .video-native {
    pointer-events: none;
}

.page-element[data-type="video"].selected .video-embed,
.page-element[data-type="video"].selected .video-native {
    pointer-events: auto;
}

/* Selection outline: never outline full-width page-element wrapper; hug the frame */
.page-element[data-type="video"]:hover,
.page-element[data-type="video"].selected {
    outline: none !important;
    box-shadow: none !important;
}

/* Video selection: do NOT dim the actual video block (prevents "turns white" look) */
.page-element[data-type="video"].selected > .video-element {
    opacity: 1 !important;
}

/* Video hover: do NOT dim/wash out the actual video block */
.page-element[data-type="video"]:hover > .video-element {
    opacity: 1 !important;
}

.page-element[data-type="video"] .video-frame:hover,
.container-item[data-type="video"] .video-frame:hover {
    outline: 2px dashed rgba(56, 182, 255, 0.28);
    outline-offset: 6px;
}

.page-element[data-type="video"].selected .video-frame,
.container-item[data-type="video"].selected .video-frame {
    outline: 3px solid #38B6FF;
    outline-offset: 6px;
    box-shadow: 0 0 0 6px rgba(56, 182, 255, 0.10);
}

/* Container-item video/image: same selection hiding as page-element wrappers */
.container-item[data-type="video"]:hover,
.container-item[data-type="video"].selected,
.container-item[data-type="image"]:hover,
.container-item[data-type="image"].selected {
    outline: none !important;
    border-color: transparent !important;
}
.container-item[data-type="video"].selected > .video-element,
.container-item[data-type="video"]:hover > .video-element,
.container-item[data-type="image"].selected > .image-element,
.container-item[data-type="image"]:hover > .image-element {
    opacity: 1 !important;
}

.timer-container {
    transition: all 0.3s ease;
}

.timer-display {
    transition: all 0.3s ease;
}

.timer-unit {
    transition: all 0.3s ease;
}

.timer-number {
    transition: all 0.3s ease;
}

/* -------------------------------------------------
   Carrd-style timer (v2)
------------------------------------------------- */
.carrd-timer {
    /* Let the timer box be sized/positioned by inline styles (width + margins) */
    width: auto;
    max-width: 100%;
    margin: 0;
    padding: 24px 0;
    /* Fine-tune delimiter vertical alignment vs digit glyphs (scales with font-size) */
    --timer-delim-shift: -0.06em;
}

.carrd-timer .timer-inner {
    width: 100%;
    /* Grid centering stays centered even when the row is wider than the container */
    display: grid;
    justify-items: center;
}

.carrd-timer .timer-row {
    display: inline-flex;
    /* Important: align delimiters to the digit block, not the full unit height (digits + label) */
    align-items: flex-start;
    gap: var(--timer-gap, 16px);
    justify-self: center;
}

.carrd-timer .timer-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
}

.carrd-timer .timer-num {
    font-size: var(--timer-digit-size, 44px);
    line-height: 1;
    font-weight: var(--timer-digit-weight, 700);
    color: var(--timer-digit-color, #111827);
    text-shadow: var(--timer-digit-shadow, none);
    font-family: var(--timer-digit-font, inherit);
    letter-spacing: 0.02em;
}

.carrd-timer .timer-label {
    margin-top: 10px;
    font-size: var(--timer-label-size, 12px);
    font-weight: var(--timer-label-weight, 600);
    color: var(--timer-label-color, #6b7280);
    letter-spacing: var(--timer-label-letter-spacing, 0.08em);
    font-family: var(--timer-label-font, inherit);
    text-shadow: var(--timer-label-shadow, none);
}

.carrd-timer .timer-delim {
    font-size: var(--timer-digit-size, 44px);
    line-height: 1;
    font-weight: var(--timer-digit-weight, 700);
    color: var(--timer-delim-color, #111827);
    font-family: var(--timer-digit-font, inherit);
    opacity: 0.9;
    /* Visually center delimiter with digit glyphs across font sizes */
    transform: translateY(var(--timer-delim-shift, 0em));
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.carrd-timer .timer-delim-lines {
    width: 10px;
    height: var(--timer-delim-lines-h, var(--timer-digit-size, 44px));
    border-left: 2px solid var(--timer-delim-color, #111827);
    opacity: 0.35;
    /* Match the digit block alignment */
    align-self: flex-start;
    transform: translateY(var(--timer-delim-shift, 0em));
}

/* Wrapper sizing tweaks by length (Carrd-ish) */
.carrd-timer[data-timer-digits="2"] { --timer-digit-size: 64px; --timer-delim-lines-h: 64px; }
.carrd-timer[data-timer-digits="4"] { --timer-digit-size: 56px; --timer-delim-lines-h: 56px; }
.carrd-timer[data-timer-digits="6"] { --timer-digit-size: 48px; --timer-delim-lines-h: 48px; }
.carrd-timer[data-timer-digits="8"] { --timer-digit-size: 42px; --timer-delim-lines-h: 42px; }

/* Tiny helpers for the properties panel */
.property-divider {
    height: 1px;
    background: rgba(255,255,255,0.12);
    margin: 14px 0;
}

.property-hint {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.65);
    line-height: 1.35;
}

/* Element actions (properties panel) */
.property-group.element-actions {
    margin-top: 16px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
}

.element-actions-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
}

.element-action-btn {
    width: 100%;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Distinct container movement controls */
.property-group.container-move-actions {
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(56, 182, 255, 0.38);
    background: linear-gradient(180deg, rgba(56, 182, 255, 0.10), rgba(56, 182, 255, 0.04));
}

.container-move-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.container-move-btn {
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(56, 182, 255, 0.55);
    background: rgba(10, 35, 56, 0.70);
    color: #d7eeff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.container-move-btn:hover {
    background: rgba(56, 182, 255, 0.28);
    box-shadow: 0 4px 12px rgba(56, 182, 255, 0.25);
    transform: translateY(-1px);
}

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

/* -------------------------------------------------
   Timer controls (properties panel): cleaner layout
------------------------------------------------- */
.timer-controls .timer-segmented {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.timer-controls .timer-segmented .size-btn {
    padding: 10px 10px;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    min-width: 0;
}

.timer-controls .timer-margin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
}

.timer-controls .timer-mini label {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
}

.timer-controls .timer-input-with-unit {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.timer-controls .timer-input-with-unit .size-unit {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-weight: 600;
}

.timer-controls .timer-subsection {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.10);
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
}

.timer-controls .timer-subtitle {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.72);
    margin-bottom: 10px;
}

.timer-controls .control-grid-2,
.timer-controls .control-grid-3 {
    width: 100%;
}

.timer-controls .control-grid-2 .size-input-group,
.timer-controls .control-grid-3 .size-input-group {
    min-width: 0;
}

.timer-controls .control-grid-3 .property-input,
.timer-controls .control-grid-2 .property-input {
    width: 100%;
}

/* Slider layout + centering consistency */
.timer-controls .size-controls {
    justify-content: center;
    align-items: stretch;
}

.timer-controls .spacing-slider-container {
    width: 100%;
    justify-content: center;
    /* Dark-panel friendly */
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
}

.timer-controls .spacing-slider {
    background: rgba(56, 182, 255, 0.25);
}

.timer-controls .spacing-input {
    width: 56px;
}

.timer-controls .spacing-unit {
    color: rgba(255,255,255,0.65);
}

.timer-controls .color-picker {
    width: 100%;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
}

.timer-controls .control-grid-2,
.timer-controls .control-grid-3 {
    align-items: end;
}

.timer-controls .font-preview-select,
.timer-controls select.property-input,
.timer-controls input.property-input,
.timer-controls input.spacing-input {
    height: 34px;
    box-sizing: border-box;
}

/* Prevent select/input text from being clipped inside the fixed 34px timer controls */
.timer-controls .font-preview-select,
.timer-controls select.property-input,
.timer-controls input.property-input {
    padding: 6px 10px;
    line-height: 20px;
}

.timer-controls select.property-input,
.timer-controls .font-preview-select {
    padding-right: 36px; /* keep room for the dropdown arrow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timer-controls .spacing-display {
    justify-content: flex-end;
    min-width: 74px;
}

.timer-controls .timer-slider-grid {
    display: grid;
    /* Make each margin slider full-width so there's plenty of track to drag */
    grid-template-columns: 1fr;
    gap: 12px;
}

.timer-controls .timer-slider-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.timer-controls .timer-slider-label {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
}

/* Size input groups for better layout */
.size-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
}

.size-input-group label {
    font-size: 12px;
    color: #ccc;
    margin: 0;
}

.size-input-group input {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
}

.size-input-group .size-unit {
    font-size: 10px;
    color: #999;
    text-align: center;
}

/* Enhanced property controls */
.property-group {
    margin-bottom: 20px;
}

.property-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}

.property-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a2a;
    color: #fff;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.property-textarea:focus {
    outline: none;
    border-color: #38B6FF;
    box-shadow: 0 0 0 2px rgba(56, 182, 255, 0.2);
}

/* Color picker styling */
.color-picker {
    width: 40px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

/* Range slider styling */
.spacing-slider, .size-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #444;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.spacing-slider::-webkit-slider-thumb, .size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38B6FF;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.spacing-slider::-moz-range-thumb, .size-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #38B6FF;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Spacing display */
.spacing-display, .size-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.spacing-input, .size-input {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #2a2a2a;
    color: #fff;
    font-size: 12px;
    text-align: center;
}

.spacing-unit, .size-unit {
    font-size: 12px;
    color: #999;
    min-width: 20px;
}

/* Enhanced button styling */
.size-btn.active {
    background: #38B6FF !important;
    color: white !important;
    border-color: #38B6FF !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .size-input-group {
        min-width: 60px;
    }
    
    .property-textarea {
        min-height: 50px;
    }
}

/* ─── Email Signup Element ──────────────────────────────────────────── */

.email-signup-element {
    width: 100%;
}

.email-signup-input,
.email-signup-name-input,
.email-signup-phone-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.email-signup-input:focus,
.email-signup-name-input:focus,
.email-signup-phone-input:focus {
    border-color: #38B6FF !important;
    box-shadow: 0 0 0 3px rgba(56, 182, 255, 0.12);
    outline: none;
}

.email-signup-btn {
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.email-signup-btn:hover {
    opacity: 0.9;
}

.email-signup-btn:active {
    transform: scale(0.98);
}

.email-signup-success {
    animation: fadeInUp 0.4s ease;
}

.email-signup-gdpr {
    font-size: 13px;
    color: #888;
}

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

/* ─── Checkout Element ──────────────────────────────────────────────── */

.checkout-element {
    width: 100%;
}

.checkout-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
}

.checkout-btn {
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.checkout-btn:hover {
    opacity: 0.92;
    box-shadow: 0 6px 20px rgba(56, 182, 255, 0.5);
}

.checkout-btn:active {
    transform: scale(0.97);
}

.checkout-features-list {
    list-style: none;
    padding: 0;
    margin: 20px auto 24px;
    text-align: left;
}

.checkout-features-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    color: #555;
}

.checkout-guarantee-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: #10b981;
    font-weight: 500;
}

.checkout-coupon-field {
    display: flex;
    gap: 8px;
    max-width: 280px;
    margin: 12px auto 0;
}

.checkout-coupon-field input {
    transition: border-color 0.2s ease;
}

.checkout-coupon-field input:focus {
    border-color: #38B6FF;
    outline: none;
}

/* ─── Responsive: Email Signup & Checkout ───────────────────────────── */

@media (max-width: 600px) {
    .email-signup-fields {
        flex-direction: column !important;
    }

    .email-signup-input,
    .email-signup-name-input,
    .email-signup-phone-input,
    .email-signup-btn {
        width: 100% !important;
        min-width: 0 !important;
    }

    .checkout-element > div {
        padding: 40px 20px !important;
    }

    .checkout-features-list {
        max-width: 100% !important;
        padding: 0 16px;
    }

    .checkout-coupon-field {
        max-width: 100% !important;
        padding: 0 16px;
    }
}

/* ─── Properties Panel: Integration Status Badges ───────────────────── */

.integration-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
    transition: all 0.2s ease;
}

.integration-status.connected {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.integration-status.not-connected {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.integration-status i {
    font-size: 12px;
}

/* ─── Properties Panel: Section Headers ─────────────────────────────── */

.property-section-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #888;
    padding: 12px 0 4px;
    margin-top: 4px;
    border-top: 1px solid #333;
}

/* ─── Properties Panel: Hints & Generated URL ───────────────────────── */

.property-hint {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

#button-link-generated-url:empty::before {
    content: '—';
    color: #555;
}

#button-link-generated-url {
    min-height: 18px;
}

/* ═══════════════════════════════════════════════════════════════════════
   UNIFIED PROPERTY PANEL — Dark, sleek, consistent across ALL elements
   This block lives at the END of the file so it wins specificity wars.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Panel shell ── */
.properties-panel {
    background: #111113 !important;
    border: 1px solid rgba(255,255,255,.07) !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.03) !important;
    color: #d4d4d8 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    padding: 0 !important;
    max-height: calc(100vh - 100px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}
.properties-panel::-webkit-scrollbar { width: 4px; }
.properties-panel::-webkit-scrollbar-track { background: transparent; }
.properties-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 2px; }
.properties-panel::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.14); }

/* ── Every .property-group ── */
.properties-panel .property-group {
    margin: 0 !important;
    padding: 14px 16px !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,.06) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.properties-panel .property-group:last-child {
    border-bottom: none !important;
}

/* ── ALL labels inside the panel ── */
.properties-panel label {
    display: block !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #71717a !important;
    margin-bottom: 6px !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
/* Top-level section labels get the uppercase treatment */
.properties-panel .property-group > label:first-child {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
    color: #52525b !important;
    margin-bottom: 10px !important;
}

/* ── Element Type header (first group) ── */
.properties-panel > .property-group:first-child {
    background: rgba(99,102,241,.05) !important;
    border-bottom: 1px solid rgba(99,102,241,.1) !important;
    padding: 14px 16px !important;
}
.properties-panel > .property-group:first-child > label:first-child {
    color: #6366f1 !important;
}
.properties-panel .property-value {
    background: rgba(99,102,241,.06) !important;
    border: 1px solid rgba(99,102,241,.12) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    color: #a5b4fc !important;
    font-size: 12px !important;
    font-weight: 700 !important;
}

/* ═══ FORM CONTROLS — unified dark ═══ */

/* Text / number / url / select / textarea */
.properties-panel input[type="text"],
.properties-panel input[type="number"],
.properties-panel input[type="url"],
.properties-panel input[type="email"],
.properties-panel .property-input,
.properties-panel .property-textarea,
.properties-panel select,
.properties-panel textarea {
    width: 100% !important;
    padding: 8px 11px !important;
    background: #18181b !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    border-radius: 7px !important;
    color: #e4e4e7 !important;
    font-size: 12px !important;
    font-family: inherit !important;
    outline: none !important;
    transition: border-color .15s, box-shadow .15s !important;
    box-shadow: none !important;
}
.properties-panel input:focus,
.properties-panel select:focus,
.properties-panel textarea:focus {
    border-color: rgba(99,102,241,.45) !important;
    box-shadow: 0 0 0 2px rgba(99,102,241,.1) !important;
}
.properties-panel textarea {
    min-height: 70px !important;
    resize: vertical !important;
    line-height: 1.5 !important;
}

/* Color pickers */
.properties-panel input[type="color"] {
    width: 34px !important;
    height: 34px !important;
    padding: 2px !important;
    border: 2px solid rgba(255,255,255,.1) !important;
    border-radius: 7px !important;
    background: transparent !important;
    cursor: pointer !important;
    box-shadow: none !important;
}

/* Range sliders */
.properties-panel input[type="range"] {
    width: 100% !important;
    accent-color: #6366f1 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    height: auto !important;
}

/* Checkboxes (not toggle switches) */
.properties-panel input[type="checkbox"] {
    width: auto !important;
    accent-color: #6366f1 !important;
}

/* ═══ BUTTONS — .spacing-btn, .size-btn, generic panel buttons ═══ */
.properties-panel .spacing-btn,
.properties-panel .size-btn,
.properties-panel button.spacing-btn,
.properties-panel button.size-btn {
    padding: 8px 12px !important;
    background: #1c1c1f !important;
    border: 1px solid rgba(255,255,255,.1) !important;
    border-radius: 7px !important;
    color: #a1a1aa !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all .15s !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    box-shadow: none !important;
    text-transform: none !important;
    margin: 0 !important;
}
.properties-panel .spacing-btn:hover,
.properties-panel .size-btn:hover {
    background: #27272a !important;
    border-color: rgba(255,255,255,.16) !important;
    color: #e4e4e7 !important;
}
.properties-panel .size-btn.active,
.properties-panel .spacing-btn.active {
    background: rgba(99,102,241,.1) !important;
    border-color: rgba(99,102,241,.3) !important;
    color: #818cf8 !important;
}

/* Size controls row */
.properties-panel .size-controls {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

/* ═══ CONTROL CARDS (border, shadow, etc.) ═══ */
.properties-panel .control-card,
.properties-panel .property-group.control-card {
    background: #151517 !important;
    border: 1px solid rgba(255,255,255,.07) !important;
    border-radius: 10px !important;
    padding: 14px !important;
    margin: 0 !important;
    box-shadow: none !important;
}
.properties-panel .control-card-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    margin-bottom: 10px !important;
}
.properties-panel .control-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    color: #d4d4d8 !important;
}
.properties-panel .control-title i {
    color: #6366f1 !important;
    font-size: 13px !important;
}
.properties-panel .control-card-body {
    margin-top: 8px !important;
}
.properties-panel .control-grid-2,
.properties-panel .control-grid-3 {
    display: grid !important;
    gap: 10px !important;
}
.properties-panel .control-grid-2 { grid-template-columns: 1fr 1fr !important; }
.properties-panel .control-grid-3 { grid-template-columns: 1fr 1fr 1fr !important; }

/* Slider containers handled by final override block at end of file */

/* Size input groups */
.properties-panel .size-input-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}
.properties-panel .size-input-group label {
    font-size: 11px !important;
    color: #71717a !important;
    margin: 0 !important;
}

/* Slider row */
.properties-panel .slider-row {
    display: grid !important;
    grid-template-columns: 1fr 70px !important;
    gap: 8px !important;
    align-items: center !important;
}

/* ═══ TOGGLE SWITCH ═══ */
.properties-panel .switch {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
}
.properties-panel .switch-ui {
    background: #27272a !important;
    border: 1px solid #3f3f46 !important;
}
.properties-panel .switch input:checked + .switch-ui {
    background: rgba(99,102,241,.35) !important;
    border-color: rgba(99,102,241,.6) !important;
}
.properties-panel .switch-label {
    color: #a1a1aa !important;
    font-size: 11px !important;
}

/* ═══ MARKDOWN TOOLBAR ═══ */
.properties-panel .markdown-controls {
    margin-bottom: 6px !important;
}
.properties-panel .markdown-toolbar {
    display: flex !important;
    gap: 2px !important;
    flex-wrap: wrap !important;
    margin-bottom: 4px !important;
}
.properties-panel .markdown-btn {
    width: 28px !important;
    height: 28px !important;
    display: grid !important;
    place-items: center !important;
    border: 1px solid rgba(255,255,255,.07) !important;
    border-radius: 5px !important;
    background: #18181b !important;
    color: #71717a !important;
    cursor: pointer !important;
    font-size: 11px !important;
    transition: all .12s !important;
    padding: 0 !important;
}
.properties-panel .markdown-btn:hover {
    background: #27272a !important;
    color: #d4d4d8 !important;
}
.properties-panel .markdown-help {
    font-size: 10px !important;
    color: #3f3f46 !important;
    line-height: 1.4 !important;
    margin-top: 6px !important;
}
.properties-panel .markdown-help strong {
    color: #52525b !important;
}

/* ═══ COLOR PALETTE BUTTONS ═══ */
.properties-panel .color-btn {
    width: 26px !important;
    height: 26px !important;
    border-radius: 6px !important;
    border: 2px solid rgba(255,255,255,.07) !important;
    cursor: pointer !important;
    transition: transform .1s, border-color .1s !important;
    box-shadow: none !important;
}
.properties-panel .color-btn:hover {
    transform: scale(1.15) !important;
    border-color: rgba(255,255,255,.25) !important;
}
.properties-panel .color-btn::after {
    border-color: rgba(255,255,255,.1) !important;
}

/* ═══ BREADCRUMB ═══ */
.properties-panel .breadcrumb,
.properties-panel .breadcrumb-navigation {
    background: #18181b !important;
    border: 1px solid rgba(255,255,255,.07) !important;
    border-radius: 7px !important;
    padding: 7px 10px !important;
    margin-bottom: 8px !important;
}
.properties-panel .breadcrumb .section-name { color: #6366f1 !important; }
.properties-panel .breadcrumb .element-name { color: #d4d4d8 !important; }
.properties-panel .breadcrumb i { color: #3f3f46 !important; }

/* ═══ FONT / ICON PREVIEW ═══ */
.properties-panel .font-preview,
.properties-panel .icon-preview-section,
.properties-panel .markdown-preview {
    background: #151517 !important;
    border: 1px solid rgba(255,255,255,.06) !important;
    border-radius: 8px !important;
    padding: 14px !important;
    color: #d4d4d8 !important;
}

/* ═══ PROPERTY HINTS / DESCRIPTIONS ═══ */
.properties-panel .property-hint,
.properties-panel p[style*="color: #6b7280"],
.properties-panel p[style*="color: #999"],
.properties-panel p[style*="color:#6b7280"] {
    font-size: 10px !important;
    color: #3f3f46 !important;
    margin-top: 4px !important;
    line-height: 1.4 !important;
}

/* ═══ SECTION HEADERS ═══ */
.properties-panel .property-section-header {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: .07em !important;
    color: #3f3f46 !important;
    padding: 8px 0 4px !important;
    margin-top: 4px !important;
    border-top: 1px solid rgba(255,255,255,.05) !important;
}

/* ═══ GRADIENT / SPECIAL INLINE COLORS ═══ */
.properties-panel span[style*="font-weight:600"],
.properties-panel span[style*="font-weight: 600"] {
    color: #a1a1aa !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   CLONE & DELETE — always side-by-side, new dedicated classes
   ═══════════════════════════════════════════════════════════════════════ */
.properties-panel .property-group.element-actions {
    padding: 10px 16px 14px !important;
    border-bottom: none !important;
}

.properties-panel .element-actions-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
}

/* Both buttons share this base */
.properties-panel .element-action-btn {
    all: unset !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    height: 36px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: all .15s !important;
}

/* Clone */
.properties-panel .clone-action-btn {
    background: rgba(99,102,241,.07) !important;
    border: 1px solid rgba(99,102,241,.18) !important;
    color: #818cf8 !important;
}
.properties-panel .clone-action-btn:hover {
    background: rgba(99,102,241,.14) !important;
    border-color: rgba(99,102,241,.32) !important;
    color: #a5b4fc !important;
}

/* Delete */
.properties-panel .delete-action-btn {
    background: rgba(239,68,68,.07) !important;
    border: 1px solid rgba(239,68,68,.18) !important;
    color: #f87171 !important;
}
.properties-panel .delete-action-btn:hover {
    background: rgba(239,68,68,.14) !important;
    border-color: rgba(239,68,68,.32) !important;
    color: #fca5a5 !important;
}

/* ─── Account Menu ──────────────────────────────────────────────── */
.account-menu {
    position: relative;
    margin-left: 8px;
}
.account-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(56,182,255,0.4);
    background: linear-gradient(135deg, #38B6FF, #1A8FE3);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    padding: 0;
    line-height: 1;
}
.account-avatar:hover {
    border-color: #38B6FF;
    box-shadow: 0 0 0 3px rgba(56,182,255,0.15);
}
.avatar-initials {
    pointer-events: none;
}
.account-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.45);
    z-index: 9999;
    overflow: hidden;
}
.account-dropdown.open {
    display: block;
}
.account-dropdown-header {
    padding: 16px;
}
.account-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}
.account-dropdown-email {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
    word-break: break-all;
}
.account-dropdown-divider {
    height: 1px;
    background: #333;
}
.account-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #d1d5db;
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.account-dropdown-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.account-dropdown-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
}

/* ════════════════════════════════════════════════════════════════════
   PROPERTIES PANEL · SLIDER OVERRIDES  (single source of truth)
   ════════════════════════════════════════════════════════════════════ */

.properties-panel .size-slider-container,
.properties-panel .spacing-slider-container {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    background: #1a1a1e !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    border-radius: 10px !important;
    margin-bottom: 8px !important;
    box-shadow: none !important;
}

/* The range input */
.properties-panel .size-slider,
.properties-panel .spacing-slider {
    -webkit-appearance: none !important;
    appearance: none !important;
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 6px !important;
    border-radius: 999px !important;
    background: transparent !important;
    outline: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* WebKit track */
.properties-panel .size-slider::-webkit-slider-runnable-track,
.properties-panel .spacing-slider::-webkit-slider-runnable-track {
    -webkit-appearance: none;
    height: 6px;
    border-radius: 999px;
    background: #3f3f46;
    border: none;
}

/* Firefox track */
.properties-panel .size-slider::-moz-range-track,
.properties-panel .spacing-slider::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #3f3f46;
    border: none;
}

/* WebKit thumb */
.properties-panel .size-slider::-webkit-slider-thumb,
.properties-panel .spacing-slider::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    border-radius: 50% !important;
    background: #38B6FF !important;
    border: 2px solid #fff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35) !important;
    cursor: pointer !important;
    margin-top: -5px !important;
    transition: transform .15s ease !important;
}
.properties-panel .size-slider::-webkit-slider-thumb:hover,
.properties-panel .spacing-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15) !important;
    background: #2196F3 !important;
}

/* Firefox thumb */
.properties-panel .size-slider::-moz-range-thumb,
.properties-panel .spacing-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #38B6FF;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    cursor: pointer;
}

/* Value display — sits below the slider on its own row */
.properties-panel .size-display,
.properties-panel .spacing-display {
    display: flex !important;
    flex: 1 1 100% !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    margin-top: 0 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}
.properties-panel .size-input,
.properties-panel .spacing-input {
    width: 52px !important;
    background: #27272a !important;
    border: 1px solid #3f3f46 !important;
    border-radius: 6px !important;
    color: #e4e4e7 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-align: center !important;
    padding: 4px 6px !important;
    box-shadow: none !important;
}
.properties-panel .size-input:focus,
.properties-panel .spacing-input:focus {
    border-color: #38B6FF !important;
    outline: none !important;
}
.properties-panel .size-unit,
.properties-panel .spacing-unit {
    color: #71717a !important;
    font-size: 11px !important;
    font-weight: 500 !important;
}

/* ════════════════════════════════════════════════════════════════════
   PROPERTIES PANEL · COLOR CONTROLS
   ════════════════════════════════════════════════════════════════════ */

.properties-panel .color-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}

.properties-panel .color-row .color-picker,
.properties-panel .color-row input[type="color"] {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    border: 2px solid #3f3f46 !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    padding: 2px !important;
    background: transparent !important;
    flex-shrink: 0 !important;
}
.properties-panel .color-row .color-picker:hover,
.properties-panel .color-row input[type="color"]:hover {
    border-color: #38B6FF !important;
}

.properties-panel .color-row .preset-colors {
    display: flex !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
}

.properties-panel .color-row .color-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border-radius: 6px !important;
    border: 2px solid rgba(255,255,255,.12) !important;
    cursor: pointer !important;
    transition: transform .15s ease, border-color .15s ease !important;
    padding: 0 !important;
    position: relative !important;
}
.properties-panel .color-row .color-btn:hover {
    transform: scale(1.15) !important;
    border-color: #38B6FF !important;
    box-shadow: 0 0 8px rgba(56,182,255,.3) !important;
}
.properties-panel .color-row .color-btn::after {
    display: none !important;
}

/* ── Image properties panel: flex gap forces spacing regardless of child margins ── */
.image-props-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    padding: 0 !important;
}
.image-props-panel > .property-group,
.image-props-panel > .property-group.control-card {
    padding: 24px 16px !important;
}
.image-props-panel > hr.img-section-divider {
    border: none !important;
    height: 1px !important;
    background: rgba(255, 255, 255, 0.10) !important;
    margin: 0 !important;
    padding: 0 !important;
}
.image-props-panel > .property-group > .property-input,
.image-props-panel > .property-group > .spacing-btn {
    margin-top: 12px !important;
}
.image-props-panel .size-controls {
    margin-top: 10px !important;
}
.image-props-panel .size-input-group {
    gap: 10px !important;
}
.image-props-panel .size-display {
    margin-top: 8px !important;
}
