/* ============================================
   NEWSLETTER BUILDER - STYLES
   ============================================
   Uses CSS variables from theme.css
   ============================================ */

/* ========== CUSTOM ICON FONT ========== */
@font-face {
    font-family: 'Sportsbet-Icons';
    src: url('./assets/fonts/Sportsbet-Icons.woff') format('woff'),
         url('./assets/fonts/Sportsbet-Icons.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: block;
}

/* Font Icon styling — applies to both legacy <span> and new <img> icon elements */
.font-icon {
    display: inline-block;
    vertical-align: middle;
    user-select: all;
    -webkit-user-select: all;
}

/* Legacy span font-icons (backwards compatibility for existing content) */
span.font-icon {
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1;
    speak: none;
}

/* Image font-icons — exact pixel dimensions, no font metric issues */
img.font-icon {
    border: 0;
    outline: 0;
    padding: 0;
    margin: 0 1px;
}

/* Ensure colored text spans allow wrapping */
.text-input span[style*="color"] {
    display: inline;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Inline vertical alignment: bottom (baseline) — default */
.canvas-text-preview.inline-valign-bottom .font-icon {
    vertical-align: baseline;
}

/* Inline vertical alignment: middle */
.canvas-text-preview.inline-valign-middle .font-icon {
    vertical-align: middle;
}

/* Inline vertical alignment: top */
.canvas-text-preview.inline-valign-top .font-icon {
    vertical-align: text-top;
}

/* Flex-line wrappers used in preview mode for reliable alignment */
.inline-valign-line {
    display: flex;
    flex-wrap: wrap;
}
.inline-valign-bottom .inline-valign-line {
    align-items: flex-end;
}
.inline-valign-middle .inline-valign-line {
    align-items: center;
}
.inline-valign-top .inline-valign-line {
    align-items: flex-start;
}

/* Mirror text-align as justify-content inside flex lines */
.canvas-text-preview[style*="text-align: center"] .inline-valign-line {
    justify-content: center;
}
.canvas-text-preview[style*="text-align: right"] .inline-valign-line {
    justify-content: flex-end;
}

/* Text spans inside flex lines inherit line-height for correct flex sizing */
.valign-text {
    display: inline-block;
    line-height: inherit;
}

/* During editing, hide flex wrappers (content is flat in contenteditable) */
.canvas-text-preview.editing .inline-valign-line {
    display: contents;
}

/* Ensure text blocks don't overflow and icons wrap */
.text-input {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;  /* Force breaks between icons */
    overflow-x: hidden;  /* Prevent horizontal scrolling */
    max-width: 100%;
    white-space: normal !important;  /* Ensure wrapping is enabled */
}

/* Canvas text preview also needs overflow protection and icon wrapping */
.canvas-text-preview {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;  /* Force breaks between icons */
    overflow-x: hidden;  /* Prevent horizontal scrolling */
    max-width: 100%;
    white-space: normal !important;  /* Ensure wrapping is enabled */
}

/* ========== CANVAS TEXT EDIT MODE ========== */
/* Visual feedback when editing text directly on canvas */
.canvas-text-preview.editing {
    outline: 2px solid #0A375C;
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 0 0 4px rgba(10, 55, 92, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: text;
    min-height: 2em;
    border-radius: 4px;
}

.canvas-text-preview.editing:focus {
    outline: 2px solid #FAD701;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(250, 215, 1, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Placeholder text styling for empty text blocks */
.canvas-text-preview .placeholder-text {
    color: rgba(10, 55, 92, 0.35);
    font-style: italic;
    pointer-events: none;
}

/* Hide placeholder when editing */
.canvas-text-preview.editing .placeholder-text {
    display: none;
}

/* Ensure the block shows edit cursor when in edit mode */
.canvas-block.text-block:has(.canvas-text-preview.editing) {
    cursor: text;
}

/* Style the selected block when in edit mode */
.canvas-block.text-block:has(.canvas-text-preview.editing).selected {
    outline: none;
    box-shadow: none;
}

/* List styling in canvas text preview */
.canvas-text-preview ul,
.canvas-text-preview ol {
    margin: 8px 0;
    padding-left: 36px;
    list-style-position: outside;
}

.canvas-text-preview ul {
    list-style-type: disc;
}

.canvas-text-preview ol {
    list-style-type: decimal;
}

.canvas-text-preview li {
    margin-bottom: 4px;
    line-height: inherit;
    padding-left: 4px;
    display: list-item;
}

.canvas-text-preview li:last-child {
    margin-bottom: 0;
}

/* Nested lists in canvas preview */
.canvas-text-preview ul ul,
.canvas-text-preview ol ol,
.canvas-text-preview ul ol,
.canvas-text-preview ol ul {
    margin-top: 4px;
    margin-bottom: 4px;
}

.canvas-text-preview ul ul {
    list-style-type: circle;
}

.canvas-text-preview ul ul ul {
    list-style-type: square;
}

/* ========== APP LOADING SCREEN ========== */
.app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #011C32 0%, #035CA7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

.app-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Background particles */
.loader-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.loader-particle {
    position: absolute;
    top: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: float-particle 12s infinite ease-in-out;
    will-change: transform, opacity;
}

/* Particle 1: Small, left side */
.loader-particle:nth-child(1) {
    width: 40px;
    height: 40px;
    left: 8%;
    animation-delay: 0s;
    animation-duration: 14s;
}

/* Particle 2: Medium, center-left */
.loader-particle:nth-child(2) {
    width: 70px;
    height: 70px;
    left: 25%;
    animation-delay: 1.5s;
    animation-duration: 16s;
}

/* Particle 3: Large, center */
.loader-particle:nth-child(3) {
    width: 100px;
    height: 100px;
    left: 45%;
    animation-delay: 0.8s;
    animation-duration: 18s;
}

/* Particle 4: Small, center-right */
.loader-particle:nth-child(4) {
    width: 50px;
    height: 50px;
    left: 62%;
    animation-delay: 3s;
    animation-duration: 13s;
}

/* Particle 5: Medium, right side */
.loader-particle:nth-child(5) {
    width: 80px;
    height: 80px;
    left: 78%;
    animation-delay: 2.2s;
    animation-duration: 15s;
}

/* Particle 6: Very small, far left */
.loader-particle:nth-child(6) {
    width: 30px;
    height: 30px;
    left: 15%;
    animation-delay: 4.5s;
    animation-duration: 17s;
}

/* Particle 7: Large, center-right */
.loader-particle:nth-child(7) {
    width: 90px;
    height: 90px;
    left: 55%;
    animation-delay: 1s;
    animation-duration: 19s;
}

/* Particle 8: Small, far right */
.loader-particle:nth-child(8) {
    width: 45px;
    height: 45px;
    left: 88%;
    animation-delay: 3.8s;
    animation-duration: 14s;
}

/* Particle 9: Medium, left-center */
.loader-particle:nth-child(9) {
    width: 65px;
    height: 65px;
    left: 35%;
    animation-delay: 2.5s;
    animation-duration: 16s;
}

/* Particle 10: Small, right-center */
.loader-particle:nth-child(10) {
    width: 55px;
    height: 55px;
    left: 72%;
    animation-delay: 0.3s;
    animation-duration: 15s;
}

@keyframes float-particle {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.2;
    }
    50% {
        opacity: 0.4;
        transform: translateY(-50vh) scale(1);
    }
    90% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(-120vh) scale(0.8);
        opacity: 0;
    }
}

/* Main loader container */
.loader-container {
    text-align: center;
    z-index: 3;
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

/* Logo with float animation */
.loader-logo {
    width: 120px;
    height: auto;
    margin: 0 auto 280px auto;
    animation: float 2.5s ease-in-out infinite;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

.loader-logo svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Animated Newsletter Canvas */
.loader-canvas {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    max-width: 90%;
    opacity: 0;
    animation: canvasAppear 0.6s ease-out 0.3s forwards;
    z-index: 2;
}

@keyframes canvasAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.loader-canvas-inner {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Loader Blocks */
.loader-block {
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
}

/* Text Block Styles */
.loader-text-block {
    background: rgba(10, 55, 92, 0.05);
    border-radius: 8px;
    padding: 16px;
    animation: blockAppear 0.4s ease-out forwards;
}

/* Individual text block timing */
.loader-text-block:nth-of-type(2) {
    animation-delay: 0.7s;
}

.loader-text-block:nth-of-type(4) {
    animation-delay: 1.5s;
}

.loader-text-block:nth-of-type(6) {
    animation-delay: 3.1s;
}

.loader-text-line {
    height: 12px;
    background: linear-gradient(90deg, rgba(10, 55, 92, 0.15) 0%, rgba(10, 55, 92, 0.08) 100%);
    border-radius: 6px;
    margin-bottom: 8px;
    animation: shimmer 1.5s infinite;
}

.loader-text-line:last-child {
    margin-bottom: 0;
}

.loader-text-line.short {
    width: 60%;
}

.loader-text-line.large {
    height: 18px;
}

.loader-text-line.small {
    height: 8px;
    width: 70%;
}

@keyframes shimmer {
    0% {
        background-position: -400px 0;
    }
    100% {
        background-position: 400px 0;
    }
}

/* Image Block Styles */
.loader-image-block {
    background: linear-gradient(135deg, #FAD701 0%, #FFA500 100%);
    border-radius: 8px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: blockAppear 0.4s ease-out forwards;
}

/* Logo block */
.loader-logo-block {
    height: 60px;
    animation-delay: 0.5s;
    background: linear-gradient(135deg, #035CA7 0%, #0288D1 100%);
}

/* Hero image */
.loader-hero {
    animation-delay: 1.1s;
    height: 140px;
}

.loader-image-emoji {
    font-size: 48px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Divider Block */
.loader-divider-block {
    animation: blockAppear 0.4s ease-out forwards;
    animation-delay: 3.5s;
    padding: 8px 0;
}

.loader-divider-line {
    height: 2px;
    background: rgba(10, 55, 92, 0.15);
    border-radius: 1px;
}

/* Merge Container - showing blocks coming together */
.loader-merge-wrapper {
    margin-bottom: 16px;
    position: relative;
    min-height: 120px;
}

.loader-merge-container {
    display: flex;
    gap: 12px;
    position: relative;
}

.loader-merge-container .merge-block {
    flex: 1;
    height: 100px;
    margin-bottom: 0;
    position: relative;
}

/* Block 1: Starts on the left, slides in */
.merge-block-1 {
    background: linear-gradient(135deg, #035CA7 0%, #0288D1 100%);
    animation: 
        blockAppearLeft 0.5s ease-out 1.9s forwards,
        pulseBlock 0.4s ease-in-out 2.6s;
}

/* Block 2: Starts on the right, slides in */
.merge-block-2 {
    background: linear-gradient(135deg, #7B1FA2 0%, #9C27B0 100%);
    animation: 
        blockAppearRight 0.5s ease-out 2.1s forwards,
        pulseBlock 0.4s ease-in-out 2.6s;
}

/* After both blocks appear, show merge effect */
.loader-merge-container::after {
    content: '→ Row';
    position: absolute;
    top: -24px;
    right: 0;
    font-size: 11px;
    font-weight: 700;
    color: #FAD701;
    background: rgba(250, 215, 1, 0.15);
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    animation: labelAppear 0.3s ease-out 2.6s forwards;
}

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

@keyframes blockAppearLeft {
    0% {
        opacity: 0;
        transform: translateX(-100px) translateY(0) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1);
    }
}

@keyframes blockAppearRight {
    0% {
        opacity: 0;
        transform: translateX(100px) translateY(0) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) scale(1);
    }
}

@keyframes pulseBlock {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(250, 215, 1, 0);
    }
    50% {
        transform: scale(1.03);
        box-shadow: 0 0 0 3px rgba(250, 215, 1, 0.6);
    }
}

@keyframes labelAppear {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading bar at bottom */
.loader-bar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    z-index: 10;
    pointer-events: none;
}

.loader-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, #FAD701 0%, #FFA500 100%);
    box-shadow: 0 0 10px rgba(250, 215, 1, 0.5);
    animation: loadingBar 5.5s ease-in-out forwards;
}

.loader-bar-fill::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

@keyframes loadingBar {
    0% {
        width: 0%;
    }
    20% {
        width: 30%;
    }
    50% {
        width: 60%;
    }
    80% {
        width: 85%;
    }
    100% {
        width: 100%;
    }
}

/* Horse and jockey animation */
.loader-horse {
    position: absolute;
    bottom: 6px;
    left: 0;
    width: 40px;
    height: 40px;
    animation: horseRun 5.5s linear forwards;
    z-index: 11;
    transform: translateX(-40px);
    pointer-events: none;
}

.loader-horse svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: horseBounce 0.4s ease-in-out infinite;
}

@keyframes horseRun {
    0% {
        left: 0%;
        transform: translateX(-40px);
    }
    100% {
        left: 100%;
        transform: translateX(0);
    }
}

@keyframes horseBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Mobile responsive */
@media (max-width: 744px) {
    .loader-logo {
        width: 90px;
    }
    
    .loader-bar-container {
        height: 40px;
    }
    
    .loader-bar-fill {
        height: 3px;
    }
    
    .loader-bar-fill::before {
        height: 3px;
    }
    
    .loader-horse {
        width: 30px;
        height: 30px;
        bottom: 5px;
    }
}

/* ========== MAC APP ENHANCEMENTS ========== */
/* Only applied when running as Electron app */
.app-container {
    -webkit-app-region: no-drag; /* Default: not draggable */
}

/* Make top bar draggable for Mac window dragging */
.preview-top-bar {
    -webkit-app-region: drag;
    -webkit-user-select: none;
    user-select: none;
}

/* But keep buttons and inputs clickable */
.preview-top-bar button,
.preview-top-bar input,
.preview-top-bar select,
.preview-top-bar a {
    -webkit-app-region: no-drag;
}

/* Mac-style backdrop blur for modals */
@supports (backdrop-filter: blur(10px)) {
    .modal-overlay,
    .preview-overlay,
    .color-picker-overlay,
    .custom-cp-overlay,
    .media-library-overlay,
    .manage-assets-overlay,
    .template-selector-overlay,
    .svg-modal-overlay,
    .color-modal-overlay,
    .ai-provider-modal-overlay,
    .ai-assistant-modal-overlay,
    .export-modal-overlay,
    .profile-modal-overlay,
    .preferences-modal-overlay,
    .delete-project-modal-overlay,
    .rename-project-modal-overlay,
    .logout-modal-overlay,
    .optimization-overlay,
    .eml-config-overlay,
    .welcome-modal {
        backdrop-filter: blur(10px);
        background: rgba(0, 0, 0, 0.35); /* Slightly lighter when blurred */
    }
}

/* ========== LOGIN SCREEN ========== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(135deg, #011C32 0%, #035CA7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

.login-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Background particles - reuse loading screen animation */
.login-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.login-particle {
    position: absolute;
    top: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    animation: float-particle 12s infinite ease-in-out;
}

.login-particle:nth-child(1) {
    left: 10%;
    width: 60px;
    height: 60px;
    animation-delay: 0s;
}

.login-particle:nth-child(2) {
    left: 25%;
    width: 40px;
    height: 40px;
    animation-delay: 1.5s;
}

.login-particle:nth-child(3) {
    left: 40%;
    width: 80px;
    height: 80px;
    animation-delay: 3s;
}

.login-particle:nth-child(4) {
    left: 55%;
    width: 50px;
    height: 50px;
    animation-delay: 4.5s;
}

.login-particle:nth-child(5) {
    left: 70%;
    width: 70px;
    height: 70px;
    animation-delay: 6s;
}

.login-particle:nth-child(6) {
    left: 85%;
    width: 45px;
    height: 45px;
    animation-delay: 7.5s;
}

.login-particle:nth-child(7) {
    left: 15%;
    width: 55px;
    height: 55px;
    animation-delay: 9s;
}

.login-particle:nth-child(8) {
    left: 35%;
    width: 65px;
    height: 65px;
    animation-delay: 2s;
}

.login-particle:nth-child(9) {
    left: 60%;
    width: 35px;
    height: 35px;
    animation-delay: 5s;
}

.login-particle:nth-child(10) {
    left: 80%;
    width: 75px;
    height: 75px;
    animation-delay: 8s;
}

/* Login container */
.login-container {
    text-align: center;
    animation: loginFadeIn 0.6s ease-out;
    z-index: 3;
    position: relative;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

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

.login-logo {
    margin-bottom: 40px;
    opacity: 0;
    animation: loginFadeIn 0.6s ease-out 0.2s forwards;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.login-logo svg {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
    display: block;
}

/* Login form */
.login-form {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: loginFadeIn 0.6s ease-out 0.4s forwards;
    width: 100%;
}

.login-title {
    color: #FAD701;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 0 0 24px 0;
}

.login-input-group {
    margin-bottom: 20px;
    text-align: left;
}

.login-input-group label {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-input-group input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.login-input-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.login-input-group input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: #FAD701;
    box-shadow: 0 0 0 3px rgba(250, 215, 1, 0.2);
}

.login-error {
    background: rgba(160, 3, 3, 0.2);
    border: 1px solid rgba(160, 3, 3, 0.4);
    color: #ff6b6b;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: #FAD701;
    color: #011C32;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.login-btn:hover {
    background: #FDE34A;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 215, 1, 0.4);
}

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

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile responsive */
@media (max-width: 744px) {
    .login-container {
        max-width: 340px;
    }
    
    .login-form {
        padding: 24px;
    }
    
    .login-title {
        font-size: 20px;
    }
}

/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-primary);
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: var(--font-size-base);
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    background: #011C32 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100vh;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* Elevate sidebar-content when project menu is open to appear above sticky elements */
.sidebar-content:has(.project-menu.active) {
    z-index: 100;
}

/* Force all sidebar text to white */
.sidebar,
.sidebar *,
.sidebar label,
.sidebar .section-title,
.sidebar .subsection-title,
.sidebar .color-label {
    color: #FFFFFF !important;
}

/* Sidebar Logo - Sticky */
.sidebar-logo {
    position: sticky;
    top: 0;
    background: var(--color-fill-dark-blue);
    height: 56px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    z-index: 10;
}

.sidebar-divider {
    height: 1px;
    background: #035CA7;
    opacity: 0.15;
    margin: 0;
    flex-shrink: 0;
}

.sidebar-divider.sidebar-divider-bottom {
    margin: 0 0 16px 0;
}


/* Sidebar Sections */
.sidebar-sections {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px;
}

.sidebar-section {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.section-header.projects-header {
    padding-bottom: 4px;
}

.section-header:hover {
    background: transparent;
}

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

.section-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-icon svg {
    width: 100%;
    height: 100%;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
}

.section-toggle {
    width: 20px;
    height: 20px;
}

/* Projects Section Header Specific Styles */
.section-header.projects-header {
    background: transparent;
    padding: 12px 16px;
    gap: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: 100%;
    cursor: default; /* Override section-header cursor */
}

.section-header.projects-header:hover {
    background: transparent;
}

.projects-header-left {
    display: inline-flex;
    align-items: center;
    gap: 0;
    cursor: pointer; /* Only the left side is clickable */
}

.section-header.projects-header .section-title {
    color: #3D6A8F !important;
}

.projects-count {
    font-size: 13px;
    font-weight: 500;
    color: #3D6A8F !important;
}

.section-header.projects-header .section-toggle {
    display: inline-block;
    padding: 0 4px;
    width: 16px;
    height: 16px;
    color: #3D6A8F;
    line-height: 0;
}

.section-header.projects-header .section-toggle svg {
    display: block;
    width: 16px !important;
    height: 16px !important;
}

.section-header.projects-header .section-toggle svg path {
    fill: #3D6A8F !important;
}

/* Projects Edit Link */
.projects-edit-link {
    font-size: 13px;
    font-weight: 500;
    color: #3D6A8F !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    user-select: none;
    flex-shrink: 0;
}

.projects-edit-link:hover {
    opacity: 0.7;
}

.projects-edit-link.active {
    color: white !important;
    font-weight: 600;
}

/* Project Item Checkbox (Selection Mode) */
.project-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #3B82F6;
}

/* Selection Mode - Project Item Styles */
.project-item.selected {
    background: rgba(59, 130, 246, 0.15) !important;
    border-left: 3px solid #3B82F6;
    padding-left: 21px;
}

.project-item.selection-mode {
    cursor: pointer;
}

/* Projects Selection Controls (Gmail-style) */
.projects-selection-controls {
    padding: 12px 24px 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    animation: slideDownFade 0.2s ease;
}

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

.selection-control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.select-all-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3B82F6;
    flex-shrink: 0;
}

.select-all-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.delete-selected-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    background: #EF4444;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: slideDownFade 0.2s ease;
    width: 100%;
    justify-content: center;
}

.delete-selected-btn:hover {
    background: #DC2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.delete-selected-btn .btn-icon {
    width: 14px;
    height: 14px;
}

.selected-count-text {
    font-weight: 600;
}

/* Bulk Delete Modal Specific Styles */
.bulk-delete-modal {
    max-width: 500px;
}

.bulk-delete-list {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 12px;
    margin: 12px 0;
    max-height: 200px;
    overflow-y: auto;
}

.bulk-delete-list-item {
    padding: 6px 8px;
    font-size: 14px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-delete-list-item::before {
    content: "•";
    color: #EF4444;
    font-weight: bold;
    font-size: 16px;
}

.section-content {
    max-height: 2000px;
    overflow: visible;
    transition: max-height 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

.subsection {
    padding-left: 0px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 0px;
    padding-bottom: 0px;
}

.sidebar-content > .sidebar-section:first-child .subsection {
    padding-top: 24px;
    padding-bottom: 24px;
}

.section-selector {
    position: relative;
    z-index: 1000;
    width: 102px;
}


.section-selector-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.section-selector-icon svg {
    width: 14px;
    height: 14px;
}

.section-selector-arrow {
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    transform: rotate(180deg);
}

.section-selector.open .section-selector-arrow {
    transform: rotate(0deg);
}

.section-selector-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #0A375C;
    border: 1px solid rgba(148, 181, 209, 0.5);
    border-radius: 4px;
    margin-bottom: 4px;
    z-index: 2000;
    overflow: hidden;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.section-selector.open .section-selector-dropdown {
    display: block;
}

.section-selector-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 8px 0;
    font-size: 12px;
    color: #FFFFFF;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    width: 100%;
}

.section-selector-content {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.section-selector-selected:hover {
    background-color: transparent;
}

.section-selector.open .section-selector-selected {
    background-color: transparent;
}

.section-selector-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: #FFFFFF;
    cursor: pointer;
    transition: background 0.2s ease;
}

.section-selector-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.section-selector-option.active {
    background: rgba(250, 215, 1, 0.2);
    font-weight: 600;
}

.subsection-title {
    font-size: 12px;
    font-weight: 600;
    padding: 12px 24px 8px;
    opacity: 0.8;
}

/* Sidebar Buttons */
.action-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: #FFFFFF;
    padding: 8px 16px;
    padding-left: 24px;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: transparent;
    transform: translateX(4px);
}

.btn-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

.action-btn .btn-icon svg path {
    fill: #FFFFFF;
}

/* Color Picker Row */
.color-picker-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    padding-left: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.color-picker-row:hover {
    background: transparent;
    transform: translateX(4px);
}

.color-preview {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.color-label {
    font-size: 14px;
    font-weight: 400;
}

input[type="color"] {
    position: fixed;
    top: 0;
    left: 0;
    opacity: 0;
    pointer-events: none;
}

/* Toggle Switches */
.toggle-group {
    padding: 12px 24px;
}

.toggle-group label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    transition: background 0.3s;
}

input[type="checkbox"]:checked + .toggle-switch {
    background: var(--color-fill-brand);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

input[type="checkbox"]:checked + .toggle-switch .toggle-slider {
    transform: translateX(20px);
}

/* ========== PREVIEW AREA ========== */
.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-secondary);
    overflow: visible;
}

/* Preview Top Bar */
.preview-top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #EDF3F7;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.preview-btn,
.help-btn {
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-btn:hover,
.help-btn:hover {
    opacity: 0.7;
}

.preview-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.preview-btn:disabled:hover {
    opacity: 0.4;
}

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

.preview-btn .btn-icon svg {
    width: 16px;
    height: 16px;
}

.preview-btn .btn-icon svg path {
    fill: #011C32;
}

.preview-title {
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
    flex: 1;
    text-align: center;
}

.new-file-btn {
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s;
}

.new-file-btn:hover {
    opacity: 0.7;
}

.new-file-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

/* Preview Content */
.preview-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
    padding: var(--space-2xl) var(--space-xl) 88px;
    padding-left: 70px; /* Extra padding for section markers (50px markers + 20px spacing) */
    position: relative;
}

.newsletter-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: 360px;
    overflow: visible !important; /* Allow section markers to show outside bounds */
}

/* Inner wrapper that clips content to border-radius */
.newsletter-inner {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    background: white;
    box-shadow: var(--shadow-md);
    overflow: hidden; /* Clips content to border-radius */
    /* CSS variables for border overlay - controlled by JS */
    --newsletter-border-width: 0px;
    --newsletter-border-style: solid;
    --newsletter-border-color: transparent;
}

/* Border overlay using pseudo-element - sits on top of content so section backgrounds show through */
.newsletter-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-width: var(--newsletter-border-width);
    border-style: var(--newsletter-border-style);
    border-color: var(--newsletter-border-color);
    border-radius: inherit;
    pointer-events: none; /* Don't interfere with content interactions */
    z-index: 10; /* Above content but below toolbars */
}

/* Section Markers */
.section-markers {
    position: absolute;
    left: -50px;
    top: 0;
    width: 28px; /* Width for the marker icons */
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.section-marker {
    position: absolute;
    left: 0;
    width: 28px;
    transition: all 0.3s ease;
}

.marker-line {
    position: absolute;
    left: 13px; /* Center under the 28px icon */
    width: 2px;
    height: 100%;
    background: rgba(10, 55, 92, 0.4);
    pointer-events: none;
}

/* Lines are 16px shorter than sections (8px top + 8px bottom) */
.marker-line {
    height: calc(100% - 16px);
    top: 8px;
}

.marker-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
}

.marker-icon:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.marker-icon:active {
    transform: translate(-50%, -50%) scale(1.05);
}

.marker-icon svg {
    width: 16px;
    height: 16px;
}

.marker-icon svg path {
    fill: #0A375C !important;
}

/* Active state for marker icon - dark blue circle with white icon on light backgrounds */
.marker-icon.active {
    background: #0A375C;
    border-color: #0A375C;
}

.marker-icon.active svg path {
    fill: #FFFFFF !important;
}

/* Active state for marker line */
.section-marker.active .marker-line {
    background: #0A375C;
}

/* Dark background adaptive styling */
.marker-line.on-dark {
    background: rgba(255, 255, 255, 0.4);
}

.marker-icon.on-dark {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.4);
}

.marker-icon.on-dark svg path {
    fill: #0A375C !important;
}

.marker-icon.on-dark.active {
    background: #FAD701;
    border-color: #FAD701;
}

.marker-icon.on-dark.active svg path {
    fill: #0A375C !important;
}

/* Active state for marker line on dark backgrounds */
.section-marker.active .marker-line.on-dark {
    background: #FAD701;
}

/* Hide markers in preview mode */
.preview-overlay .section-markers {
    display: none;
}

/* Hide markers on mobile only */
@media (max-width: 768px) {
    .section-markers {
        display: none;
    }
}

/* Preview Bottom Bar */
.preview-bottom-bar {
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: #EDF3F7;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.preview-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-file-btn,
.open-btn,
.save-btn,
.help-btn-topbar {
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 14px;
    font-weight: 700;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.new-file-btn:hover,
.open-btn:hover,
.save-btn:hover,
.help-btn-topbar:hover {
    opacity: 0.7;
}

.new-file-btn .btn-icon,
.open-btn .btn-icon,
.save-btn .btn-icon,
.help-btn-topbar .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.new-file-btn .btn-icon svg,
.open-btn .btn-icon svg,
.save-btn .btn-icon svg,
.help-btn-topbar .btn-icon svg {
    width: 16px;
    height: 16px;
}

.new-file-btn .btn-icon svg path,
.save-btn .btn-icon svg path,
.help-btn-topbar .btn-icon svg path {
    fill: #011C32;
}

.open-btn .btn-icon svg path {
    stroke: #011C32;
    fill: none;
}

.open-btn .btn-icon,
.save-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.export-buttons {
    display: flex;
    gap: 16px;
}

.export-action-btn {
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.export-action-btn:hover {
    background: rgba(1, 28, 50, 0.05);
    border-radius: 4px;
}

/* ========== COLOR PICKER OVERLAY ========== */
.color-picker-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.color-picker-overlay.active {
    display: flex;
}

.color-picker-modal {
    width: 420px;
    max-width: 90%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.color-picker-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #D0DCE5;
}

.color-picker-title {
    font-size: 16px;
    font-weight: 700;
    color: #011C32;
}

.color-picker-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.color-picker-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.color-picker-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.color-category {
    margin-bottom: 24px;
}

.color-category:last-of-type {
    margin-bottom: 0;
}

.color-category-title {
    font-size: 12px;
    font-weight: 600;
    color: #0A375C;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.color-swatches {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid #E0E0E0;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
    border-color: #035CA7;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

.color-swatch.selected {
    border-color: #035CA7;
    border-width: 3px;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #035CA7;
}

.color-swatch-tooltip {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.color-swatch:hover .color-swatch-tooltip {
    opacity: 1;
}

.color-picker-custom {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #EDF3F7;
}

.custom-color-btn {
    width: 100%;
    padding: 12px 16px;
    background: #F5F5F5;
    border: 2px solid #D0DCE5;
    border-radius: 6px;
    color: #0A375C;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-color-btn:hover {
    background: #EDF3F7;
    border-color: #035CA7;
    color: #035CA7;
}

/* ========== CUSTOM COLOR PICKER MODAL ========== */
.custom-cp-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.custom-cp-overlay.active {
    display: flex;
}

.custom-cp-modal {
    width: 340px;
    max-width: 92%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    user-select: none;
}

/* Header — matches color-picker-header, media-library-header */
.custom-cp-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #D0DCE5;
    border-radius: 8px 8px 0 0;
}

.custom-cp-title {
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
}

.custom-cp-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.custom-cp-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

/* Body */
.custom-cp-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Saturation/Brightness canvas */
.custom-cp-canvas-wrap {
    position: relative;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    cursor: crosshair;
    border: 1px solid #D0DCE5;
}

.custom-cp-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 160px;
    border-radius: 5px;
}

.custom-cp-cursor {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2.5px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.35);
    z-index: 2;
}

/* Slider rows */
.custom-cp-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Preview swatch */
.custom-cp-preview-swatch {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    border: 2px solid #D0DCE5;
    background: repeating-conic-gradient(#E5E7EB 0% 25%, #fff 0% 50%) 50% / 8px 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Hue slider */
.custom-cp-hue-wrap {
    flex: 1;
    position: relative;
    height: 16px;
}

.custom-cp-hue-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 16px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(to right, 
        #ff0000 0%, #ffff00 17%, #00ff00 33%, 
        #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    border: 1px solid #D0DCE5;
}

.custom-cp-hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #D0DCE5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: grab;
}

.custom-cp-hue-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #D0DCE5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: grab;
}

/* Opacity slider */
.custom-cp-opacity-bg {
    flex: 1;
    position: relative;
    height: 16px;
    border-radius: 8px;
    background: repeating-conic-gradient(#E5E7EB 0% 25%, #fff 0% 50%) 50% / 8px 8px;
    overflow: hidden;
    border: 1px solid #D0DCE5;
    --cp-color-rgb: 255, 0, 0;
}

.custom-cp-opacity-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 16px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(to right, 
        rgba(var(--cp-color-rgb), 0) 0%, 
        rgba(var(--cp-color-rgb), 1) 100%);
    position: relative;
    z-index: 1;
}

.custom-cp-opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #D0DCE5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: grab;
}

.custom-cp-opacity-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid #D0DCE5;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    cursor: grab;
}

/* Input row */
.custom-cp-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0; /* allow flex children to shrink */
}

.custom-cp-format-dropdown {
    background: #F5F7FA;
    border: 1px solid #D0DCE5;
    color: #0A375C;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 6px;
    border-radius: 6px;
    cursor: pointer;
    outline: none;
    width: 56px;
    flex-shrink: 0;
    text-align: center;
}

.custom-cp-format-dropdown:focus {
    border-color: #035CA7;
}

.custom-cp-hex-input {
    flex: 1;
    min-width: 0; /* allow shrinking */
    background: #F5F7FA;
    border: 1px solid #D0DCE5;
    color: #011C32;
    font-size: 13px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    padding: 7px 8px;
    border-radius: 6px;
    text-align: center;
    outline: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

.custom-cp-hex-input:focus {
    border-color: #035CA7;
}

.custom-cp-values-wrap {
    flex: 1;
    min-width: 0;
}

.custom-cp-triple-input {
    display: flex;
    gap: 4px;
}

.custom-cp-val-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.custom-cp-val-group label {
    font-size: 10px;
    color: #6B7B8D;
    margin-top: 2px;
    font-weight: 500;
    line-height: 1;
}

.custom-cp-val-input {
    width: 100%;
    min-width: 0;
    background: #F5F7FA;
    border: 1px solid #D0DCE5;
    color: #011C32;
    font-size: 12px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    padding: 7px 4px;
    border-radius: 6px;
    text-align: center;
    outline: none;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

.custom-cp-val-input::-webkit-outer-spin-button,
.custom-cp-val-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-cp-val-input:focus {
    border-color: #035CA7;
}

.custom-cp-opacity-input-wrap {
    display: flex;
    align-items: center;
    background: #F5F7FA;
    border: 1px solid #D0DCE5;
    border-radius: 6px;
    padding: 0 6px 0 0;
    flex-shrink: 0;
    width: 58px;
    box-sizing: border-box;
}

.custom-cp-opacity-input {
    width: 34px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 13px;
    padding: 7px 2px 7px 6px;
    text-align: right;
    outline: none;
    -moz-appearance: textfield;
}

.custom-cp-opacity-input::-webkit-outer-spin-button,
.custom-cp-opacity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-cp-percent {
    color: #6B7B8D;
    font-size: 12px;
    font-weight: 500;
}

/* Action buttons */
.custom-cp-actions {
    display: flex;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid #EDF3F7;
}

.custom-cp-cancel-btn {
    flex: 1;
    padding: 10px 12px;
    background: #F5F5F5;
    border: 1px solid #D0DCE5;
    border-radius: 6px;
    color: #0A375C;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-cp-cancel-btn:hover {
    background: #EDF3F7;
    border-color: #035CA7;
    color: #035CA7;
}

.custom-cp-apply-btn {
    flex: 1;
    padding: 10px 12px;
    background: #035CA7;
    border: 1px solid #035CA7;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-cp-apply-btn:hover {
    background: #0470C8;
    border-color: #0470C8;
}

/* ========== MEDIA LIBRARY OVERLAY ========== */
.media-library-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.media-library-overlay.active {
    display: flex;
}

.media-library-modal {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.media-library-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px 8px 0 0;
}

.media-library-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
}

.media-library-title .btn-icon svg path {
    fill: #011C32;
}

.media-library-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.media-library-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.media-library-tabs {
    display: flex;
    gap: 0;
    background: #EDF3F7;
    border-bottom: 2px solid #D0DCE5;
}

.media-tab {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: #0A375C;
    cursor: pointer;
    transition: all 0.2s ease;
}

.media-tab:hover {
    background: rgba(3, 92, 167, 0.05);
}

.media-tab.active {
    color: #035CA7;
    border-bottom-color: #035CA7;
    background: white;
}

.media-library-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #F5F5F5;
}

.media-tab-content {
    display: none;
}

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

.media-library-upload-area {
    margin-bottom: 24px;
}

.media-upload-btn {
    background: #035CA7;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.media-upload-btn:hover {
    background: #024A8C;
}

.media-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.media-item {
    background: white;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
}

.media-item:hover {
    border-color: #035CA7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.media-item-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    background: #f3f4f6;
}

.media-item-name {
    font-size: 12px;
    color: #0A375C;
    margin-top: 8px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-item-delete {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: rgba(211, 47, 47, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.media-item:hover .media-item-delete {
    display: flex;
}

.media-item-delete:hover {
    background: #D32F2F;
}

/* ========== TEMPLATE SELECTOR MODAL ========== */
.template-selector-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.template-selector-overlay.active {
    display: flex;
}

.template-selector-modal {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.template-modal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.template-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.template-modal-title .btn-icon svg path {
    fill: #011C32;
}

.template-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.template-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.template-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.template-modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.template-modal-header h2 {
    font-size: 24px;
    color: #011C32;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.template-modal-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.template-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.template-close-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-close-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

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

.template-card {
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

.template-card:hover {
    border-color: #035CA7;
    box-shadow: 0 8px 24px rgba(3, 92, 167, 0.15);
    transform: translateY(-4px);
}

.template-card-blank {
    border-color: #D1D5DB;
    background: #F9FAFB;
}

.template-card-blank:hover {
    border-color: #011C32;
    background: white;
}

.template-card-import {
    border-color: #D1D5DB;
    background: #F9FAFB;
}

.template-card-import:hover {
    border-color: #011C32;
    background: white;
}

.template-icon {
    font-size: 56px;
    margin-bottom: 16px;
    line-height: 1;
}

.template-name {
    font-size: 18px;
    font-weight: 700;
    color: #1F2937;
    margin-bottom: 8px;
}

.template-description {
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
    margin-bottom: 20px;
    flex-grow: 1;
}

.template-use-btn {
    background: #035CA7;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.template-use-btn:hover {
    background: #024780;
    transform: scale(1.05);
}

.template-card-blank .template-use-btn {
    background: #011C32;
    color: white;
}

.template-card-blank .template-use-btn:hover {
    background: #023558;
}

.template-card-import .template-use-btn {
    background: #011C32;
    color: white;
}

.template-card-import .template-use-btn:hover {
    background: #023558;
}

/* Mobile Responsive */
@media (max-width: 744px) {
    .template-selector-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .template-modal-body {
        padding: 20px;
    }
    
    .template-modal-footer {
        padding: 16px 20px;
    }
    
    .template-close-btn {
        width: 100%;
    }
    
    .template-modal-header h2 {
        font-size: 24px;
    }
    
    .template-modal-header p {
        font-size: 14px;
    }
    
    .template-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .template-card {
        padding: 20px 16px;
    }
    
    .template-icon {
        font-size: 48px;
    }
}

/* ========== PREVIEW OVERLAY (Modal) ========== */
.preview-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10001; /* Higher than template-selector-overlay (10000) to ensure preview appears on top */
    align-items: center;
    justify-content: center;
}

.preview-overlay.active {
    display: flex;
}

.preview-modal {
    width: 90%;
    max-width: 800px;
    height: 90vh;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.preview-modal-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px 8px 0 0;
}

.preview-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
}

.preview-modal-title .btn-icon svg path {
    fill: #011C32;
}

.preview-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.preview-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.preview-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    /* background set dynamically via JavaScript based on outerBgColor */
}

.preview-newsletter-content {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* background removed - uses parent's outerBgColor */
}

/* List styling in preview mode */
.preview-newsletter-content ul,
.preview-newsletter-content ol {
    margin: 8px 0;
    padding-left: 36px;
    list-style-position: outside;
}

.preview-newsletter-content ul {
    list-style-type: disc;
}

.preview-newsletter-content ol {
    list-style-type: decimal;
}

.preview-newsletter-content li {
    margin-bottom: 4px;
    padding-left: 4px;
}

.preview-newsletter-content li:last-child {
    margin-bottom: 0;
}

/* Nested lists in preview */
.preview-newsletter-content ul ul,
.preview-newsletter-content ol ol,
.preview-newsletter-content ul ol,
.preview-newsletter-content ol ul {
    margin-top: 4px;
    margin-bottom: 4px;
}

.preview-newsletter-content ul ul {
    list-style-type: circle;
}

.preview-newsletter-content ul ul ul {
    list-style-type: square;
}

.preview-modal-footer {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0 0 8px 8px;
}

.preview-export-buttons {
    display: flex;
    gap: 16px;
}

.preview-export-btn {
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.preview-export-btn:hover {
    background: rgba(1, 28, 50, 0.05);
    border-radius: 4px;
}

.preview-export-btn .btn-icon svg path {
    fill: #011C32;
}

.preview-close-footer-btn {
    background: #011C32;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-close-footer-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* ========== PROPERTIES PANEL (Right Side) ========== */
.properties-panel {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    background: #EDF3F7;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* Panel Content Wrapper - Scrollable container for all editors and controls */
.panel-content-wrapper {
    flex: 1;
    min-height: 0; /* Critical for flex scrolling */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px; /* Extra space at bottom for comfortable scrolling */
}

/* Custom scrollbar for panel content wrapper */
.panel-content-wrapper::-webkit-scrollbar {
    width: 6px;
}

.panel-content-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.panel-content-wrapper::-webkit-scrollbar-thumb {
    background: rgba(10, 55, 92, 0.2);
    border-radius: 3px;
}

.panel-content-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(10, 55, 92, 0.4);
}

/* Panel Empty State */
.panel-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    flex: 1;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: #0A375C;
    margin: 0 0 8px 0;
}

.empty-state-hint {
    font-size: 13px;
    color: #6B7280;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.panel-add-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 200px;
}

.panel-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-add-btn:hover {
    background: #0A375C;
    color: #FFFFFF;
    border-color: #0A375C;
}

.panel-add-btn .btn-icon {
    width: 16px;
    height: 16px;
}

/* Panel Editors */
.panel-editor {
    display: flex;
    flex-direction: column;
    flex-shrink: 0; /* Don't shrink the editor, let the wrapper scroll */
    overflow: visible; /* Allow content to be part of scrollable area */
}

.panel-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 16px;
    background: #FFFFFF;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-editor-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-type-icon {
    font-size: 18px;
}

.editor-type-label {
    font-size: 14px;
    font-weight: 600;
    color: #0A375C;
}

.delete-block-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #DC2626;
}

.delete-block-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}

.delete-block-btn .btn-icon {
    width: 16px;
    height: 16px;
}

/* Make trash icon SVG red */
.delete-block-btn .btn-icon svg {
    width: 16px;
    height: 16px;
}

.delete-block-btn .btn-icon svg path {
    fill: #DC2626;
    transition: fill 0.2s ease;
}

.delete-block-btn:hover .btn-icon svg path {
    fill: #B91C1C;
}

.panel-editor-body {
    overflow-x: hidden;  /* Prevent horizontal scrolling with icons */
    overflow-y: visible; /* Let the wrapper handle scrolling */
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Panel Toolbar */
.panel-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Panel Text Input */
.panel-text-input {
    min-height: 150px;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;  /* Prevent horizontal scrolling */
    padding: 12px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.6;
    color: #0A375C;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;  /* Force breaks between icons */
    white-space: normal !important;  /* Ensure wrapping is enabled */
}

/* Ensure font icons wrap in panel text input */
.panel-text-input .font-icon {
    display: inline-block;
    vertical-align: middle;
    line-height: inherit;
}

.panel-text-input:focus {
    border-color: #0A375C;
    box-shadow: 0 0 0 3px rgba(10, 55, 92, 0.1);
}

.panel-text-input:empty::before {
    content: attr(data-placeholder);
    color: #9CA3AF;
    pointer-events: none;
}

/* List styling in panel text input */
.panel-text-input ul,
.panel-text-input ol {
    margin: 8px 0;
    padding-left: 36px;
    list-style-position: outside;
}

.panel-text-input ul {
    list-style-type: disc;
}

.panel-text-input ol {
    list-style-type: decimal;
}

.panel-text-input li {
    margin-bottom: 4px;
    line-height: inherit;
    padding-left: 4px;
}

.panel-text-input li:last-child {
    margin-bottom: 0;
}

/* Nested lists in panel */
.panel-text-input ul ul,
.panel-text-input ol ol,
.panel-text-input ul ol,
.panel-text-input ol ul {
    margin-top: 4px;
    margin-bottom: 4px;
}

.panel-text-input ul ul {
    list-style-type: circle;
}

.panel-text-input ul ul ul {
    list-style-type: square;
}

/* First list in panel text input */
.panel-text-input > ul:first-child,
.panel-text-input > ol:first-child {
    margin-top: 0;
}

/* Last list in panel text input */
.panel-text-input > ul:last-child,
.panel-text-input > ol:last-child {
    margin-bottom: 0;
}

/* Panel Image Preview */
.panel-image-preview {
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    padding: 12px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 4px;
}

.image-placeholder-panel {
    color: #9CA3AF;
    font-size: 14px;
    text-align: center;
    padding: 24px;
}

/* Panel Divider Preview */
.panel-divider-preview {
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    padding: 24px 12px;
}

.divider-preview-line {
    border: none;
    height: 1px;
    background: #000000;
    margin: 0;
}

/* Panel Controls */
.panel-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-control-label {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-input {
    flex: 1;
    padding: 8px 10px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 13px;
    color: #0A375C;
    outline: none;
    transition: border-color 0.2s ease;
}

.panel-input:focus {
    border-color: #0A375C;
}

.panel-select {
    padding: 8px 10px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 13px;
    color: #0A375C;
    cursor: pointer;
    outline: none;
}

.panel-btn {
    padding: 8px 12px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.panel-btn:hover {
    background: #0A375C;
    color: #FFFFFF;
    border-color: #0A375C;
}

.panel-btn-primary {
    background: #0A375C;
    color: #FFFFFF;
    border-color: #0A375C;
}

.panel-btn-primary:hover {
    background: #023558;
}

/* Row Editor Panel */
.row-editor .panel-editor-body {
    padding: 16px;
}

.row-editor-info {
    padding: 12px;
    background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
    border-radius: 8px;
    margin-bottom: 16px;
}

.row-editor-info p {
    margin: 0;
    font-size: 14px;
    color: #0A375C;
    font-weight: 500;
}

.row-editor-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.row-control-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.row-control-item label {
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

.row-editor-actions {
    padding-top: 12px;
    border-top: 1px solid rgba(10, 55, 92, 0.08);
}

/* Column Width Controls */
.row-control-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.row-width-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.row-width-preset-btn {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

.row-width-preset-btn:hover {
    background: #EFF6FF;
    border-color: #035CA7;
    color: #035CA7;
}

.row-width-preset-btn.active {
    background: #035CA7;
    border-color: #035CA7;
    color: #fff;
}

.row-width-preview-bar {
    display: flex;
    gap: 3px;
    margin-bottom: 10px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
}

.row-width-preview-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #1E40AF;
    transition: flex 0.15s ease;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
}

.row-width-preview-segment:nth-child(2n) {
    background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
    color: #166534;
}

.row-width-pct-label {
    cursor: pointer;
    border-bottom: 1px dashed currentColor;
    padding: 0 2px;
}

.row-width-pct-label:hover {
    opacity: 0.7;
}

.row-width-pct-input {
    width: 38px;
    border: 1px solid currentColor;
    border-radius: 3px;
    background: rgba(255,255,255,0.9);
    color: inherit;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 1px 2px;
    outline: none;
    -moz-appearance: textfield;
}

.row-width-pct-input::-webkit-inner-spin-button,
.row-width-pct-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.row-width-sliders {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.row-width-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.row-width-slider-label {
    font-size: 12px;
    color: #6B7280;
    min-width: 52px;
    white-space: nowrap;
}

.row-width-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #E5E7EB;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.row-width-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #035CA7;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.row-width-slider-value {
    font-size: 12px;
    font-weight: 600;
    color: #035CA7;
    min-width: 32px;
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
}

/* Merge Similar Option */
.merge-similar-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.merge-similar-option input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #fff;
}

/* Panel Row Info (when item is part of a row) */
.panel-row-info {
    padding: 12px 16px;
    background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
    border-top: 1px solid rgba(10, 55, 92, 0.08);
    border-bottom: 1px solid rgba(10, 55, 92, 0.08);
}

.row-info-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.row-info-icon {
    font-size: 16px;
}

.row-info-label {
    font-size: 13px;
    font-weight: 600;
    color: #0A375C;
}

.row-info-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row-info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.row-info-key {
    font-size: 12px;
    font-weight: 500;
    color: #4B5563;
}

.row-info-value {
    font-size: 12px;
    font-weight: 600;
    color: #0A375C;
    background: rgba(10, 55, 92, 0.08);
    padding: 4px 10px;
    border-radius: 4px;
}

.panel-row-gap-select {
    padding: 5px 10px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 12px;
    color: #0A375C;
    cursor: pointer;
    min-width: 100px;
}

.panel-row-gap-select:hover {
    border-color: rgba(10, 55, 92, 0.3);
}

.panel-row-gap-select:focus {
    outline: none;
    border-color: #0A375C;
    box-shadow: 0 0 0 2px rgba(10, 55, 92, 0.1);
}

.row-info-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(10, 55, 92, 0.1);
}

.panel-unmerge-btn {
    width: 100%;
    padding: 8px 12px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.panel-unmerge-btn:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
}

/* Panel Alignment Buttons */
.panel-align-buttons {
    display: flex;
    gap: 4px;
}

.panel-align-btn {
    width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.15s ease;
}

.panel-align-btn:hover {
    background: #F3F4F6;
    border-color: rgba(10, 55, 92, 0.25);
    color: #0A375C;
}

.panel-align-btn.active {
    background: #0A375C;
    border-color: #0A375C;
    color: #FFFFFF;
}

.panel-align-btn svg {
    width: 16px;
    height: 16px;
}

.panel-align-btn-inline {
    color: #6B7280;
}

.panel-align-btn-inline:hover {
    color: #0A375C;
}

.panel-align-btn-inline.active,
.panel-valign-btn-inline.active {
    background: #0A375C;
    color: #FFFFFF;
}

.panel-valign-btn-inline {
    color: #6B7280;
}

.panel-valign-btn-inline:hover {
    color: #0A375C;
}

/* Image Shape Presets */
.image-shape-presets {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.image-shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.15s ease;
    flex: 1;
    min-width: 0;
}

.image-shape-btn:hover {
    background: #F3F4F6;
    border-color: rgba(10, 55, 92, 0.25);
    color: #0A375C;
}

.image-shape-btn.active {
    background: #0A375C;
    border-color: #0A375C;
    color: #FFFFFF;
}

.image-shape-btn .shape-icon {
    font-size: 16px;
    line-height: 1;
}

.image-shape-btn .shape-label {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.image-fit-row {
    display: flex;
    align-items: center;
}

.image-fit-btn {
    padding: 4px 12px;
    background: #FFFFFF;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    transition: all 0.15s ease;
}

.image-fit-btn:hover {
    background: #F3F4F6;
    color: #0A375C;
}

.image-fit-btn.active {
    background: #0A375C;
    border-color: #0A375C;
    color: #FFFFFF;
}

.image-fit-btn + .image-fit-btn {
    margin-left: 4px;
}

/* Panel AI Button */
.panel-ai-btn {
    transition: all 0.2s ease;
}

.panel-ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Panel Spacing Control */
.panel-spacing-control {
    padding: 16px;
    background: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-spacing-control .spacing-label {
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    white-space: nowrap;
}

/* Slider row with value display */
.spacing-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.spacing-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #E5E7EB;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.spacing-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #0A375C;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.spacing-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0A375C;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Value with dropdown wrapper */
.spacing-value-wrapper {
    position: relative;
}

.spacing-value {
    min-width: 42px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.spacing-value:hover {
    background: #F3F4F6;
}

/* Spacing Dropdown */
.spacing-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px;
    display: none;
    z-index: 100;
    min-width: 70px;
}

.spacing-dropdown.active {
    display: block;
}

.spacing-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    text-align: right;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.spacing-dropdown button:hover {
    background: #F3F4F6;
}

.spacing-dropdown button.active {
    background: #035CA7;
    color: #FFFFFF;
}

/* Panel Style Select (Fill/Border type, border style, thickness) */
.panel-style-select {
    padding: 6px 10px;
    background: #EDF3F7;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 13px;
    color: #0A375C;
    cursor: pointer;
    outline: none;
    min-width: 90px;
}

.panel-style-select:focus {
    outline: 2px solid #035CA7;
    outline-offset: 2px;
}

.bg-style-type-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Figma-style Fill/Border Sections */
.style-section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0;
}

.style-section:last-of-type {
    border-bottom: none;
}

.style-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
}

.style-section-header:hover {
    background: rgba(0, 0, 0, 0.02);
    margin: 0 -16px;
    padding: 10px 16px;
}

.style-toggle-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(10, 55, 92, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    color: #6B7280;
    font-size: 18px;
    font-weight: 300;
    line-height: 1;
    transition: all 0.15s ease;
}

.style-toggle-btn:hover {
    background: rgba(10, 55, 92, 0.15);
    color: #0A375C;
}

.style-toggle-btn.active {
    background: #0A375C;
    color: #ffffff;
}

.style-toggle-btn.active .toggle-icon {
    transform: rotate(45deg);
}

.toggle-icon {
    transition: transform 0.15s ease;
    display: inline-block;
}

.style-section-content {
    padding: 4px 0 12px 0;
}

/* Panel Background Color Control */
.panel-bg-color-control {
    padding: 16px;
    background: #FFFFFF;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-bg-color-control .spacing-label {
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
}

.panel-bg-color-control > .spacing-label {
    margin-bottom: -4px;
}

.bg-color-row-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.bg-color-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-color-btn {
    padding: 4px;
    background: #EDF3F7;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease;
}

.panel-color-btn:hover {
    border-color: #0A375C;
}

.panel-btn-small {
    padding: 4px 10px;
    background: #EDF3F7;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 12px;
    color: #6B7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.panel-btn-small:hover {
    background: #E5EDF3;
    color: #0A375C;
}

/* Background radius control */
.bg-radius-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

/* Slider row with value display */
.radius-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.radius-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #E5E7EB;
    border-radius: 3px;
    cursor: pointer;
}

.radius-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #0A375C;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.radius-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0A375C;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Value with dropdown wrapper */
.radius-value-wrapper {
    position: relative;
}

.radius-value {
    min-width: 42px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.radius-value:hover {
    background: #F3F4F6;
}

/* Radius Dropdown */
.radius-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px;
    display: none;
    z-index: 100;
    min-width: 70px;
}

.radius-dropdown.active {
    display: block;
}

.radius-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    text-align: right;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.radius-dropdown button:hover {
    background: #F3F4F6;
}

.radius-dropdown button.active {
    background: #035CA7;
    color: #FFFFFF;
}

/* ===== UNIFIED CUSTOM DROPDOWNS ===== */
/* Consistent dropdown styling for all panel controls */

.custom-dropdown-wrapper {
    position: relative;
}

.custom-dropdown-value {
    min-width: 70px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    background: #EDF3F7;
    border: 1px solid rgba(10, 55, 92, 0.15);
    transition: all 0.15s ease;
    display: inline-block;
}

.custom-dropdown-value:hover {
    background: #E2E8F0;
    border-color: rgba(10, 55, 92, 0.25);
}

.custom-dropdown-value::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #0A375C;
    opacity: 0.6;
}

.custom-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px;
    display: none;
    z-index: 1000;
    min-width: 90px;
}

.custom-dropdown.active {
    display: block;
}

.custom-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #0A375C;
    text-align: right;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.custom-dropdown button:hover {
    background: #F3F4F6;
}

.custom-dropdown button.active {
    background: #035CA7;
    color: #FFFFFF;
}

/* Row control item layout adjustment for custom dropdowns */
.row-control-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.row-control-item label {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

/* Panel Slider Row - consistent slider + dropdown layout */
.panel-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-slider {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #035CA7 0%, #035CA7 var(--value, 50%), #E5E7EB var(--value, 50%), #E5E7EB 100%);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.panel-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #0A375C;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.panel-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #0A375C;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Shadow Controls */
.shadow-position-row {
    display: flex;
    gap: 12px;
}

.shadow-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-number-input {
    width: 100%;
    padding: 6px 8px;
    background: #EDF3F7;
    border: 1px solid rgba(10, 55, 92, 0.15);
    border-radius: 6px;
    font-size: 13px;
    color: #0A375C;
    text-align: center;
    -moz-appearance: textfield;
}

.panel-number-input::-webkit-outer-spin-button,
.panel-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.panel-number-input:focus {
    outline: 2px solid #035CA7;
    outline-offset: 2px;
}

/* Canvas Block Selection Styles */
.canvas-block {
    cursor: pointer;
    position: relative;
    transition: outline 0.15s ease, box-shadow 0.15s ease;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.canvas-block:hover {
    outline-color: rgba(10, 55, 92, 0.25);
}

.canvas-block.selected {
    outline-color: #0A375C;
    box-shadow: 0 0 0 4px rgba(10, 55, 92, 0.25);
}

/* Placeholder for empty blocks in canvas */
.placeholder-text {
    color: #9CA3AF;
    font-style: italic;
}

.empty-image-placeholder {
    background: #F3F4F6;
    padding: 40px;
    text-align: center;
    color: #6B7280;
    border-radius: 4px;
    font-size: 14px;
}

/* Panel Toggle Button (for responsive) */
.panel-toggle-btn {
    display: none;
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: #0A375C;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-size: 18px;
    transition: all 0.2s ease;
}

.panel-toggle-btn:hover {
    background: #023558;
}

/* Canvas Row Block Styles */
.canvas-row-inner {
    display: flex;
    gap: 16px;
    align-items: stretch; /* Stretch children to equal height for vertical alignment to work */
}

.canvas-row-item {
    flex: 1;
    min-width: 0;
    cursor: pointer;
    position: relative;
    border-radius: 4px;
    transition: outline 0.15s ease;
    outline: 2px solid transparent;
}

.canvas-row-item:hover {
    outline-color: rgba(10, 55, 92, 0.2);
}

/* Full-width images in rows - force all children to be 100% width */
.canvas-row-item.row-full-width-item {
    align-items: stretch !important;
}

.canvas-row-item.row-full-width-item > * {
    width: 100% !important;
}

.canvas-row-item.row-full-width-item .canvas-image-preview {
    width: 100% !important;
    flex: 1 1 auto !important;
}

.canvas-row-item.selected {
    outline-color: #0A375C;
}

/* Alternative selection style for dark backgrounds (auto-detected) */
.canvas-block.selected.selection-alt {
    outline-color: #FFFFFF !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3) !important;
}

.canvas-row-item.selected.selection-alt {
    outline-color: #FFFFFF !important;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3) !important;
}

/* Row Item Drag-and-Drop Styles */
.canvas-row-item[draggable="true"] {
    cursor: grab;
    transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.15s ease;
}

.canvas-row-item[draggable="true"]:active {
    cursor: grabbing;
}

.canvas-row-item.row-item-dragging {
    opacity: 0.4 !important;
    transform: scale(0.97);
    outline: 2px dashed #035CA7 !important;
}

.canvas-row-item.drag-over-left {
    box-shadow: -4px 0 0 0 #035CA7;
}

.canvas-row-item.drag-over-right {
    box-shadow: 4px 0 0 0 #035CA7;
}

/* Prevent text selection during drag */
.canvas-row-inner[data-dragging-index] .canvas-row-item {
    user-select: none;
}

/* Vertical alignment adjustments for text in row items */
/* Text preview in row items needs to fill container for alignment to work */
.canvas-row-item .canvas-text-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.canvas-row-item.valign-top .canvas-text-preview {
    justify-content: flex-start;
    padding-top: 0 !important;
}

.canvas-row-item.valign-bottom .canvas-text-preview {
    justify-content: flex-end;
    padding-bottom: 0 !important;
}

.canvas-row-item.valign-middle .canvas-text-preview {
    justify-content: center;
}

/* Image preview in row items - prevent container from stretching by default */
.canvas-row-item .canvas-image-preview {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
    height: auto;
}

/* Full-width container class for images in rows - explicit class instead of :has() for better support */
.canvas-row-item .canvas-image-preview.row-full-width-container {
    width: 100% !important;
    flex: 1 1 100% !important;
    align-self: stretch !important;
}

/* Images in rows with row-full-width class should use 4:3 aspect ratio */
.canvas-row-item .canvas-image-preview img.row-full-width {
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
}

/* Images in rows with row-natural-fit class should maintain aspect ratio */
/* True natural size: display at original dimensions, only scale down if wider than container */
.canvas-row-item .canvas-image-preview img.row-natural-fit {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* Canvas row item alignment for natural-fit images */
.canvas-row-item .canvas-image-preview img.row-natural-fit.align-left {
    margin: 0 auto 0 0;
}

.canvas-row-item .canvas-image-preview img.row-natural-fit.align-center {
    margin: 0 auto;
}

.canvas-row-item .canvas-image-preview img.row-natural-fit.align-right {
    margin: 0 0 0 auto;
}

/* Default images in rows (no class) - prevent stretching */
.canvas-row-item .canvas-image-preview img:not(.row-full-width):not(.row-natural-fit) {
    max-width: 100%;
    height: auto;
}

/* Panel Toggle Styles */
.panel-toggle {
    position: relative;
    display: inline-flex;
    width: 40px;
    height: 22px;
}

.panel-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.panel-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #E5E7EB;
    transition: 0.3s;
    border-radius: 22px;
}

.panel-toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.panel-toggle input:checked + .panel-toggle-slider {
    background-color: #0A375C;
}

.panel-toggle input:checked + .panel-toggle-slider:before {
    transform: translateX(18px);
}

/* Panel Format Button Active State */
.panel-format-btn.active {
    background: #0A375C;
    color: #FFFFFF;
    border-color: #0A375C;
}

/* Responsive: Hide panel on smaller screens */
@media (max-width: 1200px) {
    .properties-panel {
        position: fixed;
        right: 0;
        top: 0;
        height: 100vh;
        max-height: 100vh;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    }
    
    .properties-panel.open {
        transform: translateX(0);
    }
    
    .panel-toggle-btn {
        display: flex;
    }
    
    .properties-panel.open + .panel-toggle-btn {
        right: 336px;
    }
    
    /* Right panel is now a floating overlay, only account for left sidebar */
    .preview-bottom-bar {
        left: calc(50% + var(--sidebar-width) / 2);
    }
}

@media (max-width: 768px) {
    .properties-panel {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
    }
}

/* ========== CONTENT BLOCKS ========== */
.content-area {
    min-height: 200px;
    padding: 20px;
    position: relative;
}

.content-block {
    margin-bottom: 16px;
    position: relative;
}

.header-section .content-block:last-child,
.footer-section .content-block:last-child {
    margin-bottom: 0;
}

/* Text, Image, and Divider Blocks - Shared Styles */
/* Support both edit mode (-type) and canvas mode (-block) */
.content-block.text-type,
.content-block.text-block,
.content-block.image-type,
.content-block.image-block,
.content-block.divider-type,
.content-block.divider-block {
    border: 1px dashed #B8CDE0 !important;
    border-radius: 9px !important;
    padding: 4px !important;
    margin-bottom: 16px;
    position: relative;
    background: transparent !important;
}

/* Non-full-width images use natural size */
.content-block.image-type:not(.full-width-image) .image-container img,
.content-block.image-block:not(.full-width-image) .canvas-image-preview img {
    max-width: 100% !important;
    display: block !important;
}

/* Image alignment classes - must use !important to override other rules */
/* Support both image-container (edit mode) and canvas-image-preview (canvas mode) */
.content-block.image-type:not(.full-width-image) .image-container img.align-left,
.content-block.image-block:not(.full-width-image) .image-container img.align-left,
.content-block.image-block:not(.full-width-image) .canvas-image-preview img.align-left {
    margin: 0 auto 0 0 !important;
}

.content-block.image-type:not(.full-width-image) .image-container img.align-center,
.content-block.image-block:not(.full-width-image) .image-container img.align-center,
.content-block.image-block:not(.full-width-image) .canvas-image-preview img.align-center {
    margin: 0 auto !important;
}

.content-block.image-type:not(.full-width-image) .image-container img.align-right,
.content-block.image-block:not(.full-width-image) .image-container img.align-right,
.content-block.image-block:not(.full-width-image) .canvas-image-preview img.align-right {
    margin: 0 0 0 auto !important;
}

/* Full-width image blocks - show edge-to-edge preview */
/* Support both image-type (edit mode) and image-block (canvas mode) */
.content-block.image-type.full-width-image,
.content-block.image-block.full-width-image {
    padding: 0 !important;
    border: 2px solid #035CA7 !important;
    border-radius: 0 !important;
    overflow: visible !important;
    /* Break out of parent padding (20px each side) */
    margin-left: -20px !important;
    margin-right: -20px !important;
    width: calc(100% + 40px) !important;
}

.content-block.image-type.full-width-image .image-container,
.content-block.image-block.full-width-image .image-container,
.content-block.image-type.full-width-image .canvas-image-preview,
.content-block.image-block.full-width-image .canvas-image-preview {
    overflow: visible !important;
}

.content-block.image-type.full-width-image .image-container img,
.content-block.image-block.full-width-image .image-container img,
.content-block.image-type.full-width-image .canvas-image-preview img,
.content-block.image-block.full-width-image .canvas-image-preview img {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    display: block !important;
    border-radius: 0 !important;
}

/* Full-width indicator badge */
.content-block.image-type.full-width-image::before,
.content-block.image-block.full-width-image::before {
    content: 'FULL WIDTH';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #035CA7;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    z-index: 10;
    letter-spacing: 0.5px;
}

/* Ensure parent sections allow overflow for full-width images */
.content-area:has(.full-width-image),
.header-section:has(.full-width-image),
.footer-section:has(.full-width-image) {
    overflow: visible !important;
}

/* Delete Button */
.delete-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #EDF3F7;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s ease;
}

.delete-btn svg {
    width: 12px;
    height: 15px;
}

.delete-btn svg path {
    fill: #D32F2F;
    transition: fill 0.2s ease;
}

.content-block:hover .delete-btn {
    display: flex;
}

.delete-btn:hover {
    background: #D32F2F;
}

.delete-btn:hover svg path {
    fill: white;
}

/* Block Spacing Control */
.block-spacing-control {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: 6px;
    background: #FFFFFF;
    padding: 4px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    font-size: 11px;
    white-space: nowrap;
}

.spacing-label {
    color: #666;
    font-weight: 500;
}

.spacing-select {
    background: #F8F9FA;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: #0A375C;
    cursor: pointer;
    font-weight: 500;
    min-width: 80px;
}

.spacing-select:focus {
    outline: 2px solid #035CA7;
    outline-offset: 1px;
}

.content-block:hover .block-spacing-control {
    display: flex;
}

/* Drag Handle */
.drag-handle {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    cursor: move !important;
    background: #F8F9FA;
    color: #94B5D1;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: -2px;
    width: 32px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: 1px solid #D0DCE5;
    z-index: 1000;
    transition: all 0.2s ease;
    user-select: none;
    pointer-events: auto !important;
}

.drag-handle:hover {
    background: #035CA7;
    color: #FFFFFF;
    border-color: #035CA7;
}

.content-block:hover .drag-handle {
    display: flex !important;
    pointer-events: auto !important;
}

.content-block.dragging {
    opacity: 0.5;
}

/* ========== TEXT BLOCKS ========== */
.text-toolbar-container {
    background: #EDF3F7;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
}

.text-toolbar-title {
    font-size: 12px;
    font-weight: 700;
    color: #0A375C;
    margin-bottom: 12px;
}

.text-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    height: auto;
    min-height: 32px;
}

/* Shared Dropdown Styles (Text & Divider) */
.text-toolbar select,
.divider-select {
    background: #FFFFFF !important;
    border: 1px solid rgba(148, 181, 209, 0.3) !important;
    border-radius: 4px !important;
    padding: 0 8px !important;
    padding-bottom: 0 !important;
    padding-top: 0 !important;
    font-size: 12px !important;
    color: #0A375C !important;
    cursor: pointer !important;
    font-weight: 400 !important;
    height: 32px !important;
    line-height: 32px !important;
    appearance: none !important;
    background-image: url('data:image/svg+xml;utf8,<svg width="11" height="7" viewBox="0 0 11 7" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.71875 0L10.6719 0.9375L5.32812 6.28125L0 0.9375L0.9375 0L5.32812 4.39062L9.71875 0Z" fill="%230A375C"/></svg>') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 11px 7px !important;
    padding-right: 28px !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
    margin: 0 !important;
}

.text-toolbar select:nth-of-type(1) {
    width: 87px;
}

.text-toolbar select:nth-of-type(2) {
    width: 67px;
}

.text-toolbar select:nth-of-type(3),
.text-toolbar select.line-height-select {
    width: 95px;
}

.text-toolbar select:focus,
.divider-select:focus {
    outline: 2px solid #035CA7;
    outline-offset: 2px;
}

/* Text Toolbar Buttons (Bold, Italic, Align) */
.text-toolbar-btn {
    background: #FFFFFF !important;
    border: 1px solid rgba(148, 181, 209, 0.3) !important;
    border-radius: 4px !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    font-weight: 400;
    font-size: 12px;
    color: #0A375C;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

.text-toolbar-btn svg {
    width: 16px !important;
    height: 16px !important;
    display: block !important;
}

.text-toolbar-btn svg path {
    fill: #0A375C !important;
    transition: fill 0.2s ease !important;
}

.text-toolbar-btn.active {
    background: #035CA7 !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(148, 181, 209, 0.3) !important;
}

.text-toolbar-btn:hover:not(.active) {
    background: rgba(3, 92, 167, 0.1) !important;
}

/* AI Assist button */
.text-toolbar-btn.ai-assist-btn {
    background: linear-gradient(135deg, #730087 0%, #74C9F0 100%) !important;
    border: none !important;
}

.text-toolbar-btn.ai-assist-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(115, 0, 135, 0.4) !important;
    background: linear-gradient(135deg, #8A00A0 0%, #8DD9FF 100%) !important;
}

.text-toolbar-btn.ai-assist-btn svg {
    width: 16px !important;
    height: 16px !important;
}

.text-toolbar-btn.ai-assist-btn svg path {
    fill: white !important;
}

.text-toolbar-btn.active svg path {
    fill: #FFFFFF !important;
}

/* ========== TEXT SELECTION TOOLBAR ========== */
.text-selection-toolbar {
    position: absolute;
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    background: #011C32;
    padding: 6px 8px;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    animation: fadeInUp 0.2s ease;
}

.text-selection-toolbar .sel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.text-selection-toolbar .sel-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.text-selection-toolbar .sel-btn.active {
    background: #035CA7;
    border-color: #035CA7;
}

.text-selection-toolbar .sel-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

.text-selection-toolbar .sel-font-picker {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 8px;
    color: #FFFFFF;
    font-size: 11px;
    cursor: pointer;
    min-width: 100px;
}

.text-selection-toolbar .sel-font-picker option {
    background: #011C32;
    color: #FFFFFF;
}

.text-selection-toolbar .sel-color-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.text-selection-toolbar .sel-color-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Text Color Picker */
.text-color-picker-wrapper {
    position: relative;
    background: #FFFFFF;
    border: 1px solid rgba(148, 181, 209, 0.3);
    border-radius: 4px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    height: 32px;
    width: 100px;
    box-sizing: border-box;
}

.text-color-preview {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.text-color-label {
    font-size: 12px;
    color: #0A375C;
    font-weight: 400;
    white-space: nowrap;
}

.text-color-picker-wrapper input[type="color"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Text Alignment Group */
.text-alignment-group {
    display: flex;
    gap: 4px;
    order: 2;
}

/* Ensure color picker wraps to second row with alignment */
.text-color-picker-wrapper {
    order: 2;
}

/* Text Input */
.text-input {
    width: 100%;
    border: none;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    min-height: 100px;
    padding: 12px 0 12px 8px;
    white-space: pre-wrap;  /* Preserve whitespace/spaces as typed, allows wrapping */
    word-wrap: break-word;  /* Allow long words to wrap */
    word-break: break-word;  /* Force breaks for icons */
    overflow-wrap: break-word;
}

.text-input:empty:before {
    content: attr(data-placeholder);
    color: #999;
}

.text-input a {
    color: #0066CC !important;
    text-decoration: none !important;
}

.text-input a:visited {
    color: #0066CC !important;
}

.text-input a:hover {
    color: #0066CC !important;
    text-decoration: none !important;
}

/* List styling in text blocks */
.text-input ul,
.text-input ol {
    margin: 8px 0;
    padding-left: 36px;
    list-style-position: outside;
}

.text-input ul {
    list-style-type: disc;
}

.text-input ol {
    list-style-type: decimal;
}

.text-input li {
    margin-bottom: 4px;
    line-height: inherit;
    padding-left: 4px;
}

.text-input li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.text-input ul ul,
.text-input ol ol,
.text-input ul ol,
.text-input ol ul {
    margin-top: 4px;
    margin-bottom: 4px;
}

.text-input ul ul {
    list-style-type: circle;
}

.text-input ul ul ul {
    list-style-type: square;
}

/* First list item in text block */
.text-input > ul:first-child,
.text-input > ol:first-child {
    margin-top: 0;
}

/* Last list in text block */
.text-input > ul:last-child,
.text-input > ol:last-child {
    margin-bottom: 0;
}

/* ========== IMAGE BLOCKS ========== */
.image-placeholder {
    background: #EDF3F7;
    border-radius: 4px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    font-size: 12px;
    color: #0A375C;
    font-weight: 400;
}

.image-placeholder:hover {
    background: #E0E9F0;
}

.image-block img {
    max-width: 100%;
    height: auto;
    display: block;
}

.image-alignment {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

.image-alignment button {
    padding: 8px 16px;
    border: 1px solid rgba(148, 181, 209, 0.3);
    background: #FFFFFF;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #0A375C;
}

.image-alignment button.active {
    background: #035CA7;
    color: #FFFFFF;
    border-color: #035CA7;
}

/* ========== DIVIDER BLOCKS ========== */
.divider-preview {
    margin: 0 auto 12px auto;
    width: 100%;
}

.divider-controls-container {
    background: #EDF3F7;
    border-radius: 4px;
    padding: 16px;
}

.divider-controls-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.divider-control-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.divider-control-group span {
    font-size: 12px;
    color: #0A375C;
    font-weight: 400;
    line-height: 32px;
    display: inline-flex;
    align-items: center;
}

.divider-spacer {
    width: 8px;
}

/* ========== HEADER & FOOTER ========== */
.header-section,
.footer-section {
    min-height: 80px;
    position: relative;
    padding: 20px;
    transition: min-height 0.2s ease, background-color 0.2s ease;
}

.header-section {
    border-bottom: 2px solid var(--color-border-light);
}

.footer-section {
    border-top: 2px solid var(--color-border-light);
}

/* Show drop zones during drag */
#headerSection:empty::after,
#contentArea:empty::after,
#footerSection:empty::after {
    content: 'Drop here';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #94B5D1;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

/* Highlight drop zones when dragging */
.header-section:has(+ * .dragging),
.footer-section:has(+ * .dragging),
.content-area:has(.dragging) {
    background-color: rgba(3, 92, 167, 0.02) !important;
    border: 2px dashed #94B5D1 !important;
}

/* Visual feedback for valid drop targets during drag */
body.dragging-active .header-section,
body.dragging-active .footer-section,
body.dragging-active .content-area {
    transition: background-color 0.2s ease, border 0.2s ease;
}

body.dragging-active .header-section:hover,
body.dragging-active .footer-section:hover,
body.dragging-active .content-area:hover {
    background-color: rgba(3, 92, 167, 0.05) !important;
}

/* Section boundary indicators during drag */
body.dragging-active .header-section::after,
body.dragging-active .content-area::before,
body.dragging-active .content-area::after,
body.dragging-active .footer-section::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: #035CA7;
    z-index: 1000;
    pointer-events: none;
}

/* Header bottom boundary */
body.dragging-active .header-section::after {
    bottom: 0;
    content: 'HEADER';
    font-size: 10px;
    color: #035CA7;
    padding: 2px 8px;
    background: #E3F2FD;
    width: auto;
    height: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px 3px 0 0;
}

/* Content top boundary */
body.dragging-active .content-area::before {
    top: 0;
    content: 'CONTENT';
    font-size: 10px;
    color: #035CA7;
    padding: 2px 8px;
    background: #E3F2FD;
    width: auto;
    height: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 3px 3px;
}

/* Content bottom boundary */
body.dragging-active .content-area::after {
    bottom: 0;
    content: 'CONTENT';
    font-size: 10px;
    color: #035CA7;
    padding: 2px 8px;
    background: #E3F2FD;
    width: auto;
    height: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 3px 3px 0 0;
}

/* Footer top boundary */
body.dragging-active .footer-section::before {
    top: 0;
    content: 'FOOTER';
    font-size: 10px;
    color: #035CA7;
    padding: 2px 8px;
    background: #E3F2FD;
    width: auto;
    height: auto;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 3px 3px;
}

/* Auto-scroll zone indicators */
body.drag-scroll-top::before,
body.drag-scroll-bottom::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    height: 180px;
    pointer-events: none;
    z-index: 99999;
    animation: scrollPulse 1s ease-in-out infinite;
}

body.drag-scroll-top::before {
    top: 0;
    background: linear-gradient(to bottom, 
        rgba(59, 130, 246, 0.15) 0%, 
        rgba(59, 130, 246, 0) 100%);
}

body.drag-scroll-bottom::after {
    bottom: 0;
    background: linear-gradient(to top, 
        rgba(59, 130, 246, 0.15) 0%, 
        rgba(59, 130, 246, 0) 100%);
}

@keyframes scrollPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
    }
    
    .preview-container {
        height: 50vh;
    }
    
    .newsletter-content {
        width: 100%;
        max-width: 100%;
    }
}

/* ========== UTILITY CLASSES ========== */
.text-align-left {
    text-align: left;
}

.text-align-center {
    text-align: center;
}

.text-align-right {
    text-align: right;
}

.image-align-left {
    margin-left: 0;
    margin-right: auto;
}

.image-align-center {
    margin-left: auto;
    margin-right: auto;
}

.image-align-right {
    margin-left: auto;
    margin-right: 0;
}

/* ========== ROW BLOCKS (MULTI-COLUMN LAYOUT) ========== */

/* Row block container */
.content-block.row-type {
    border: 2px dashed #94B5D1 !important;
    background: #F8F9FA !important;
    padding: 12px !important;
}

/* Row controls header */
.row-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #EDF3F7;
    border-radius: 4px;
    margin-bottom: 12px;
}

.row-label {
    font-size: 12px;
    font-weight: bold;
    color: #0A375C;
}

.unmerge-btn {
    padding: 6px 16px;
    background: #FFFFFF;
    border: 1px solid rgba(148, 181, 209, 0.3);
    border-radius: 4px;
    font-size: 12px;
    color: #0A375C;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.unmerge-btn:hover {
    background: #035CA7;
    color: #FFFFFF;
    border-color: #035CA7;
}

/* Row columns container */
.row-columns {
    display: flex;
    gap: 8px;
    align-items: flex-start; /* Don't stretch columns by default */
}

.row-column {
    flex: 1;
    min-width: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center; /* Default: center children, not stretch */
}

/* Full-width images in edit mode rows */
.row-column.row-full-width-column {
    align-items: stretch !important;
}

/* Text blocks in columns - toolbar wraps responsively */
.row-column .text-toolbar-container {
    margin-bottom: 8px !important;
    padding: 16px !important;
    background: #EDF3F7 !important;
    border-radius: 4px !important;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

/* Text toolbar in columns - wrap responsively */
.row-column .text-toolbar {
    flex-wrap: wrap !important;
    gap: 8px !important;
    height: auto !important;
    min-height: 32px;
}

/* Ensure text input appears below toolbar container */
.row-column .text-input {
    flex: 1;
    min-height: 100px;
    padding: 8px !important;
    margin-top: 0 !important;
}

/* Ensure proper stacking order in columns */
.row-column {
    position: relative;
}

/* Image placeholder in columns */
.row-column .image-placeholder {
    margin: 0 !important;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px !important;
}

/* Image with controls in columns */
.row-column img {
    flex: 0 0 auto;
}

/* Image container in columns - don't stretch for natural-fit images */
.row-column .image-container {
    align-self: flex-start;
    width: auto;
    max-width: 100%;
}

/* Full-width images in rows need container to be 100% width */
.row-column .image-container.row-full-width-container {
    width: 100% !important;
    align-self: stretch !important;
}

.row-column .image-alignment {
    margin-top: 8px !important;
    flex-wrap: wrap;
}

/* Make image controls responsive in rows */
.row-column .image-alignment button {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
}

/* Ensure images in columns are consistently sized with equal heights - 4:3 landscape ratio */
/* Default: full width fills the column */
.row-column img.row-full-width {
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
}

/* Natural fit: image displays at true natural size */
/* Only scale down if wider than column, never scale up */
.row-column img.row-natural-fit {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
}

/* Row image alignment classes - use align-self on container */
.row-column .image-container:has(img.align-left),
.row-column img.row-natural-fit.align-left {
    align-self: flex-start !important;
    margin: 0 !important;
}

.row-column .image-container:has(img.align-center),
.row-column img.row-natural-fit.align-center {
    align-self: center !important;
    margin: 0 !important;
}

.row-column .image-container:has(img.align-right),
.row-column img.row-natural-fit.align-right {
    align-self: flex-end !important;
    margin: 0 !important;
}

/* Image alignment controls in columns */
.row-column .image-alignment {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Make radius control and buttons responsive in rows */
.row-column .image-radius-control {
    flex-wrap: wrap !important;
    gap: 4px !important;
}

.row-column .image-radius-control select {
    flex: 1 1 100%;
    min-width: 100px;
    max-width: 100%;
    font-size: 11px !important;
    padding: 4px 6px !important;
}

.row-column .image-radius-control button {
    flex: 0 0 auto;
}

/* ========== SELECTION CHECKBOX FOR MERGING ========== */

.block-select-checkbox {
    position: absolute;
    top: -12px;
    left: -12px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    accent-color: #035CA7;
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: 50%;
    background: #EDF3F7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: scale(0.7);
}

.content-block:hover .block-select-checkbox {
    opacity: 1;
}

.block-select-checkbox:checked {
    opacity: 1 !important;
}

/* Multi-selected blocks (via Cmd/Ctrl+Click) */
.content-block.multi-selected,
.row-column.multi-selected,
.canvas-block.multi-selected,
.canvas-row-item.multi-selected {
    outline: 2px solid #035CA7 !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(3, 92, 167, 0.15);
}

.content-block.multi-selected .block-select-checkbox,
.row-column.multi-selected .block-select-checkbox,
.canvas-block.multi-selected .block-select-checkbox,
.canvas-row-item.multi-selected .block-select-checkbox {
    opacity: 1 !important;
}

/* ========== MERGE BUTTON CONTAINER ========== */

.merge-button-container {
    position: fixed;
    bottom: 100px;
    left: 50%;
    margin-left: calc(var(--sidebar-width) / 2);
    background: #035CA7;
    color: white;
    padding: 16px 32px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    opacity: 0;
    z-index: 1000;
    width: 280px;
    text-align: center;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.merge-button-container.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.merge-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s ease;
}

.merge-btn:hover {
    opacity: 0.9;
}

/* ========== COLLAPSED BLOCKS DURING DRAG ========== */
/* Simple approach: just dim blocks without pseudo-elements to ensure dragover works */
.content-block.collapsed-for-drag {
    opacity: 0.25 !important;
    filter: grayscale(80%) blur(1px) !important;
    transform: scale(0.98) !important;
    transition: none !important;
    pointer-events: auto !important;
    border-color: #CBD5E1 !important;
}

/* The dragging block itself stays visible with enhanced styling */
.content-block.dragging {
    opacity: 0.8 !important;
    border: 3px solid #035CA7 !important;
    box-shadow: 0 12px 24px rgba(3, 92, 167, 0.3);
    transform: scale(1.02);
    background: #F0F9FF !important;
}

/* ========== PREVIEW MODE - EDITABLE BLOCKS ========== */
[data-editable-block="true"]:hover {
    background-color: rgba(3, 92, 167, 0.05) !important;
    outline: 2px solid rgba(3, 92, 167, 0.3);
    outline-offset: 2px;
    transition: all 0.2s ease;
}

/* ========== BLOCK HIGHLIGHT ANIMATION ========== */
.block-highlight {
    animation: highlightPulse 3.5s ease-out;
}

@keyframes highlightPulse {
    0% {
        background-color: rgba(3, 92, 167, 0.15);
        box-shadow: 0 0 0 0 rgba(3, 92, 167, 0.4),
                    0 4px 20px rgba(0, 0, 0, 0.15);
    }
    50% {
        background-color: rgba(3, 92, 167, 0.1);
        box-shadow: 0 0 0 10px rgba(3, 92, 167, 0),
                    0 8px 30px rgba(0, 0, 0, 0.2);
    }
    100% {
        background-color: transparent;
        box-shadow: 0 0 0 0 rgba(3, 92, 167, 0),
                    0 0 0 rgba(0, 0, 0, 0);
    }
}

/* ============================================
   TIPS BUTTON (Inside Scrollable Area)
   ============================================ */
.help-tips-buttons {
    padding: 16px;
    background: #011C32 !important;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: auto; /* Push to bottom of flex container */
}

.help-tips-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent !important;
    color: #FFFFFF !important;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: all 0.2s ease;
}

.help-tips-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.help-tips-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 26px;
    flex-shrink: 0;
}

.help-tips-btn .btn-icon svg {
    width: 100%;
    height: 100%;
    max-width: 40px;
    max-height: 26px;
}

/* ============================================
   FLOATING HELP BUTTON (Preview Area)
   ============================================ */
.floating-help-btn {
    position: absolute;
    top: 16px;
    left: 8px;
    z-index: 1000;
    padding: 8px 12px;
    background: transparent !important;
    color: #011C32 !important;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.floating-help-btn:hover {
    opacity: 0.7;
}

.floating-help-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
}

.floating-help-btn .btn-icon svg {
    width: 14px;
    height: 14px;
}

.floating-help-btn .btn-icon svg path {
    fill: #011C32;
}

/* Tips button opacity when disabled */
.help-tips-btn.tips-disabled {
    opacity: 0.5;
}

/* ============================================
   MANAGE ASSETS BUTTON
   ============================================ */
.manage-assets-btn-container {
    position: sticky;
    bottom: 65px;
    padding: 12px;
    padding-top: 12px;
    padding-bottom: 8px;
    background: var(--color-fill-dark-blue);
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.3);
}

.manage-assets-btn-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #035CA7;
    opacity: 0.15;
}

.manage-assets-btn-container * {
    pointer-events: auto;
}

.manage-assets-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent !important;
    color: #FFFFFF !important;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    transition: all 0.2s ease;
}

.manage-assets-btn:hover {
    background: transparent !important;
    transform: translateX(4px);
}

.manage-assets-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.manage-assets-btn .btn-icon svg {
    width: 13px;
    height: 13px;
}

.manage-assets-btn .btn-icon svg path {
    fill: #FFFFFF;
}

/* ============================================
   MANAGE ASSETS OVERLAY
   ============================================ */
.manage-assets-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.manage-assets-overlay.active {
    display: flex;
}

.manage-assets-modal {
    width: 90%;
    max-width: 900px;
    height: 80vh;
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.manage-assets-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px 8px 0 0;
}

.manage-assets-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
    margin: 0;
}

.manage-assets-title .btn-icon svg path {
    fill: #011C32;
}

.manage-assets-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.manage-assets-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

/* Tabs */
.manage-assets-tabs {
    display: flex;
    gap: 0;
    background: #EDF3F7;
    border-bottom: 2px solid #D0DCE5;
}

.manage-assets-tab {
    flex: 1;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    font-weight: 600;
    color: #0A375C;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manage-assets-tab:hover {
    background: rgba(3, 92, 167, 0.05);
}

.manage-assets-tab.active {
    color: #035CA7;
    border-bottom-color: #035CA7;
    background: white;
}

/* Content Area */
.manage-assets-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.manage-assets-tab-content {
    display: none;
}

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

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

.tab-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #011C32;
    margin: 0;
}

.tab-header-actions {
    display: flex;
    gap: 12px;
}

.add-asset-btn {
    background: #035CA7;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.add-asset-btn:hover {
    background: #024A8C;
}

/* Assets List */
.assets-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.uploads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.asset-card {
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
}

.asset-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.asset-preview {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Background is set dynamically via JavaScript auto-detection */
    background: #f3f4f6; /* Fallback only */
    border-radius: 4px;
    padding: 12px;
    transition: background-color 0.2s ease;
}

.asset-preview svg {
    max-width: 100%;
    max-height: 100%;
}

.asset-name {
    font-size: 14px;
    font-weight: 500;
    color: #011C32;
    word-break: break-word;
}

.asset-actions {
    display: flex;
    gap: 8px;
}

.asset-edit-btn,
.asset-delete-btn {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.asset-edit-btn {
    background: white;
    color: #035CA7;
}

.asset-edit-btn:hover {
    background: #EDF3F7;
}

.asset-delete-btn {
    background: white;
    color: #D32F2F;
}

.asset-delete-btn:hover {
    background: #FFEBEE;
}

/* Colors Section */
.colors-categories {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.color-category {
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    padding: 16px;
}

.color-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.color-category-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: #011C32;
    margin: 0;
}

.add-color-btn {
    padding: 6px 12px;
    background: #035CA7;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-color-btn:hover {
    background: #0474C8;
}

.colors-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.color-card {
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.color-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    border: 1px solid #E0E0E0;
    flex-shrink: 0;
}

.color-info {
    flex: 1;
    min-width: 0;
}

.color-name {
    font-size: 13px;
    font-weight: 500;
    color: #011C32;
    margin-bottom: 4px;
}

.color-value {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

.color-actions {
    display: flex;
    gap: 4px;
}

.color-edit-btn,
.color-delete-btn {
    padding: 4px 8px;
    border: none;
    background: none;
    font-size: 11px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.color-edit-btn {
    color: #035CA7;
}

.color-edit-btn:hover {
    background: #EDF3F7;
}

.color-delete-btn {
    color: #D32F2F;
}

.color-delete-btn:hover {
    background: #FFEBEE;
}

/* Footer */
.manage-assets-footer {
    padding: 16px;
    border-top: 1px solid #E0E0E0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.footer-spacer {
    flex: 1;
}

.manage-assets-export-btn,
.manage-assets-import-btn {
    padding: 10px 16px;
    background: white;
    color: #035CA7;
    border: 1px solid #035CA7;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manage-assets-export-btn:hover,
.manage-assets-import-btn:hover {
    background: #EDF3F7;
}

.manage-assets-cancel-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.manage-assets-cancel-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* ============================================
   SVG MODAL
   ============================================ */
.svg-modal-overlay,
.color-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.svg-modal-overlay.active,
.color-modal-overlay.active {
    display: flex;
}

.svg-modal,
.color-modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.svg-modal-header,
.color-modal-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px 8px 0 0;
}

.svg-modal-header h3,
.color-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
    margin: 0;
}

.svg-modal-close-btn,
.color-modal-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.svg-modal-close-btn:hover,
.color-modal-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.svg-modal-body,
.color-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #011C32;
    margin-bottom: 8px;
}

.form-group input[type="text"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #035CA7;
}

.form-group textarea {
    resize: vertical;
    font-family: monospace;
    font-size: 12px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

.svg-preview {
    min-height: 120px;
    /* Background is set dynamically via JavaScript auto-detection */
    background: #f3f4f6; /* Fallback only */
    border: 1px dashed #D0DCE5;
    border-radius: 4px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.svg-preview svg {
    max-width: 100%;
    max-height: 100px;
}

.svg-preview-placeholder {
    color: #999;
    font-size: 14px;
}

.color-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 60px;
    height: 42px;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    cursor: pointer;
}

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

.color-preview-large {
    width: 100%;
    height: 80px;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.color-preview-large:hover {
    border-color: #035CA7;
}

.svg-modal-footer,
.color-modal-footer {
    padding: 16px;
    border-top: 1px solid #E0E0E0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.svg-modal-cancel-btn,
.color-modal-cancel-btn {
    padding: 8px 16px;
    background: white;
    color: #666;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.svg-modal-cancel-btn:hover,
.color-modal-cancel-btn:hover {
    background: #F8F9FA;
}

.svg-modal-save-btn,
.color-modal-save-btn {
    padding: 8px 16px;
    background: #035CA7;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.svg-modal-save-btn:hover,
.color-modal-save-btn:hover {
    background: #0474C8;
}

/* ========== AI SETTINGS & MODALS ========== */

/* AI Settings Tab */
.ai-settings-container {
    padding: 20px;
}

.ai-settings-intro {
    margin-bottom: 24px;
    padding: 16px;
    background: #F8F9FA;
    border-radius: 4px;
    border-left: 3px solid #035CA7;
}

.ai-settings-intro p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

.ai-settings-intro p:last-child {
    margin-bottom: 0;
}

.ai-warning {
    color: #D97706 !important;
    font-weight: 500;
}

.ai-provider-list {
    margin-bottom: 20px;
}

.ai-provider-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    margin-bottom: 12px;
}

.ai-provider-info {
    flex: 1;
}

.ai-provider-name {
    font-weight: 600;
    font-size: 14px;
    color: #011C32;
    margin-bottom: 4px;
}

.ai-provider-type {
    font-size: 12px;
    color: #666;
}

.ai-provider-default {
    display: inline-block;
    background: #D1FAE5;
    color: #065F46;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 8px;
}

.ai-provider-actions {
    display: flex;
    gap: 8px;
}

.ai-provider-edit-btn,
.ai-provider-delete-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-provider-edit-btn:hover {
    background: #F8F9FA;
}

.ai-provider-delete-btn:hover {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #DC2626;
}

.add-ai-provider-btn {
    width: 100%;
    padding: 12px;
    background: #035CA7;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-ai-provider-btn:hover {
    background: #0474C8;
}

/* AI Provider Modal */
.ai-provider-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.ai-provider-modal-overlay.active {
    display: flex;
}

.ai-provider-modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.ai-provider-modal-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px 8px 0 0;
}

.ai-provider-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
}

.ai-provider-modal-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.ai-provider-modal-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.ai-provider-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.ai-provider-modal-footer {
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.ai-provider-modal-cancel-btn {
    padding: 8px 16px;
    background: white;
    color: #666;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-provider-modal-cancel-btn:hover {
    background: #F8F9FA;
}

.ai-provider-modal-test-btn {
    padding: 8px 16px;
    background: #F59E0B;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-provider-modal-test-btn:hover {
    background: #D97706;
}

.ai-provider-modal-save-btn {
    padding: 8px 16px;
    background: #035CA7;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-provider-modal-save-btn:hover {
    background: #0474C8;
}

/* ========== SAMPLE TEMPLATE STYLES ========== */
/* Template/Ghost Blocks */
.content-block.template-block {
    position: relative;
    opacity: 0.85;
    animation: templatePulse 3s ease-in-out infinite;
}

@keyframes templatePulse {
    0%, 100% {
        opacity: 0.85;
    }
    50% {
        opacity: 0.95;
    }
}

.content-block.template-block::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed rgba(3, 92, 167, 0.3);
    border-radius: 8px;
    pointer-events: none;
    z-index: 1;
}

/* Banner on first template block only */
.header-section .content-block.template-block:first-child::before,
.content-area .content-block.template-block:first-child::before {
    content: '✨ Sample Template - Click any "Add" button in the sidebar to start building!';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #035CA7 0%, #0A375C 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(3, 92, 167, 0.3);
    animation: templateBannerFloat 2s ease-in-out infinite;
}

@keyframes templateBannerFloat {
    0%, 100% {
        transform: translateX(-50%) translateY(0px);
    }
    50% {
        transform: translateX(-50%) translateY(-3px);
    }
}

/* Hide interactive controls on template blocks */
.template-block .delete-btn,
.template-block .block-select-checkbox,
.template-block .drag-handle,
.template-block .image-replace-btn,
.template-block .image-fullwidth-btn,
.template-block .image-link-btn,
.template-block .block-spacing-control {
    display: none !important;
    pointer-events: none !important;
}

/* Make template content slightly muted */
.template-block .text-input,
.template-block img {
    opacity: 0.9;
}

/* Add subtle gradient overlay to template rows */
.content-block.template-block.row-type::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(3, 92, 167, 0.03) 0%, rgba(10, 55, 92, 0.05) 100%);
    border-radius: 8px;
    pointer-events: none;
    z-index: 0;
}

/* Ensure row content is above the overlay */
.content-block.template-block.row-type > * {
    position: relative;
    z-index: 1;
}

/* AI Text Assistant Modal */
.ai-assistant-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.ai-assistant-modal-overlay.active {
    display: flex;
}

.ai-assistant-modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ai-assistant-modal-header {
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    border-radius: 8px 8px 0 0;
}

.ai-assistant-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    color: white;
}

.ai-assistant-modal-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ai-assistant-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ai-assistant-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.ai-assistant-modal-body textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.ai-assistant-modal-body textarea:focus {
    outline: none;
    border-color: #035CA7;
    box-shadow: 0 0 0 3px rgba(3, 92, 167, 0.1);
}

.ai-controls-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.ai-controls-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.ai-generate-btn {
    padding: 10px 24px;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    background: #F8F9FA;
    border-radius: 4px;
    margin-bottom: 20px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid #E5E7EB;
    border-top-color: #667EEA;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-assistant-modal-footer {
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.ai-assistant-modal-retry-btn {
    padding: 8px 16px;
    background: white;
    color: #666;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-assistant-modal-retry-btn:hover {
    background: #F8F9FA;
}

.ai-assistant-modal-cancel-btn {
    padding: 8px 16px;
    background: white;
    color: #666;
    border: 1px solid #D0DCE5;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-assistant-modal-cancel-btn:hover {
    background: #F8F9FA;
}

.ai-assistant-modal-use-btn {
    padding: 8px 16px;
    background: #10B981;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-assistant-modal-use-btn:hover {
    background: #059669;
}

.input-help {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #666;
}

/* ============================================
   MOBILE RESPONSIVE STYLES (< 744px)
   ============================================ */

/* Mobile header - hidden by default, shown on mobile */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: #0A375C;
    z-index: 998;
    padding: 0 20px;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mobile-header-logo {
    display: flex;
    align-items: center;
}

.mobile-header-logo svg {
    height: 24px;
    width: auto;
}

/* Burger menu button in mobile header */
.mobile-burger-btn {
    display: flex;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-burger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-burger-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #FFFFFF;
    transition: all 0.3s ease;
}

/* Burger button active state (X icon) */
.mobile-burger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-burger-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-burger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile sidebar overlay (full screen) */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #0A375C;
    z-index: 2000;
    overflow-y: scroll;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.mobile-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Close button in overlay */
.mobile-overlay-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #FFFFFF;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.mobile-overlay-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.mobile-sidebar-content {
    width: 100%;
    min-height: calc(100vh + 200px);
    padding: 80px 24px 150px 24px;
    box-sizing: border-box;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mobile-sidebar-content > * {
    max-width: 170px;
    width: 100%;
}

/* Mobile menu sections - always expanded */
.mobile-sidebar-content > .sidebar-content {
    background: transparent !important;
    width: 100% !important;
    position: static !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
    flex: none !important;
}

.mobile-sidebar-content .sidebar-logo {
    display: none;
}

.mobile-sidebar-content .sidebar-divider {
    display: block !important;
    background: rgba(255, 255, 255, 0.2) !important;
    height: 1px !important;
    margin: 24px 0 !important;
    border: none !important;
}

    .mobile-sidebar-content .help-tips-buttons {
        padding: 0 !important;
        background: transparent !important;
        display: flex;
        align-items: center;
        justify-content: flex-start;
    }

    .mobile-sidebar-content .help-tips-btn {
        width: 100%;
        padding: 12px 16px 12px 0 !important;
        background: transparent !important;
        color: #FFFFFF !important;
        border: none !important;
        border-radius: 4px;
        font-size: 14px;
        font-weight: 400;
        cursor: pointer;
        display: flex !important;
        align-items: normal;
        justify-content: flex-start !important;
        gap: 12px;
        transition: all 0.2s ease;
        margin: 0 !important;
    }

    .mobile-sidebar-content .help-tips-btn:hover {
        background: rgba(255, 255, 255, 0.05) !important;
    }
    
    .mobile-sidebar-content .help-tips-btn .btn-icon {
        display: flex !important;
        margin-left: auto;
    }

.mobile-sidebar-content .manage-assets-btn-container {
    position: static !important;
    display: block !important;
    margin-top: 24px;
    padding-left: 0 !important;
    background: transparent !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.mobile-sidebar-content .sidebar-section {
    margin-bottom: 32px;
    background: transparent !important;
}

.mobile-sidebar-content .section-header {
    background: transparent !important;
    padding: 12px 0;
    cursor: default;
    border-bottom: none !important;
    display: flex;
    justify-content: flex-start !important;
}

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

.mobile-sidebar-content .section-toggle {
    display: none !important;
}

.mobile-sidebar-content .section-content {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
    padding-top: 16px;
    padding-left: 0 !important;
    background: transparent !important;
}

.mobile-sidebar-content .subsection {
    background: transparent !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 0 !important;
}

.mobile-sidebar-content .section-title {
    font-size: 18px;
    font-weight: 600;
    color: #FFFFFF;
    text-align: left;
}

.mobile-sidebar-content .section-icon svg path {
    fill: #FFFFFF;
}

.mobile-sidebar-content .action-btn {
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    justify-content: flex-start !important;
    padding-left: 0 !important;
}

.mobile-sidebar-content .action-btn:hover {
    background: transparent !important;
}

.mobile-sidebar-content .action-btn span {
    color: #FFFFFF !important;
}

.mobile-sidebar-content .btn-icon svg path {
    fill: #FFFFFF;
}

.mobile-sidebar-content .color-label {
    color: #FFFFFF !important;
}

.mobile-sidebar-content .color-picker-row {
    background: transparent !important;
    justify-content: flex-start !important;
    padding-left: 0 !important;
}

.mobile-sidebar-content .color-preview {
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

.mobile-sidebar-content .manage-assets-btn {
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    justify-content: flex-start !important;
    padding-left: 0 !important;
}

.mobile-sidebar-content .manage-assets-btn:hover {
    background: transparent !important;
    transform: translateX(4px);
}

/* Mobile responsive styles */
@media (max-width: 744px) {
    /* Show mobile header */
    .mobile-header {
        display: flex;
    }
    
    /* Hide desktop sidebar */
    .sidebar {
        display: none;
    }
    
    /* Make preview container full width on mobile */
    .preview-container {
        width: 100%;
        margin-left: 0;
        padding-top: 64px;
    }
    
    /* Center help button on mobile */
    .floating-help-btn {
        left: 50%;
        transform: translateX(-50%);
    }
    
    /* Adjust app container for mobile */
    .app-container {
        flex-direction: column;
    }
    
    /* Make export buttons stack vertically on mobile */
    .preview-bottom-bar {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }
    
    .preview-action {
        width: 100%;
        justify-content: center;
    }
    
    .export-buttons {
        width: 100%;
        justify-content: center;
    }
    
    /* Adjust modals for mobile */
    .media-library-modal,
    .preview-modal,
    .manage-assets-modal {
        width: 95%;
        max-width: 95%;
        margin: 8px;
    }
    
    /* Adjust preview modal footer on mobile */
    .preview-modal-footer {
        flex-direction: column;
        gap: 8px;
        height: auto;
        padding: 16px !important;
    }
    
    .preview-export-buttons {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .preview-close-footer-btn {
        width: 100%;
    }
    
    /* Make merge button more visible on mobile */
    .merge-button-container {
        bottom: 100px;
        left: 50%;
        margin-left: 0;
        transform: translateX(-50%);
    }
    
    .merge-button-container.visible {
        transform: translateX(-50%) translateY(0);
    }
    
    /* Make block action buttons always visible on mobile */
    .block-select-checkbox,
    .delete-btn,
    .drag-handle,
    .image-replace-btn,
    .image-fullwidth-btn,
    .image-link-btn,
    .block-spacing-control {
        opacity: 1 !important;
        display: flex !important;
        z-index: 1000 !important;
        pointer-events: auto !important;
        position: absolute !important;
    }
    
    .block-select-checkbox {
        top: -16px !important;
        left: -16px !important;
    }
    
    .delete-btn {
        top: -16px !important;
        right: -16px !important;
    }
    
    .drag-handle {
        top: -16px !important;
    }
    
    .content-block {
        position: relative !important;
        overflow: visible !important;
    }
    
    /* Ensure buttons are visible and clickable */
    .content-block:hover .block-select-checkbox,
    .content-block:hover .delete-btn,
    .content-block:hover .drag-handle,
    .image-container:hover .image-replace-btn,
    .image-container:hover .image-fullwidth-btn,
    .image-container:hover .image-link-btn {
        opacity: 1 !important;
    }
    
    /* Position link button for mobile */
    .image-link-btn {
        top: -16px !important;
        left: 40px !important;
    }
    
    /* Make newsletter blocks responsive on mobile */
    .content-block {
        max-width: 100%;
        overflow: hidden;
    }
    
    /* But allow overflow for full-width images on mobile too */
    .content-block.full-width-image {
        overflow: visible !important;
    }
    
    /* Text block responsiveness */
    .text-toolbar-container {
        display: flex !important;
        flex-direction: column !important;
        background: #EDF3F7 !important;
        border-radius: 4px !important;
        padding: 8px !important;
        margin-bottom: 8px !important;
        width: 100% !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }
    
    .text-toolbar {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        background: transparent !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    .text-toolbar select,
    .text-toolbar button {
        font-size: 11px !important;
        padding: 4px 6px !important;
        min-width: auto !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1.2 !important;
    }
    
    .text-toolbar select {
        height: 28px !important;
    }
    
    .text-color-picker-wrapper {
        width: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .text-align-group {
        margin-top: 0 !important;
    }
    
    .text-input {
        background: #FFFFFF !important;
        border: 1px solid #D1D5DB !important;
        border-radius: 4px !important;
        width: 100% !important;
        margin-top: 0 !important;
        clear: both !important;
        display: block !important;
        box-sizing: border-box !important;
    }
    
    .content-block .text-block {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Image block responsiveness */
    .image-controls-container {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .image-alignment {
        flex-wrap: wrap !important;
    }
    
    /* Divider controls responsiveness */
    .divider-controls-toolbar {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .divider-control-group {
        flex-wrap: wrap !important;
    }
    
    /* Row blocks on mobile */
    .row-columns {
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    .row-column {
        width: 100% !important;
        flex: none !important;
    }
    
    /* Newsletter preview content on mobile */
    .newsletter-content {
        max-width: 100%;
        padding: 8px;
        overflow-x: hidden;
    }
    
    .header-section,
    .content-area,
    .footer-section {
        padding: 8px;
        overflow-x: hidden;
    }
    
    /* Fix full-width images on mobile */
    .content-block img[style*="calc(100% + 72px)"] {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Ensure images don't overflow */
    .content-block img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Fix preview mode overflow */
    .preview-newsletter-content {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .preview-modal-body {
        padding: 8px !important;
        overflow-x: hidden !important;
    }
    
    /* Override full-width image styles in preview */
    .preview-newsletter-content img {
        max-width: 100% !important;
        width: auto !important;
    }
    
    .preview-newsletter-content img[style*="calc"] {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ========== IMAGE OPTIMIZATION MODAL ========== */
.optimization-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(1, 28, 50, 0.7);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.optimization-overlay.active {
    display: flex;
}

.optimization-modal {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.optimization-modal-header {
    background: #EDF3F7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px 8px 0 0;
}

.optimization-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #011C32;
}

.optimization-modal-header h3 .btn-icon svg path {
    fill: #011C32;
}

.optimization-close-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #011C32;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.optimization-close-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.optimization-modal-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.optimization-file-info {
    margin-bottom: 24px;
}

.optimization-file-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
    word-break: break-word;
}

.optimization-file-size {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.size-label {
    color: #6B7280;
}

.size-value {
    color: #111827;
    font-weight: 600;
}

.optimization-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
}

.optimization-progress .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #E5E7EB;
    border-top-color: #035CA7;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.optimization-progress span {
    color: #6B7280;
    font-size: 14px;
}

.optimization-results {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.optimization-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.optimization-stat {
    background: #F9FAFB;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 8px;
    display: block;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.stat-value.success {
    color: #10b981;
}

.optimization-dimensions {
    padding: 12px 16px;
    background: #F0F9FF;
    border-radius: 8px;
    border-left: 3px solid #035CA7;
    font-size: 14px;
}

.dimensions-label {
    color: #6B7280;
    margin-right: 8px;
}

.dimensions-value {
    color: #0A375C;
    font-weight: 600;
}

.optimization-message {
    padding: 12px 16px;
    background: #F0FDF4;
    border-radius: 8px;
    border-left: 3px solid #10b981;
    color: #065F46;
    font-size: 14px;
}

.optimization-width-control {
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
    margin-bottom: 16px;
}

.optimization-width-control label {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.width-selector {
    display: flex;
    gap: 12px;
}

.width-option {
    flex: 1;
    padding: 12px 16px;
    background: white;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.width-option:hover {
    border-color: #035CA7;
    background: #F0F9FF;
}

.width-option.active {
    background: #035CA7;
    border-color: #035CA7;
    color: white;
}

.width-option .width-hint {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
}

.optimization-quality-control {
    padding: 16px;
    background: #F9FAFB;
    border-radius: 8px;
}

.optimization-quality-control label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

#optimizationQualityValue {
    color: #035CA7;
    font-weight: 700;
}

#optimizationQualitySlider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #E5E7EB;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-bottom: 8px;
}

#optimizationQualitySlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #035CA7;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#optimizationQualitySlider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #035CA7;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#optimizationQualitySlider:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quality-hint {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #9CA3AF;
}

.optimization-modal-footer {
    padding: 16px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.optimization-cancel-btn,
.optimization-use-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.optimization-cancel-btn {
    background: #F3F4F6;
    color: #374151;
}

.optimization-cancel-btn:hover {
    background: #E5E7EB;
}

.optimization-use-btn {
    background: #035CA7;
    color: white;
}

.optimization-use-btn:hover {
    background: #024A8A;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 744px) {
    .optimization-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .optimization-modal-header {
        padding: 8px;
    }
    
    .optimization-modal-body {
        padding: 16px;
    }
    
    .optimization-comparison {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   EML EXPORT CONFIGURATION MODAL
   ============================================ */

.eml-config-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.eml-config-overlay.active {
    display: flex;
}

.eml-config-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

.eml-config-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #E5E5E5;
}

.eml-config-modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #073965;
}

.eml-config-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.eml-config-close-btn:hover {
    background: #F5F5F5;
    color: #333;
}

.eml-config-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.eml-config-section {
    margin-bottom: 20px;
}

.eml-config-section label {
    display: block;
    font-weight: 600;
    color: #073965;
    margin-bottom: 8px;
    font-size: 14px;
}

.field-hint {
    font-weight: 400;
    color: #999;
    font-size: 12px;
    margin-left: 8px;
}

.eml-config-section input[type="text"],
.eml-config-section input[type="email"],
.eml-config-section textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #E5E5E5;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.eml-config-section input:focus,
.eml-config-section textarea:focus {
    outline: none;
    border-color: #073965;
}

.eml-config-section textarea {
    resize: vertical;
    min-height: 60px;
}

.eml-config-actions {
    display: flex;
    gap: 12px;
    margin: 24px 0 16px 0;
    padding-top: 16px;
    border-top: 1px solid #E5E5E5;
}

.eml-secondary-btn {
    flex: 1;
    padding: 10px 16px;
    background: #F5F5F5;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #073965;
    cursor: pointer;
    transition: all 0.2s;
}

.eml-secondary-btn:hover {
    background: #E5E5E5;
    border-color: #D0D0D0;
}

.eml-config-info {
    background: #F0F9FF;
    border-left: 4px solid #0EA5E9;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 13px;
    color: #0369A1;
    margin-top: 16px;
}

.eml-draft-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.eml-draft-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #035CA7;
}

.eml-config-hint {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 4px;
    line-height: 1.4;
}

.eml-config-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid #E5E5E5;
    background: #FAFAFA;
    border-radius: 0 0 12px 12px;
}

.eml-cancel-btn,
.eml-download-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.eml-cancel-btn {
    background: white;
    color: #666;
    border: 2px solid #E5E5E5;
}

.eml-cancel-btn:hover {
    background: #F5F5F5;
    border-color: #D0D0D0;
}

.eml-download-btn {
    background: #073965;
    color: white;
}

.eml-download-btn:hover {
    background: #052747;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(7, 57, 101, 0.3);
}

.eml-download-emlx {
    background: #1d1d1f;
}

.eml-download-emlx:hover {
    background: #333336;
    box-shadow: 0 4px 12px rgba(29, 29, 31, 0.3);
}

.eml-send-now-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.eml-send-now-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.eml-send-now-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.eml-send-status {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin-top: 12px;
}

.eml-send-status.info {
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #1E40AF;
}

.eml-send-status.success {
    background: #F0FDF4;
    border: 1px solid #BBF7D0;
    color: #166534;
}

.eml-send-status.error {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}

/* Autocomplete Wrapper */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #073965;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.autocomplete-dropdown.active {
    display: block;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #F5F5F5;
    transition: background 0.2s;
}

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

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #F0F9FF;
}

.autocomplete-item-name {
    font-weight: 600;
    color: #073965;
    font-size: 14px;
}

.autocomplete-item-email {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.autocomplete-item-group {
    display: inline-block;
    font-size: 11px;
    color: #999;
    background: #F5F5F5;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 4px;
}

.autocomplete-no-results {
    padding: 12px;
    text-align: center;
    color: #999;
    font-size: 13px;
}

/* Mobile Responsive */
@media (max-width: 744px) {
    .eml-config-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .eml-config-modal-header {
        padding: 8px;
    }
    
    .eml-config-modal-body,
    .eml-config-modal-footer {
        padding: 16px;
    }
    
    .eml-config-actions {
        flex-direction: column;
    }
    
    .eml-config-modal-footer {
        flex-direction: column;
    }
    
    .eml-cancel-btn,
    .eml-download-btn,
    .eml-send-now-btn {
        width: 100%;
    }
    
    .autocomplete-dropdown {
        max-height: 150px;
    }
}

/* ========== WELCOME/HELP MODAL ========== */
.welcome-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow-y: auto;
}

.welcome-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.welcome-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
}

.welcome-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.welcome-modal-title-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.welcome-modal-title-text .btn-icon svg path {
    fill: #011C32;
}

.welcome-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.welcome-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.welcome-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.welcome-title {
    font-size: 24px;
    font-weight: 600;
    color: #011C32;
    margin: 0 0 10px 0;
    text-align: center;
}

.welcome-subtitle {
    font-size: 16px;
    color: #6B7280;
    text-align: center;
    margin: 0 0 40px 0;
}

.welcome-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #F3F4F6;
}

.welcome-section:last-of-type {
    border-bottom: none;
    margin-bottom: 20px;
}

.welcome-section h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 20px 0;
    letter-spacing: 0.5px;
}

.welcome-item {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.welcome-item:last-child {
    margin-bottom: 0;
}

.welcome-icon {
    font-size: 32px;
    flex-shrink: 0;
    line-height: 1;
    width: 32px;
    text-align: center;
}

/* Smaller size for multi-symbol icons like undo/redo */
.welcome-icon.small {
    font-size: 20px;
}

.welcome-text {
    flex: 1;
}

.welcome-text strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 6px;
}

.welcome-text p {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.6;
    margin: 0;
}

.welcome-steps {
    margin: 16px 0;
    padding-left: 20px;
}

.welcome-steps li {
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
    line-height: 1.6;
}

.welcome-perfect-for {
    margin: 16px 0 8px 0;
    font-size: 14px;
    color: #1F2937;
}

.welcome-list {
    margin: 8px 0;
    padding-left: 20px;
}

.welcome-list li {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 6px;
}

.welcome-intro {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 20px 0;
}

.welcome-size-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.welcome-size-card {
    background: linear-gradient(135deg, #035CA7 0%, #024A8A 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
}

.welcome-size-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.welcome-size-card strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-size {
    display: block;
    font-size: 13px;
    opacity: 0.9;
}

.welcome-tip {
    background: #FEF3C7;
    border-left: 4px solid #F59E0B;
    padding: 16px;
    border-radius: 6px;
    font-size: 14px;
    color: #92400E;
    margin: 0;
}

.welcome-structure {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.welcome-structure-item {
    background: #F9FAFB;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid #D1D5DB;
}

.welcome-structure-item.highlight {
    background: #EFF6FF;
    border-left-color: #035CA7;
}

.welcome-structure-label {
    display: block;
    font-weight: 600;
    font-size: 15px;
    color: #1F2937;
    margin-bottom: 6px;
}

.welcome-structure-desc {
    display: block;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.6;
}

.welcome-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.welcome-tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.welcome-tip-item {
    background: #F3F4F6;
    padding: 16px;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    line-height: 1.5;
}

.welcome-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.welcome-action-item {
    background: #F9FAFB;
    padding: 16px;
    border-radius: 8px;
    border: 2px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.welcome-action-item strong {
    font-size: 14px;
    color: #1F2937;
}

.welcome-action-item span {
    font-size: 13px;
    color: #6B7280;
}

.welcome-footer-text {
    text-align: center;
    margin-top: 30px;
}

.welcome-footer-text p {
    font-size: 18px;
    font-weight: 600;
    color: #035CA7;
    margin: 0;
}

.welcome-modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.welcome-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
}

.welcome-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.welcome-start-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.welcome-start-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* ========== CONTEXTUAL TIPS CONTAINER ========== */
.contextual-tips-container {
    position: fixed;
    bottom: 80px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 99999;
    max-width: 400px;
}

.contextual-tip {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 16px;
    border-left: 4px solid #F59E0B;
    animation: slideInRight 0.3s ease;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease, border-left-color 0.2s ease;
    user-select: none;
}

.contextual-tip:hover {
    transform: translateX(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.contextual-tips-container:hover .contextual-tip {
    border-left-color: #3B82F6;
}

.contextual-tip.removing {
    opacity: 0;
    transform: translateX(30px);
}

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

.tip-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.tip-text {
    flex: 1;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
    user-select: text;
    cursor: text;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.tip-close {
    width: 24px;
    height: 24px;
    border: none;
    background: #F3F4F6;
    color: #6B7280;
    font-size: 18px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.tip-close:hover {
    background: #E5E7EB;
    color: #374151;
}

/* Mobile responsive styles for welcome modal */
@media (max-width: 744px) {
    .welcome-modal-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .welcome-modal-body {
        padding: 30px 20px;
        max-height: calc(100vh - 100px);
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .welcome-modal-footer {
        padding: 16px 20px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .welcome-checkbox-label {
        order: 2;
    }
    
    .welcome-start-btn {
        width: 100%;
        order: 1;
    }
    
    .welcome-size-grid,
    .welcome-tips-grid,
    .welcome-actions-grid {
        grid-template-columns: 1fr;
    }
    
    .contextual-tips-container {
        right: 20px;
        left: 20px;
        max-width: none;
        bottom: 70px;
    }
}

/* ========== PREVIEW EMPTY STATE ========== */
.content-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    min-height: 200px;
    text-align: center;
}

.content-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.content-empty-text {
    font-size: 16px;
    font-weight: 500;
    color: #666;
    max-width: 300px;
}


/* Mobile responsive for empty state */
@media (max-width: 744px) {
    .content-empty-state {
        padding: 40px 20px;
    }
    
    .content-empty-icon {
        font-size: 40px;
    }
    
    .content-empty-text {
        font-size: 14px;
    }
}

/* ========== NEW UI REORGANIZATION ========== */

/* Account Section in Sidebar */
.account-section-container {
    padding: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
    pointer-events: none;
}

.account-section-container * {
    pointer-events: auto;
}

.account-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-btn:hover {
    background: transparent;
    transform: translateX(4px);
}

.account-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #035CA7;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.account-name {
    font-size: 14px;
    font-weight: 500;
    text-align: left;
}

/* Account Dropdown */
.account-dropdown {
    position: absolute;
    bottom: 100%;
    left: 12px;
    right: 12px;
    margin-bottom: 8px;
    background: #0A375C;
    border: 1px solid rgba(148, 181, 209, 0.5);
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 10000;
}

.account-dropdown.active {
    display: flex;
}

.account-dropdown-item {
    padding: 12px 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.account-dropdown-item:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.account-dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.account-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.account-dropdown-item.danger {
    color: #ff4444;
}

.account-dropdown-item.danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* Projects List */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 0px;
    overflow: visible;
}

.empty-projects-message {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.project-item {
    padding: 8px 24px;
    padding-left: 24px;
    padding-right: 24px;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.project-item:has(.project-menu.active) {
    z-index: 10001;
}

.project-item:hover {
    background: transparent;
    transform: translateX(4px);
}

.project-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid #3B82F6;
    padding-left: 21px; /* Compensate for border */
}

.project-item.active .project-name {
    color: #3B82F6;
    font-weight: 600;
}

.project-item.active:hover {
    background: rgba(59, 130, 246, 0.2);
    transform: none;
}

.project-avatar {
    width: 16px;
    height: 16px;
    background: transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 2px;
}

.project-info {
    flex: 1;
    min-width: 0;
    margin-right: 36px;
}

.project-name {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.project-date {
    font-size: 12px;
    color: #5d7383 !important;
    margin-top: 4px;
}

.project-menu-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: absolute;
    right: 24px;
    top: 8px;
}

.project-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.project-menu {
    position: absolute;
    right: 16px;
    top: 100%;
    margin-top: 4px;
    background: #0A375C;
    border: 1px solid rgba(148, 181, 209, 0.5);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    min-width: 150px;
    display: none;
}

.project-menu.active {
    display: block;
}

/* Open menu upward when not enough space below */
.project-menu.open-upward {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.project-menu-item {
    padding: 10px 16px;
    font-size: 13px;
    color: #FFFFFF;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.project-menu-icon svg {
    width: 100%;
    height: 100%;
}

.project-menu-icon svg path {
    fill: #FFFFFF;
}

.project-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.project-menu-item.danger {
    color: #ff4444;
}

.project-menu-item.danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* Updated Top Bar */
.preview-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    color: #011C32;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: rgba(1, 28, 50, 0.05);
}

.export-btn .btn-icon svg path {
    fill: #011C32;
}

/* Updated Bottom Bar */
.preview-bottom-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px 24px;
    background: #011627;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: visible;
    align-items: center;
    position: fixed;
    bottom: 16px;
    /* Center between left sidebar (280px) and right properties panel (320px) */
    left: calc(50% + (var(--sidebar-width) - 320px) / 2);
    transform: translateX(-50%);
    z-index: 50;
    width: fit-content;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.bottom-bar-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bottom-bar-section.unified-section {
    gap: 16px;
    justify-content: center;
}

.bottom-bar-section.actions-section {
    gap: 8px;
    justify-content: center;
}

.bottom-bar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    white-space: nowrap;
}

.bottom-colors-grid {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Colors Selector (Dropdown) */
.colors-selector {
    position: relative;
    min-width: 180px;
    z-index: 1000;
}

.colors-selector-selected {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    color: #FFFFFF;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.colors-selector-selected:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.colors-selector.open .colors-selector-selected {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #FAD701;
}

.colors-selector-icon {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.colors-selector-icon svg {
    width: 14px;
    height: 14px;
}

.colors-selector-label {
    flex: 1;
}

.color-preview-inline {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-preview-inline:hover {
    transform: scale(1.1);
}

.colors-selector-arrow {
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.colors-selector.open .colors-selector-arrow {
    transform: rotate(180deg);
}

.colors-selector-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin-bottom: 4px;
    z-index: 2000;
    overflow: hidden;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.colors-selector.open .colors-selector-dropdown {
    display: block;
}

.colors-selector-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #FFFFFF;
    cursor: pointer;
    transition: background 0.2s ease;
}

.colors-selector-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.colors-selector-option.active {
    background: rgba(250, 215, 1, 0.2);
    font-weight: 600;
}

/* Color Quick Selector */
.color-preview-quick {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.color-preview-quick:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Section Padding Button */
.section-padding-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.section-padding-btn:hover {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

.section-padding-btn svg {
    width: 16px;
    height: 16px;
}

/* Section Padding Popup */
.section-padding-popup {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #0A375C;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    width: 280px;
    z-index: 10000;
    display: none;
    border: 1px solid rgba(148, 181, 209, 0.3);
}

.section-padding-popup.active {
    display: block;
    animation: fadeInUp 0.2s ease;
}

.section-padding-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(148, 181, 209, 0.2);
}

.section-padding-title {
    font-size: 14px;
    font-weight: 600;
    color: #FFFFFF;
}

.section-padding-close {
    background: none;
    border: none;
    color: #94B5D1;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.section-padding-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

.section-padding-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.padding-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.padding-control label {
    font-size: 12px;
    font-weight: 600;
    color: #94B5D1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.padding-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.padding-input-group input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: rgba(148, 181, 209, 0.3);
    border-radius: 3px;
    outline: none;
}

.padding-input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #FAD701;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.padding-input-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.padding-input-group input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #FAD701;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.padding-value {
    min-width: 40px;
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    text-align: right;
}

/* Disabled button state */
.bottom-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.bottom-colors-grid .color-picker-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bottom-colors-grid .color-picker-row:hover {
    background: transparent;
}

.bottom-colors-grid .color-preview {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.bottom-colors-grid .color-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

.bottom-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.bottom-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.bottom-action-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Export Modal */
.export-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.export-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.export-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.export-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.export-modal-title .btn-icon svg path {
    fill: #011C32;
}

.export-modal-close-btn {
    background: transparent;
    border: none;
    color: rgba(0, 0, 0, 0.5);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.export-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.export-modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-option-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #F8F9FA;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    color: #011C32;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.export-option-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateX(4px);
}

.export-option-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.export-option-btn .btn-icon svg path {
    fill: #011C32;
}

.export-option-content {
    flex: 1;
}

.export-option-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.export-option-description {
    font-size: 13px;
    color: #6C757D;
}

/* Account Modal */
/* Profile Settings Modal */
.profile-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.profile-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.profile-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.profile-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.profile-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.profile-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.profile-modal-body {
    padding: 24px;
}

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

.profile-form-group:last-child {
    margin-bottom: 0;
}

.profile-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.profile-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 15px;
    color: #011C32;
    outline: none;
    transition: all 0.2s ease;
}

.profile-input:focus {
    border-color: #011C32;
    box-shadow: 0 0 0 3px rgba(1, 28, 50, 0.1);
}

.profile-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.profile-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
}

.profile-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

.profile-save-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-save-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* Preferences Modal */
.preferences-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.preferences-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.preferences-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.preferences-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.preferences-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.preferences-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.preferences-modal-body {
    padding: 24px;
}

.preference-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    margin-bottom: 12px;
}

.preference-item:last-child {
    margin-bottom: 0;
}

.preference-info {
    flex: 1;
}

.preference-label {
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
    margin-bottom: 4px;
}

.preference-description {
    font-size: 13px;
    color: #666;
}

.preference-toggle-icon {
    width: 60px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.preference-toggle-icon:hover {
    transform: scale(1.05);
}

.preference-toggle-icon:active {
    transform: scale(0.95);
}

.preference-toggle-icon svg {
    display: block;
}

.preferences-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.preferences-close-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preferences-close-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* Delete Project Modal */
.delete-project-modal-overlay,
/* ========== NOTIFICATION MODAL (replaces browser alert) ========== */
.notification-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10003;
}

.notification-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease-out;
}

.notification-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #E5E7EB;
}

.notification-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #1F2937;
}

.notification-modal-icon {
    font-size: 18px;
}

.notification-modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #9CA3AF;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.notification-modal-close-btn:hover {
    background: #F3F4F6;
    color: #374151;
}

.notification-modal-body {
    padding: 20px;
}

.notification-modal-body p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #374151;
}

.notification-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 12px 20px 16px;
    border-top: 1px solid #E5E7EB;
}

.notification-modal-ok-btn {
    padding: 8px 24px;
    border-radius: 8px;
    border: none;
    background: #0A375C;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.notification-modal-ok-btn:hover {
    background: #0d4a7a;
}

/* Error variant */
.notification-modal.error .notification-modal-ok-btn {
    background: #DC2626;
}

.notification-modal.error .notification-modal-ok-btn:hover {
    background: #B91C1C;
}

/* Success variant */
.notification-modal.success .notification-modal-ok-btn {
    background: #059669;
}

.notification-modal.success .notification-modal-ok-btn:hover {
    background: #047857;
}

.delete-confirm-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.delete-project-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.delete-project-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.delete-project-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.delete-project-modal-title .btn-icon svg path {
    fill: #011C32;
}

.delete-project-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.delete-project-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.delete-project-modal-body {
    padding: 24px;
}

.delete-warning {
    font-size: 15px;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.delete-warning strong {
    color: #011C32;
    font-weight: 600;
    display: inline-block;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

.delete-info {
    font-size: 13px;
    color: #ff4444;
    margin: 0;
}

.delete-project-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
}

.delete-project-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-project-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

.delete-project-confirm-btn {
    padding: 8px 16px;
    background: #ff4444;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.delete-project-confirm-btn:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

/* Export Configuration Modal */
.export-config-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.export-config-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.export-config-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.export-config-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.export-config-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.export-config-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.export-config-modal-body {
    padding: 20px;
}

.export-config-description {
    font-size: 14px;
    color: #666;
    margin: 0 0 16px 0;
}

.export-config-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.export-config-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #F8F9FA;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.export-config-option:hover {
    background: #EDF3F7;
    border-color: #D0DCE5;
}

.export-config-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.export-option-checkmark {
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: white;
    border: 2px solid #D0DCE5;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.export-config-option input[type="checkbox"]:checked ~ .export-option-checkmark {
    background: #035CA7;
    border-color: #035CA7;
}

.export-option-checkmark::after {
    content: '';
    display: none;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.export-config-option input[type="checkbox"]:checked ~ .export-option-checkmark::after {
    display: block;
}

.export-option-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.export-option-label {
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.export-option-desc {
    font-size: 12px;
    color: #666;
}

.export-config-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.export-config-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-config-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

.export-config-confirm-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-config-confirm-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* Rename Project Modal */
.rename-project-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.rename-project-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.rename-project-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.rename-project-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.rename-project-modal-title .btn-icon svg path {
    fill: #011C32;
}

.rename-project-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.rename-project-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.rename-project-modal-body {
    padding: 24px;
}

.rename-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.rename-project-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 15px;
    color: #011C32;
    outline: none;
    transition: all 0.2s ease;
}

.rename-project-input:focus {
    border-color: #011C32;
    box-shadow: 0 0 0 3px rgba(1, 28, 50, 0.1);
}

.rename-project-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
}

.rename-project-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rename-project-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

.rename-project-confirm-btn {
    padding: 8px 16px;
    background: #011C32;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rename-project-confirm-btn:hover {
    background: #023558;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
}

/* Link Modal */
.link-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.link-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.link-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.link-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.link-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.link-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.link-modal-body {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-modal-description {
    margin: 0;
    font-size: 14px;
    color: #4a4a4a;
}

.link-modal-label {
    font-size: 13px;
    font-weight: 600;
    color: #011C32;
}

.link-modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    font-size: 14px;
    color: #011C32;
    outline: none;
    transition: all 0.2s ease;
}

.link-modal-input:focus {
    border-color: #011C32;
    box-shadow: 0 0 0 3px rgba(1, 28, 50, 0.08);
}

.link-modal-hint {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
}

.link-modal-error {
    margin: 0;
    font-size: 12px;
    color: #b3261e;
}

.link-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-wrap: wrap;
}

.link-modal-cancel-btn,
.link-modal-remove-btn,
.link-modal-primary-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    background: transparent;
}

.link-modal-cancel-btn {
    color: #333;
    border-color: rgba(0, 0, 0, 0.2);
}

.link-modal-cancel-btn:hover {
    border-color: rgba(0, 0, 0, 0.35);
    background: rgba(0, 0, 0, 0.05);
}

.link-modal-remove-btn {
    color: #c62828;
    border-color: rgba(198, 40, 40, 0.4);
}

.link-modal-remove-btn:hover {
    background: rgba(198, 40, 40, 0.08);
}

.link-modal-primary-btn {
    background: #011C32;
    color: #fff;
    border: none;
}

.link-modal-primary-btn:hover {
    background: #023558;
    box-shadow: 0 4px 12px rgba(1, 28, 50, 0.3);
    transform: translateY(-1px);
}

.link-modal-primary-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.link-modal-primary-btn:focus-visible {
    outline: 2px solid #47a3ff;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .link-modal {
        width: 95%;
    }
}

/* Unified modal close button sizing */
.color-picker-close-btn,
.custom-cp-close-btn,
.media-library-close-btn,
.template-modal-close-btn,
.preview-close-btn,
.manage-assets-close-btn,
.svg-modal-close-btn,
.color-modal-close-btn,
.ai-provider-modal-close-btn,
.ai-assistant-modal-close-btn,
.mobile-overlay-close-btn,
.optimization-close-btn,
.eml-config-close-btn,
.export-modal-close-btn,
.profile-modal-close-btn,
.preferences-modal-close-btn,
.delete-project-modal-close-btn,
.rename-project-modal-close-btn,
.logout-modal-close-btn,
.link-modal-close-btn,
.color-picker-close-btn,
.welcome-modal-close {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    line-height: 1;
    cursor: pointer;
}

/* Logout Confirmation Modal */
.logout-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.logout-modal {
    background: #FFFFFF;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.logout-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.logout-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #011C32;
}

.logout-modal-close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.logout-modal-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.8);
}

.logout-modal-body {
    padding: 24px;
}

.logout-warning {
    font-size: 15px;
    color: #333;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

.logout-info {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.logout-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px;
}

.logout-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-cancel-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.3);
}

.logout-confirm-btn {
    padding: 8px 16px;
    background: #ff4444;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-confirm-btn:hover {
    background: #cc0000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
}

/* Mobile Responsive for New UI */
@media (max-width: 744px) {
    .preview-bottom-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        padding: 16px;
        left: 50%;
    }
    
    .bottom-bar-section {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .bottom-bar-section.actions-section {
        margin-left: 0;
        flex-direction: row;
    }
    
    .bottom-colors-grid {
        flex-wrap: wrap;
    }
    
    .account-modal,
    .export-modal {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ============================================
   ICON PICKER MODAL
   ============================================ */

.icon-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.15s ease;
}

.icon-picker-modal {
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 520px;
    max-width: 95vw;
    height: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease;
}

.icon-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    background: #f8f9fa;
}

.icon-picker-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #011C32;
}

.icon-picker-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: #666;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.icon-picker-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.icon-picker-search-row {
    padding: 12px 20px;
    border-bottom: 1px solid #eee;
    background: #f8fafc;
    flex-shrink: 0;
}

.icon-picker-search-row input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.icon-picker-search-row input:focus {
    outline: none;
    border-color: #0470C8;
    box-shadow: 0 0 0 3px rgba(4, 112, 200, 0.1);
}

.icon-picker-search-row input::placeholder {
    color: #999;
}

.icon-picker-controls {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.icon-picker-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #555;
}

.icon-picker-control label {
    font-weight: 500;
}

.icon-picker-control input[type="color"] {
    width: 32px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
}

.icon-picker-control input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.icon-picker-body {
    padding: 16px 20px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.icon-picker-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 4px;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.icon-picker-grid::-webkit-scrollbar {
    width: 6px;
}

.icon-picker-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.icon-picker-grid::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.icon-picker-grid::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.icon-picker-item {
    width: 100%;
    height: 70px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.icon-picker-item:hover {
    background: #f0f7ff;
    border-color: #0470C8;
    transform: scale(1.05);
}

.icon-picker-item:active {
    transform: scale(0.95);
}

.icon-picker-item .icon-char {
    font-size: 22px;
    line-height: 1;
}

.icon-picker-item .icon-char-svg {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-picker-item .icon-char-svg svg {
    width: 22px;
    height: 22px;
}

.icon-picker-item .icon-name {
    font-size: 9px;
    color: #666;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-picker-item:hover .icon-name {
    color: #0470C8;
}

.icon-picker-count {
    font-size: 12px;
    color: #888;
    padding: 12px 0 0;
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: 12px;
    flex-shrink: 0;
}

.icon-picker-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    font-family: system-ui, -apple-system, sans-serif;
}

.icon-picker-paste-area {
    margin-top: 16px;
    padding: 16px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    text-align: center;
    background: #fafafa;
    transition: all 0.15s ease;
}

.icon-picker-paste-area:hover {
    border-color: #0470C8;
    background: #f0f7ff;
}

.icon-picker-paste-area p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #666;
}

.icon-picker-paste-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 24px;
    text-align: center;
    font-family: 'Sportsbet-Icons', sans-serif;
}

.icon-picker-paste-input:focus {
    outline: none;
    border-color: #0470C8;
    box-shadow: 0 0 0 3px rgba(4, 112, 200, 0.1);
}

.icon-picker-paste-btn {
    margin-top: 12px;
    padding: 10px 24px;
    background: #0470C8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-picker-paste-btn:hover {
    background: #035CA7;
}

.icon-picker-paste-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Icon picker button in text toolbar */
.text-toolbar-btn.icon-picker-btn svg {
    width: 14px;
    height: 14px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .icon-picker-modal {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .icon-picker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    
    .icon-picker-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .icon-picker-item {
        height: 65px;
    }
    
    .icon-picker-item .icon-name {
        font-size: 8px;
    }
}

/* ============================================
   EML PREVIEW OVERLAY
   ============================================ */

.eml-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: none;
    animation: fadeIn 0.2s ease;
}

.eml-preview-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.eml-preview-modal {
    width: 95vw;
    height: 95vh;
    max-width: 1200px;
    background: #1a1a2e;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.25s ease;
}

.eml-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0A375C 0%, #035CA7 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.eml-preview-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.eml-preview-title span {
    font-size: 24px;
}

.eml-preview-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.eml-preview-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.eml-preview-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.eml-preview-close-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.eml-preview-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.eml-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #16213e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.eml-preview-device-toggle {
    display: flex;
    gap: 8px;
}

.eml-preview-device-toggle .device-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.eml-preview-device-toggle .device-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.eml-preview-device-toggle .device-btn.active {
    background: #0470C8;
    border-color: #0470C8;
    color: white;
}

.eml-preview-actions {
    display: flex;
    gap: 12px;
}

.eml-preview-export-btn {
    padding: 8px 20px;
    background: #0470C8;
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.eml-preview-export-btn:hover {
    background: #035CA7;
}

.eml-preview-body {
    flex: 1;
    overflow: auto;
    background: #2d2d44;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
}

.eml-preview-frame {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: all 0.3s ease;
}

.eml-preview-frame.desktop {
    width: 100%;
    max-width: 700px;
}

.eml-preview-frame.mobile {
    width: 375px;
    max-width: 375px;
    border-radius: 24px;
    box-shadow: 0 0 0 8px #333, 0 8px 32px rgba(0, 0, 0, 0.3);
}

.eml-preview-content {
    width: 100%;
    min-height: 400px;
    /* Reset all text properties to defaults */
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    word-spacing: normal !important;
    letter-spacing: normal !important;
    white-space: normal !important;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Email content styling - reset to match email clients */
.eml-preview-content table {
    border-collapse: collapse;
    border-spacing: 0;
}

.eml-preview-content img {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Ensure proper word spacing in preview - comprehensive reset */
.eml-preview-content *,
.eml-preview-content div,
.eml-preview-content p,
.eml-preview-content td,
.eml-preview-content th,
.eml-preview-content span,
.eml-preview-content li,
.eml-preview-content a,
.eml-preview-content strong,
.eml-preview-content b,
.eml-preview-content em,
.eml-preview-content i {
    word-spacing: normal !important;
    letter-spacing: normal !important;
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Loading state */
.eml-preview-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
}

.eml-preview-loading.hidden {
    display: none;
}

.eml-preview-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #0470C8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.eml-preview-loading p {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.eml-preview-loading .loading-subtext {
    margin-top: 8px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* EML Preview button highlight in export modal */
.export-option-btn.eml-preview-btn {
    background: linear-gradient(135deg, rgba(4, 112, 200, 0.1) 0%, rgba(3, 92, 167, 0.1) 100%);
    border: 1px solid rgba(4, 112, 200, 0.3);
}

.export-option-btn.eml-preview-btn:hover {
    background: linear-gradient(135deg, rgba(4, 112, 200, 0.2) 0%, rgba(3, 92, 167, 0.2) 100%);
    border-color: rgba(4, 112, 200, 0.5);
}

/* Mobile responsive for EML preview */
@media (max-width: 768px) {
    .eml-preview-modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
    }
    
    .eml-preview-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .eml-preview-info {
        width: 100%;
        order: 3;
        justify-content: center;
    }
    
    .eml-preview-toolbar {
        flex-direction: column;
        gap: 12px;
    }
    
    .eml-preview-device-toggle {
        width: 100%;
    }
    
    .eml-preview-device-toggle .device-btn {
        flex: 1;
    }
    
    .eml-preview-frame.mobile {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }
}

/* ============================================
   DEVICE MOCKUPS - Mockup Creator Styles
   ============================================ */

.mockup-creator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px;
    gap: 28px;
    min-height: 450px;
}

.mockup-device-selector {
    display: flex;
    gap: 8px;
    background: #1a1a2e;
    padding: 6px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.mockup-device-btn {
    padding: 12px 28px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #8b8b9e;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mockup-device-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.mockup-device-btn.active {
    border-color: #0470C8;
    background: #0470C8;
    color: white;
    box-shadow: 0 2px 8px rgba(4, 112, 200, 0.4);
}

.mockup-preview-area {
    width: 100%;
    display: flex;
    justify-content: center;
    flex: 1;
    min-height: 300px;
}

.mockup-canvas-container {
    position: relative;
    background: linear-gradient(145deg, #1e1e32 0%, #12121f 100%);
    border-radius: 20px;
    padding: 32px 48px;
    min-height: 340px;
    min-width: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mockup-render-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.mockup-upload-zone {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 2px dashed rgba(255, 255, 255, 0.2);
}

.mockup-upload-zone:hover {
    background: rgba(4, 112, 200, 0.3);
    border-color: #0470C8;
}

.mockup-upload-zone.hidden {
    display: none;
}

.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: white;
    padding: 40px;
}

.upload-zone-content .upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.upload-zone-content .upload-text {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.upload-zone-content .upload-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 20px;
}

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

.mockup-clear-btn {
    padding: 12px 24px;
    border: 1px solid #3a3a4a;
    border-radius: 8px;
    background: transparent;
    color: #8b8b9e;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mockup-clear-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: #5a5a6a;
}

.mockup-insert-btn {
    padding: 14px 36px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #0470C8 0%, #035ca7 100%);
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(4, 112, 200, 0.3);
}

.mockup-insert-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.mockup-insert-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(4, 112, 200, 0.4);
}

.mockup-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #8b8b9e;
}

.info-badge {
    padding: 5px 12px;
    border-radius: 4px;
    background: #0470C8;
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-badge.gif {
    background: #10b981;
}

/* ============================================
   DEVICE MOCKUPS - MacBook Frame
   ============================================ */

.device-mockup {
    transform-origin: center center;
}

/* MacBook Pro Mockup - SVG-based (matches iPhone approach) */
.device-mockup.macbook-mockup {
    width: 420px;
    position: relative;
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.4));
}

/* Screen layer - positioned BEHIND the SVG frame */
/* SVG screen area: x=61, y=20, width=398, height=248 on 520x301 canvas */
.macbook-screen-layer {
    position: absolute;
    top: 6.64%;       /* 20 / 301 */
    left: 11.73%;     /* 61 / 520 */
    width: 76.54%;    /* 398 / 520 */
    height: 82.39%;   /* 248 / 301 */
    overflow: hidden;
    z-index: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image inside the screen layer */
.macbook-screen-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Placeholder inside screen layer */
.macbook-screen-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    width: 100%;
    height: 100%;
}

.macbook-screen-placeholder .placeholder-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.macbook-screen-placeholder .placeholder-text {
    font-size: 9px;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* SVG frame sits on top */
.macbook-svg-frame {
    width: 100%;
    height: auto;
    display: block;
    z-index: 2;
    position: relative;
}

/* Hide placeholder when image is visible */
.macbook-screen-layer:has(img[style*="display: block"]) .macbook-screen-placeholder,
.macbook-screen-layer:has(img:not([style*="display: none"])) .macbook-screen-placeholder {
    display: none;
}

/* Legacy MacBook styles (kept for backward compatibility) */
.macbook-screen,
.macbook-viewport,
.macbook-notch,
.macbook-base {
    display: none; /* Hide old structure */
    background: linear-gradient(180deg, #666 0%, #444 100%);
    border-radius: 0 0 2px 2px;
}

/* ============================================
   DEVICE MOCKUPS - iPhone 17 Pro SVG Frame
   ============================================ */

.device-mockup.iphone-mockup {
    width: 180px;
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.5));
    position: relative;
}

/* Screen layer - positioned BEHIND the SVG frame */
.iphone-screen-layer {
    position: absolute;
    /* Precise positioning to match SVG screen area */
    /* SVG screen: x=11.0068 to 263.009, y=9.316 to 557.613 on 275x567 canvas */
    top: 1.64%;       /* 9.316 / 567 */
    left: 4.0%;       /* 11.0068 / 275 */
    width: 91.6%;     /* (263.009 - 11.0068) / 275 */
    height: 96.68%;   /* (557.613 - 9.316) / 567 */
    /* Match the screen corner radius - ~39px at full SVG size, scaled to 180px width = ~25px */
    border-radius: 25px;
    overflow: hidden;
    z-index: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Image inside the screen layer */
.iphone-screen-layer img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Placeholder inside screen layer */
.iphone-screen-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    width: 100%;
    height: 100%;
}

.iphone-screen-placeholder .placeholder-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.iphone-screen-placeholder .placeholder-text {
    font-size: 9px;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* SVG frame - positioned ON TOP */
.iphone-svg-frame {
    position: relative;
    width: 100%;
    height: auto;
    display: block;
    z-index: 2;
}

/* Hide placeholder when image is visible */
.iphone-screen-layer:has(img[style*="display: block"]) .iphone-screen-placeholder,
.iphone-screen-layer:has(img:not([style*="display: none"])) .iphone-screen-placeholder {
    display: none;
}

/* ============================================
   DEVICE MOCKUPS - Placeholder
   ============================================ */

.mockup-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    padding: 24px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.mockup-placeholder .placeholder-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.6;
}

.mockup-placeholder .placeholder-text {
    font-size: 10px;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hide placeholder when image is present */
.macbook-viewport:has(img) .mockup-placeholder,
.iphone-viewport:has(img) .mockup-placeholder {
    display: none;
}

/* ============================================
   DEVICE MOCKUPS - Loading State
   ============================================ */

.mockup-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    border-radius: 16px;
    color: white;
}

.mockup-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

.mockup-loading p {
    font-size: 14px;
    margin: 0;
}

/* ============================================
   CHART BUILDER MODAL
   ============================================ */

.chart-builder-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.chart-builder-overlay.active {
    display: flex;
}

.chart-builder-modal {
    width: 95%;
    max-width: 1100px;
    height: 85vh;
    max-height: 750px;
    background: white;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.chart-builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.chart-builder-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #0A375C;
}

.chart-builder-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: #E5E7EB;
    color: #6B7280;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chart-builder-close-btn:hover {
    background: #DC2626;
    color: white;
}

.chart-builder-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Preview Panel */
.chart-builder-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #E5E7EB;
    background: #F3F4F6;
}

.chart-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    border-bottom: 1px solid #E5E7EB;
}

.chart-preview-bg-note {
    font-size: 11px;
    font-weight: 400;
    color: #9CA3AF;
}

.chart-preview-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto;
    transition: background 0.3s;
}

.chart-preview-container {
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-preview-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.chart-preview-bg-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
    font-size: 12px;
    color: #6B7280;
}

.preview-bg-btn {
    padding: 6px 12px;
    border: 1px solid #D1D5DB;
    background: white;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-bg-btn:hover {
    border-color: #035CA7;
}

.preview-bg-btn.active {
    background: #035CA7;
    color: white;
    border-color: #035CA7;
}

/* Controls Panel */
.chart-builder-controls-panel {
    width: 380px;
    display: flex;
    flex-direction: column;
    background: white;
}

.chart-type-selector {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.chart-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid #E5E7EB;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #6B7280;
}

.chart-type-btn:hover {
    border-color: #035CA7;
    color: #035CA7;
}

.chart-type-btn.active {
    border-color: #035CA7;
    background: #EBF5FF;
    color: #035CA7;
}

.chart-type-icon {
    font-size: 20px;
}

.chart-builder-controls-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.chart-builder-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-builder-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-builder-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.chart-builder-input {
    padding: 10px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.chart-builder-input:focus {
    outline: none;
    border-color: #035CA7;
}

.chart-builder-toggle-group {
    display: flex;
    gap: 8px;
}

.fill-style-btn,
.text-mode-btn {
    flex: 1;
    padding: 10px;
    border: 1px solid #D1D5DB;
    background: white;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.fill-style-btn:hover,
.text-mode-btn:hover {
    border-color: #035CA7;
}

.fill-style-btn.active,
.text-mode-btn.active {
    background: #035CA7;
    color: white;
    border-color: #035CA7;
}

.chart-builder-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #F3F4F6;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}

.chart-checkbox input {
    margin: 0;
    cursor: pointer;
}

/* Y-Axis Settings */
.chart-axis-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chart-axis-row {
    display: flex;
    gap: 12px;
}

.chart-axis-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chart-axis-field label {
    font-size: 11px;
    color: #6B7280;
    font-weight: 500;
}

.chart-axis-input {
    width: 100%;
    padding: 8px 10px !important;
    font-size: 13px !important;
}

/* Color Pickers */
.chart-color-presets {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chart-color-presets button {
    width: 32px;
    height: 32px;
    border: 1px solid #D1D5DB;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.chart-color-presets button:hover {
    transform: scale(1.1);
    border-color: #035CA7;
}

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

.chart-color-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #F3F4F6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.chart-color-item:hover {
    background: #E5E7EB;
    border-color: #D1D5DB;
}

.chart-color-item input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: 2px solid #D1D5DB;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
    flex-shrink: 0;
}

.chart-color-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 3px;
}

.chart-color-item input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.chart-color-item input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

.chart-color-item input[type="color"]:hover {
    border-color: #035CA7;
    transform: scale(1.05);
}

.chart-color-item input[type="color"]:focus {
    outline: none;
    border-color: #035CA7;
    box-shadow: 0 0 0 3px rgba(3, 92, 167, 0.25);
}

.chart-color-label {
    font-size: 11px;
    color: #6B7280;
}

.chart-color-single {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-color-single input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
}

.chart-color-single span {
    font-size: 13px;
    font-family: monospace;
    color: #6B7280;
}

/* Data Table */
.chart-data-table {
    margin-top: 16px;
    border-top: 1px solid #E5E7EB;
    padding-top: 16px;
}

.chart-data-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chart-data-header span {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.chart-add-row-btn {
    padding: 6px 12px;
    background: #035CA7;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.chart-add-row-btn:hover {
    background: #024a8c;
}

.chart-data-series-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E5E7EB;
    flex-wrap: wrap;
}

.chart-series-label {
    font-size: 11px;
    color: #6B7280;
    font-weight: 500;
}

.chart-series-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chart-series-input {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    font-size: 11px;
}

.chart-remove-series-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: #FEE2E2;
    color: #DC2626;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.chart-add-series-btn {
    width: 24px;
    height: 24px;
    border: 1px dashed #035CA7;
    background: white;
    color: #035CA7;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.chart-data-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.chart-data-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chart-data-row.grouped {
    flex-wrap: wrap;
}

.chart-label-input,
.chart-group-input {
    flex: 1;
    min-width: 80px;
    padding: 8px 10px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
}

.chart-value-input {
    width: 60px;
    padding: 8px 10px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.chart-remove-row-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: #FEE2E2;
    color: #DC2626;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.chart-remove-row-btn:hover {
    background: #DC2626;
    color: white;
}

/* Tip Message */
.chart-builder-tip {
    padding: 10px 16px;
    background: #FEF3C7;
    color: #92400E;
    font-size: 12px;
    border-top: 1px solid #FCD34D;
}

/* Footer */
.chart-builder-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #E5E7EB;
    background: #F9FAFB;
}

.chart-cancel-btn {
    padding: 10px 20px;
    border: 1px solid #D1D5DB;
    background: white;
    color: #374151;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-cancel-btn:hover {
    background: #F3F4F6;
}

.chart-insert-btn {
    padding: 10px 24px;
    border: none;
    background: #035CA7;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-insert-btn:hover {
    background: #024a8c;
}

/* Preview Error */
.chart-preview-error {
    padding: 40px;
    color: #DC2626;
    text-align: center;
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .chart-builder-modal {
        height: 95vh;
        max-height: none;
    }
    
    .chart-builder-body {
        flex-direction: column;
    }
    
    .chart-builder-preview-panel {
        border-right: none;
        border-bottom: 1px solid #E5E7EB;
        max-height: 40vh;
    }
    
    .chart-builder-controls-panel {
        width: 100%;
    }
}

/* ============================================
   CANVAS CHART PREVIEW & EDIT OVERLAY
   ============================================ */

.canvas-chart-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    border-radius: 8px;
    overflow: hidden;
}

.canvas-chart-preview img {
    max-width: 100%;
    height: auto;
    display: block;
}

.chart-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
    pointer-events: none;
    border-radius: 8px;
}

.canvas-chart-preview:hover .chart-edit-overlay {
    opacity: 1;
    background: rgba(3, 92, 167, 0.1);
}

.chart-edit-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: rgba(3, 92, 167, 0.95);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.15s, background 0.15s;
}

.chart-edit-hint:hover {
    background: rgba(3, 92, 167, 1);
    transform: scale(1.02);
}

.chart-edit-icon {
    font-size: 18px;
}

.empty-chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #F3F4F6;
    border-radius: 8px;
    color: #6B7280;
    font-size: 14px;
}

/* Chart Editor Panel */
.chart-editor-preview {
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: #F3F4F6;
}

.chart-editor-preview-img {
    padding: 16px;
}

.chart-editor-preview-img img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.panel-control-value {
    font-size: 14px;
    color: #374151;
    padding: 8px 12px;
    background: #F3F4F6;
    border-radius: 6px;
}

/* ========== BLOCK OUTLINE TOGGLE ========== */
/* Hide block outlines when toggle is off */
.hide-block-outlines .content-block.text-type,
.hide-block-outlines .content-block.text-block,
.hide-block-outlines .content-block.image-type,
.hide-block-outlines .content-block.image-block,
.hide-block-outlines .content-block.divider-type,
.hide-block-outlines .content-block.divider-block {
    border: 1px solid transparent !important;
}

.hide-block-outlines .content-block.row-type {
    border: 2px solid transparent !important;
    background: transparent !important;
}

/* Keep the row-type styling for the background but hide border */
.hide-block-outlines .content-block.row-type .row-container {
    background: transparent;
}

/* Block Outline Toggle Button */
.block-outline-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(148, 181, 209, 0.3);
    border-radius: 6px;
    color: #0A375C;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.block-outline-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(148, 181, 209, 0.5);
}

.block-outline-toggle.active {
    background: rgba(3, 92, 167, 0.1);
    border-color: #035CA7;
    color: #035CA7;
}

.block-outline-toggle .toggle-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.block-outline-toggle .toggle-icon svg {
    width: 14px;
    height: 14px;
}
