/* ============================================
   Newsletter Builder Styles
   Drag & Drop Newsletter Editor
   ============================================ */

/* CSS Variables */
:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --secondary: #EC4899;

    --accent-1: #FF6B6B;
    --accent-2: #9B59B6;
    --accent-3: #3498DB;
    --accent-4: #2ECC71;
    --accent-5: #F39C12;

    --dark: #0F172A;
    --dark-light: #1E293B;
    --dark-lighter: #334155;

    --light: #F8FAFC;
    --light-dark: #E2E8F0;
    --light-darker: #CBD5E1;

    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;

    --toolbar-height: 60px;
    --sidebar-width: 280px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Space Grotesk', var(--font-sans);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--light-dark);
    -webkit-font-smoothing: antialiased;
}

/* Toolbar */
.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--toolbar-height);
    background: white;
    border-bottom: 1px solid var(--light-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--light-dark);
    margin: 0 0.5rem;
}

.newsletter-name input {
    border: none;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
    width: 200px;
}

.newsletter-name input:hover {
    background: var(--light);
}

.newsletter-name input:focus {
    outline: none;
    background: var(--light);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* View Toggles */
.view-toggles {
    display: flex;
    background: var(--light);
    border-radius: var(--radius-lg);
    padding: 4px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn svg {
    width: 18px;
    height: 18px;
}

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

.view-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Toolbar Buttons */
.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn svg {
    width: 20px;
    height: 20px;
}

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

.toolbar-btn.primary {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
}

.toolbar-btn.primary:hover {
    background: var(--primary-dark);
}

.toolbar-btn.primary .chevron {
    width: 16px;
    height: 16px;
    margin-left: 0.25rem;
}

/* Export Dropdown */
.export-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--light-dark);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
    z-index: 110;
}

.export-dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-align: left;
}

.dropdown-item:hover {
    background: var(--light);
}

.dropdown-item svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
    flex-shrink: 0;
}

.dropdown-item-content {
    flex: 1;
}

.dropdown-item-title {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-item-desc {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--light-dark);
    margin: 0.5rem 0;
}

/* App Container */
.app-container {
    display: flex;
    height: calc(100vh - var(--toolbar-height));
    margin-top: var(--toolbar-height);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--light-dark);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

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

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--light-dark);
}

.sidebar-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Components Grid */
.components-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1rem;
}

.component-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.5rem;
    background: var(--light);
    border: 2px dashed transparent;
    border-radius: var(--radius-lg);
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.component-item:hover {
    background: white;
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
}

.component-item:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.component-item.dragging {
    opacity: 0.5;
}

.component-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-md);
    color: var(--primary);
}

.component-icon svg {
    width: 24px;
    height: 24px;
}

.component-item span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Sidebar Section */
.sidebar-section {
    padding: 1rem;
    border-top: 1px solid var(--light-dark);
}

.sidebar-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Templates */
.templates-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.template-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: transparent;
    border: 2px solid var(--light-dark);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.template-item:hover {
    border-color: var(--primary);
    background: var(--light);
}

.template-preview {
    width: 100%;
    height: 60px;
    background: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.template-preview.blank {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--light-darker);
    background: transparent;
}

.template-preview.blank span {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.template-preview .t-header {
    height: 12px;
    background: var(--dark);
}

.template-preview .t-content {
    flex: 1;
    background: var(--light);
}

.template-preview .t-footer {
    height: 8px;
    background: var(--dark-lighter);
}

.template-preview .t-hero {
    height: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.template-preview .t-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 2px;
    background: var(--light);
}

.template-preview .t-grid::before,
.template-preview .t-grid::after {
    content: '';
    background: white;
    border-radius: 1px;
}

.template-preview .t-image {
    height: 30px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

.template-preview .t-details {
    flex: 1;
    background: var(--light);
}

.template-item span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    overflow: hidden;
    background: var(--light-dark);
    background-image:
        radial-gradient(circle at 1px 1px, var(--light-darker) 1px, transparent 0);
    background-size: 20px 20px;
    gap: 1rem;
}

/* Zoom Controls */
.zoom-controls {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 50;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

.zoom-btn:disabled:hover {
    background: var(--light);
    color: var(--text-secondary);
}

.zoom-btn svg {
    width: 18px;
    height: 18px;
}

.zoom-level {
    min-width: 50px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.zoom-divider {
    width: 1px;
    height: 24px;
    background: var(--light-dark);
}

.zoom-fit-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Page Navigation Arrows - Fixed position outside zoom */
.page-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    border: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-base);
    flex-shrink: 0;
    z-index: 100;
}

.page-nav-prev {
    left: calc(var(--sidebar-width) + 1.5rem);
}

.page-nav-next {
    right: calc(var(--sidebar-width) + 1.5rem);
}

.page-nav:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.page-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-nav:disabled:hover {
    background: white;
    color: var(--text-secondary);
    transform: translateY(-50%);
}

.page-nav svg {
    width: 24px;
    height: 24px;
}

.canvas-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transform-origin: center center;
    transition: transform 0.2s ease;
    perspective: 2000px;
    height: 100%;
    width: 100%;
}

/* Book Spread Layout */
.book-spread {
    display: flex;
    justify-content: center;
    perspective: 2000px;
    width: 100%;
    position: relative;
    transform-style: preserve-3d;
}

/* All pages container - holds all rendered pages */
.all-pages-container {
    position: relative;
    display: flex;
    justify-content: center;
    transform-style: preserve-3d;
}

/* The open book container */
.book-container {
    display: flex;
    position: relative;
    transform-style: preserve-3d;
}

.book-page {
    display: none;
    flex-direction: column;
    background: white;
    box-shadow: var(--shadow-xl);
    position: relative;
    backface-visibility: hidden;
}

.book-page.active {
    display: flex;
}

/* Single page view (cover/back cover) */
.book-page-single {
    width: 500px;
    min-height: 680px;
    border-radius: var(--radius-xl);
    transform-style: preserve-3d;
}

.book-page-single .page-canvas {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Two-page spread view */
.book-page-left,
.book-page-right {
    width: 450px;
    min-height: 620px;
    transform-style: preserve-3d;
}

.book-page-left {
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    transform-origin: right center;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1), 0 0 5px rgba(0,0,0,0.05);
}

.book-page-left .page-canvas {
    border-radius: 0 0 0 var(--radius-lg);
}

.book-page-left .page-spine {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(0,0,0,0.02) 30%,
        rgba(0,0,0,0.08) 70%,
        rgba(0,0,0,0.15) 100%);
    pointer-events: none;
    z-index: 10;
}

.book-page-right {
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    transform-origin: left center;
    box-shadow: 5px 0 15px rgba(0,0,0,0.1), 0 0 5px rgba(0,0,0,0.05);
}

.book-page-right .page-canvas {
    border-radius: 0 0 var(--radius-lg) 0;
}

.book-page-right::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left,
        transparent 0%,
        rgba(0,0,0,0.02) 30%,
        rgba(0,0,0,0.08) 70%,
        rgba(0,0,0,0.15) 100%);
    pointer-events: none;
    z-index: 10;
}

/* Book spine/binding */
.book-spine {
    width: 8px;
    background: linear-gradient(to right,
        rgba(0,0,0,0.2) 0%,
        rgba(0,0,0,0.1) 20%,
        rgba(0,0,0,0.05) 40%,
        rgba(0,0,0,0.05) 60%,
        rgba(0,0,0,0.1) 80%,
        rgba(0,0,0,0.2) 100%);
    position: relative;
    z-index: 5;
}

/* Page header with number */
.page-header {
    padding: 0.5rem 1rem;
    background: var(--light);
    border-bottom: 1px solid var(--light-dark);
    display: flex;
    justify-content: center;
}

.book-page-left .page-header {
    border-radius: var(--radius-xl) 0 0 0;
}

.book-page-right .page-header {
    border-radius: 0 var(--radius-xl) 0 0;
}

.book-page-single .page-header {
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.page-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Page canvas (content area) */
.page-canvas {
    background: white;
    min-height: 500px;
    position: relative;
    overflow: hidden;
    flex: 1;
}

.canvas {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    min-height: 800px;
    position: relative;
    overflow: hidden;
}

/* ===========================================
   Stacked Pages System - All pages rendered
   =========================================== */

/* Individual stacked page */
.stacked-page {
    position: absolute;
    width: 450px;
    min-height: 620px;
    background: white;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    border-radius: var(--radius-xl);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stacked-page .stacked-page-header {
    padding: 0.5rem 1rem;
    background: var(--light);
    border-bottom: 1px solid var(--light-dark);
    text-align: center;
}

.stacked-page .stacked-page-number {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stacked-page .stacked-page-content {
    flex: 1;
    background: white;
    padding: 0;
    overflow: hidden;
}

/* Left pages (even) stack to the left */
.stacked-page.page-left {
    transform-origin: right center;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
    right: 50%;
    margin-right: 4px;
}

/* Right pages (odd) stack to the right */
.stacked-page.page-right {
    transform-origin: left center;
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    left: 50%;
    margin-left: 4px;
}

/* Cover page (centered) */
.stacked-page.page-cover {
    position: relative;
    width: 500px;
    min-height: 680px;
}

/* Page that is currently flipping */
.stacked-page.flipping {
    z-index: 100;
    transition: none;
}

/* Smooth flip animation */
.stacked-page.flip-to-left {
    animation: smoothFlipLeft 0.6s cubic-bezier(0.4, 0.0, 0.6, 1) forwards;
}

.stacked-page.flip-to-right {
    animation: smoothFlipRight 0.6s cubic-bezier(0.4, 0.0, 0.6, 1) forwards;
}

@keyframes smoothFlipLeft {
    0% {
        transform: rotateY(0deg);
        z-index: 100;
        box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    }
    25% {
        transform: rotateY(-45deg);
        box-shadow: 5px 5px 30px rgba(0,0,0,0.3);
    }
    50% {
        transform: rotateY(-90deg);
        box-shadow: 10px 5px 40px rgba(0,0,0,0.4);
    }
    75% {
        transform: rotateY(-135deg);
        box-shadow: 5px 5px 30px rgba(0,0,0,0.3);
    }
    100% {
        transform: rotateY(-180deg);
        z-index: 1;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
}

@keyframes smoothFlipRight {
    0% {
        transform: rotateY(0deg);
        z-index: 100;
        box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    }
    25% {
        transform: rotateY(45deg);
        box-shadow: -5px 5px 30px rgba(0,0,0,0.3);
    }
    50% {
        transform: rotateY(90deg);
        box-shadow: -10px 5px 40px rgba(0,0,0,0.4);
    }
    75% {
        transform: rotateY(135deg);
        box-shadow: -5px 5px 30px rgba(0,0,0,0.3);
    }
    100% {
        transform: rotateY(180deg);
        z-index: 1;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
}

/* Page shadows during flip - creates depth */
.stacked-page.flipping::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to left, transparent 0%, rgba(0,0,0,0.15) 100%);
    opacity: 0;
    pointer-events: none;
    animation: flipShadow 0.6s ease-in-out;
}

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

/* Pages that are hidden (flipped over) */
.stacked-page.flipped {
    transform: rotateY(-180deg);
    z-index: 1;
}

.stacked-page.page-right.flipped {
    transform: rotateY(180deg);
}

/* Active/visible pages */
.stacked-page.page-visible {
    z-index: 50;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Flip page preview content styles */
.flip-page-header {
    padding: 0.5rem 1rem;
    background: var(--light);
    border-bottom: 1px solid var(--light-dark);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
}

.flip-page-content {
    padding: 0.75rem;
    overflow: hidden;
    flex: 1;
    background: white;
}

.block-preview {
    margin-bottom: 0.5rem;
}

.empty-page-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* Underlying pages effect - shows pages beneath during flip */
.book-spread::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 896px;
    height: 610px;
    background: linear-gradient(90deg,
        #f0f0f0 0%,
        #fafafa 2%,
        white 5%,
        white 49.5%,
        rgba(0,0,0,0.1) 50%,
        white 50.5%,
        white 95%,
        #fafafa 98%,
        #f0f0f0 100%);
    border-radius: var(--radius-xl);
    z-index: -1;
    box-shadow:
        inset 0 0 30px rgba(0,0,0,0.05),
        0 5px 20px rgba(0,0,0,0.1);
    opacity: 0;
    transition: opacity 0.2s;
}

.book-spread.showing-flip::after {
    opacity: 1;
}

/* Stacked pages effect using box-shadow on active pages */
.book-page-left.active,
.book-page-right.active {
    box-shadow:
        /* Main shadow */
        0 10px 30px rgba(0,0,0,0.15),
        /* Stacked page effect - layer 1 */
        0 4px 0 -2px #fafafa,
        0 4px 2px -2px rgba(0,0,0,0.1),
        /* Stacked page effect - layer 2 */
        0 8px 0 -4px #f0f0f0,
        0 8px 4px -4px rgba(0,0,0,0.08),
        /* Stacked page effect - layer 3 */
        0 12px 0 -6px #e8e8e8,
        0 12px 6px -6px rgba(0,0,0,0.05);
}

/* Page Controls */
.page-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
}

.page-thumbnails {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    max-width: 400px;
    padding: 0.25rem;
}

.page-thumb {
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.page-thumb:hover {
    background: var(--light-dark);
}

.page-thumb.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-dark);
}

.page-actions {
    display: flex;
    gap: 0.5rem;
    border-left: 1px solid var(--light-dark);
    padding-left: 1rem;
}

.page-control-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: var(--light);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-control-btn:hover {
    background: var(--primary);
    color: white;
}

.page-control-btn.danger:hover {
    background: var(--error);
    color: white;
}

.page-control-btn svg {
    width: 14px;
    height: 14px;
}

/* Page flip animation */
.book-spread.flipping-forward .book-page-right {
    animation: flipForward 0.6s ease-in-out;
}

.book-spread.flipping-backward .book-page-left {
    animation: flipBackward 0.6s ease-in-out;
}

@keyframes flipForward {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(-90deg); }
    100% { transform: rotateY(0deg); }
}

@keyframes flipBackward {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

/* Editing state for spread pages */
.book-page.editing {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
    z-index: 5;
}

.book-page.editing .page-header {
    background: var(--primary);
}

.book-page.editing .page-number {
    color: white;
}

/* Make spread pages clickable */
.book-page-left,
.book-page-right {
    cursor: pointer;
}

.book-page-left:not(.editing):hover,
.book-page-right:not(.editing):hover {
    outline: 2px dashed var(--primary-light);
    outline-offset: -2px;
}

/* Empty state for spread pages */
.book-page .newsletter-content:empty::after {
    content: 'Click to edit this page, then drag components here';
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem;
}

.book-page.editing .newsletter-content:empty::after {
    content: 'Drag components here';
    color: var(--primary);
}

/* Empty Canvas */
.empty-canvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.empty-canvas.hidden {
    display: none;
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    color: var(--light-darker);
}

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

.empty-canvas h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-canvas p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.quick-start-buttons {
    display: flex;
    gap: 1rem;
}

.quick-start-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-start-btn svg {
    width: 20px;
    height: 20px;
}

.quick-start-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.quick-start-btn.secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--light-dark);
}

.quick-start-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Newsletter Content */
.newsletter-content {
    min-height: 100%;
}

/* Block Styles */
.newsletter-block {
    position: relative;
    padding: 1rem;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.newsletter-block:hover {
    border-color: var(--primary-light);
}

.newsletter-block.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
}

.newsletter-block.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Block Controls */
.block-controls {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.newsletter-block:hover .block-controls,
.newsletter-block.selected .block-controls {
    opacity: 1;
}

.block-control-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--light-dark);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.block-control-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.block-control-btn.delete:hover {
    background: var(--error);
    border-color: var(--error);
}

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

/* Drop Indicator */
.drop-indicator {
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    margin: 0.5rem 0;
    animation: pulse-drop 1s ease-in-out infinite;
}

@keyframes pulse-drop {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Properties Panel */
.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.no-selection-icon {
    width: 48px;
    height: 48px;
    color: var(--light-darker);
    margin-bottom: 1rem;
}

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

.no-selection p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.properties-content {
    padding: 1rem;
}

/* Property Groups */
.property-group {
    margin-bottom: 1.5rem;
}

.property-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--light-dark);
}

.property-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Property Fields */
.property-field {
    margin-bottom: 1rem;
}

.property-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.property-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--light-dark);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.property-input:hover {
    border-color: var(--light-darker);
}

.property-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.property-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Color Picker */
.color-picker-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-preview {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 2px solid var(--light-dark);
    cursor: pointer;
    overflow: hidden;
}

.color-preview input {
    width: 150%;
    height: 150%;
    transform: translate(-15%, -15%);
    cursor: pointer;
    border: none;
}

.color-picker-wrapper .property-input {
    flex: 1;
}

/* Select */
.property-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px;
    padding-right: 2rem;
}

/* Range Slider */
.range-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.range-wrapper input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--light-dark);
    border-radius: 3px;
    cursor: pointer;
}

.range-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.range-wrapper input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.range-value {
    min-width: 40px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Button Group */
.button-group {
    display: flex;
    gap: 0.25rem;
}

.button-group button {
    flex: 1;
    padding: 0.5rem;
    background: var(--light);
    border: 1px solid var(--light-dark);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.button-group button:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.button-group button:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.button-group button:hover {
    background: var(--light-dark);
}

.button-group button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.button-group button svg {
    width: 18px;
    height: 18px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--dark);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: slideIn 0.3s ease;
}

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

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

.toast.warning {
    background: var(--warning);
}

.toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--light-dark);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--light);
    color: var(--text-primary);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--light-dark);
    background: var(--light);
}

.modal-footer .btn-secondary {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid var(--light-dark);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-footer .btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.modal-footer .btn-primary {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    border: none;
    color: white;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-footer .btn-primary:hover {
    background: var(--primary-dark);
}

/* Export Options */
.export-options {
    display: grid;
    gap: 1rem;
}

.export-option {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.export-option:hover {
    border-color: var(--primary-light);
}

.export-option.selected {
    border-color: var(--primary);
    background: white;
}

.export-option-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-md);
    color: var(--primary);
}

.export-option-icon svg {
    width: 28px;
    height: 28px;
}

.export-option-content h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.export-option-content p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Block Type Specific Styles */

/* Header Block */
.block-header {
    padding: 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 100%);
    color: white;
}

.block-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.block-header p {
    font-size: 1rem;
    opacity: 0.8;
}

/* Text Block */
.block-text {
    padding: 1.5rem 2rem;
}

.block-text h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.block-text p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Image Block */
.block-image {
    padding: 1rem 2rem;
}

.block-image .image-wrapper {
    position: relative;
    background: var(--light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.block-image .image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-muted);
}

.block-image .image-placeholder svg {
    width: 48px;
    height: 48px;
}

/* Button Block */
.block-button {
    padding: 1.5rem 2rem;
    text-align: center;
}

.block-button a {
    display: inline-block;
    padding: 0.875rem 2rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.block-button a:hover {
    background: var(--primary-dark);
}

/* Divider Block */
.block-divider {
    padding: 1rem 2rem;
}

.block-divider hr {
    border: none;
    height: 2px;
    background: var(--light-dark);
}

/* Spacer Block */
.block-spacer {
    height: 40px;
    position: relative;
}

.block-spacer::before {
    content: 'Spacer';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: white;
    padding: 0 0.5rem;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.block-spacer:hover::before {
    opacity: 1;
}

/* Columns Block */
.block-columns {
    padding: 1rem 2rem;
}

.block-columns .columns-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.block-columns .column {
    background: var(--light);
    border-radius: var(--radius-md);
    padding: 1rem;
    min-height: 150px;
    border: 2px dashed var(--light-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Article Block */
.block-article {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--light-dark);
}

.block-article .article-wrapper {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
}

.block-article .article-image {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    min-height: 150px;
}

.block-article .article-content h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.block-article .article-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.block-article .article-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.block-article .read-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* Quote Block */
.block-quote {
    padding: 2rem;
}

.block-quote blockquote {
    position: relative;
    padding: 1.5rem 2rem;
    background: var(--light);
    border-left: 4px solid var(--primary);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    font-size: 1.125rem;
    font-style: italic;
    color: var(--text-secondary);
}

.block-quote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    font-weight: 600;
    color: var(--text-primary);
}

/* Social Block */
.block-social {
    padding: 1.5rem 2rem;
    text-align: center;
}

.block-social .social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.block-social .social-link {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.block-social .social-link:hover {
    background: var(--primary);
    color: white;
}

.block-social .social-link svg {
    width: 24px;
    height: 24px;
}

/* Event Block */
.block-event {
    padding: 1.5rem 2rem;
}

.block-event .event-wrapper {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--light);
    border-radius: var(--radius-xl);
}

.block-event .event-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg);
    padding: 1rem;
    text-align: center;
}

.block-event .event-date .day {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
}

.block-event .event-date .month {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.block-event .event-info h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.block-event .event-info p {
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.block-event .event-info .event-location {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.block-event .event-info .event-location svg {
    width: 16px;
    height: 16px;
}

/* Responsive */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 992px) {
    .sidebar-left {
        position: fixed;
        left: -100%;
        top: var(--toolbar-height);
        height: calc(100vh - var(--toolbar-height));
        z-index: 90;
        transition: left var(--transition-base);
    }

    .sidebar-left.active {
        left: 0;
    }

    .sidebar-right {
        position: fixed;
        right: -100%;
        top: var(--toolbar-height);
        height: calc(100vh - var(--toolbar-height));
        z-index: 90;
        transition: right var(--transition-base);
    }

    .sidebar-right.active {
        right: 0;
    }

    .canvas-container {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .toolbar-center {
        display: none;
    }

    .logo span {
        display: none;
    }

    .newsletter-name input {
        width: 120px;
    }

    .block-article .article-wrapper {
        grid-template-columns: 1fr;
    }

    .block-columns .columns-container {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styles */
.sidebar::-webkit-scrollbar,
.canvas-container::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.canvas-container::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--light-darker);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Editable content styles */
[contenteditable="true"] {
    outline: none;
    cursor: text;
}

[contenteditable="true"]:focus {
    background: rgba(99, 102, 241, 0.05);
}

/* Image upload overlay */
.image-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(99, 102, 241, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity var(--transition-fast);
    cursor: pointer;
}

.block-image:hover .image-upload-overlay {
    opacity: 1;
}

.image-upload-overlay svg {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
}

/* Preview Mode Styles */
.canvas.preview-mode .newsletter-block {
    border-color: transparent !important;
    cursor: default;
}

.canvas.preview-mode .block-controls {
    display: none !important;
}

.canvas.preview-mode .newsletter-block:hover {
    border-color: transparent;
    background: transparent;
}

/* ============================================
   New Components - Kid-Friendly Styles
   ============================================ */

/* Bullet List Block */
.block-list {
    padding: 1.5rem 2rem;
}

.list-wrapper {
    position: relative;
}

.fancy-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fancy-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 1rem;
    line-height: 1.6;
    border-bottom: 1px dashed var(--light-dark);
}

.fancy-list li:last-child {
    border-bottom: none;
}

.list-bullet {
    color: var(--list-color, var(--primary));
    font-weight: 700;
    font-size: 1.2em;
    min-width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.list-style-check .list-bullet { color: var(--success); }
.list-style-star .list-bullet { color: #F59E0B; }
.list-style-heart .list-bullet { color: #EC4899; }
.list-style-arrow .list-bullet { color: var(--primary); }

.list-text {
    flex: 1;
}

.add-list-item-btn {
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--light);
    border: 2px dashed var(--light-darker);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    width: 100%;
}

.add-list-item-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* Frame Box Block */
.block-frame {
    padding: 1.5rem 2rem;
}

.frame-wrapper {
    padding: 1.5rem;
    background: var(--frame-bg, white);
    position: relative;
}

.frame-simple {
    border: 3px solid var(--frame-border, var(--primary));
}

.frame-double {
    border: 3px double var(--frame-border, var(--primary));
    padding: 1.75rem;
}

.frame-dashed {
    border: 3px dashed var(--frame-border, var(--primary));
}

.frame-fancy {
    border: 4px solid var(--frame-border, var(--primary));
    box-shadow:
        inset 0 0 0 4px white,
        inset 0 0 0 6px var(--frame-border, var(--primary));
    padding: 2rem;
}

.frame-shadow {
    border: 2px solid var(--frame-border, var(--primary));
    box-shadow: 8px 8px 0 var(--frame-border, var(--primary));
}

.frame-glow {
    border: 3px solid var(--frame-border, var(--primary));
    box-shadow:
        0 0 10px var(--frame-border, var(--primary)),
        0 0 20px rgba(99, 102, 241, 0.3),
        0 0 30px rgba(99, 102, 241, 0.1);
}

.corner-rounded { border-radius: var(--radius-lg); }
.corner-square { border-radius: 0; }
.corner-fancy {
    border-radius: 0;
    clip-path: polygon(
        0 10px, 10px 10px, 10px 0,
        calc(100% - 10px) 0, calc(100% - 10px) 10px, 100% 10px,
        100% calc(100% - 10px), calc(100% - 10px) calc(100% - 10px), calc(100% - 10px) 100%,
        10px 100%, 10px calc(100% - 10px), 0 calc(100% - 10px)
    );
}

.frame-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Callout Block */
.block-callout {
    padding: 1.5rem 2rem;
}

.callout-wrapper {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border-left: 4px solid;
}

.callout-info {
    background: #EEF2FF;
    border-color: #6366F1;
}

.callout-info .callout-icon { color: #6366F1; }

.callout-success {
    background: #ECFDF5;
    border-color: #10B981;
}

.callout-success .callout-icon { color: #10B981; }

.callout-warning {
    background: #FFFBEB;
    border-color: #F59E0B;
}

.callout-warning .callout-icon { color: #F59E0B; }

.callout-tip {
    background: #F0F9FF;
    border-color: #0EA5E9;
}

.callout-tip .callout-icon { color: #0EA5E9; }

.callout-idea {
    background: #FEF3C7;
    border-color: #F59E0B;
}

.callout-idea .callout-icon { color: #F59E0B; }

.callout-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

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

.callout-content h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.callout-content p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Badge Block */
.block-badge {
    padding: 1.5rem 2rem;
}

.badge-wrapper {
    display: flex;
    justify-content: center;
}

.badge-wrapper[style*="text-align: left"] { justify-content: flex-start; }
.badge-wrapper[style*="text-align: right"] { justify-content: flex-end; }

.badge-text {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: white;
}

.badge-ribbon .badge-text {
    background: var(--badge-color, var(--primary));
    position: relative;
    padding: 0.75rem 2rem;
}

.badge-ribbon .badge-text::before,
.badge-ribbon .badge-text::after {
    content: '';
    position: absolute;
    top: 100%;
    border: 10px solid transparent;
}

.badge-ribbon .badge-text::before {
    left: 0;
    border-top-color: var(--badge-color, var(--primary));
    border-left-color: var(--badge-color, var(--primary));
    filter: brightness(0.7);
}

.badge-ribbon .badge-text::after {
    right: 0;
    border-top-color: var(--badge-color, var(--primary));
    border-right-color: var(--badge-color, var(--primary));
    filter: brightness(0.7);
}

.badge-circle .badge-text {
    background: var(--badge-color, var(--primary));
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    text-align: center;
}

.badge-star .badge-text {
    background: var(--badge-color, var(--primary));
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.badge-banner .badge-text {
    background: var(--badge-color, var(--primary));
    padding: 0.75rem 3rem;
    position: relative;
}

.badge-banner .badge-text::before,
.badge-banner .badge-text::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    background: var(--badge-color, var(--primary));
}

.badge-banner .badge-text::before {
    left: -15px;
    clip-path: polygon(100% 0, 100% 100%, 0 50%);
}

.badge-banner .badge-text::after {
    right: -15px;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Fancy/Shaped Text Block */
.block-shapedtext {
    padding: 2rem;
}

.shapedtext-wrapper {
    display: flex;
    justify-content: center;
    overflow: visible;
    padding: 1rem;
}

.shapedtext-wrapper[style*="text-align: left"] { justify-content: flex-start; }
.shapedtext-wrapper[style*="text-align: right"] { justify-content: flex-end; }

.shaped-text {
    font-family: var(--font-display);
    font-weight: 700;
    display: inline-block;
    line-height: 1.2;
}

/* Text Effects */
.effect-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.effect-glow {
    color: #6366F1;
    text-shadow:
        0 0 10px #6366F1,
        0 0 20px #6366F1,
        0 0 30px #6366F1,
        0 0 40px #6366F1;
}

.effect-shadow {
    color: var(--dark);
    text-shadow:
        3px 3px 0 #94A3B8,
        6px 6px 0 #CBD5E1;
}

.effect-outline {
    color: transparent;
    -webkit-text-stroke: 2px var(--primary);
}

.effect-rainbow {
    background: linear-gradient(90deg,
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3, #ff0000);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow-move 3s linear infinite;
}

@keyframes rainbow-move {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.effect-wave {
    color: var(--primary);
    animation: wave-text 2s ease-in-out infinite;
}

@keyframes wave-text {
    0%, 100% { transform: rotate(var(--rotation, 0deg)) translateY(0); }
    50% { transform: rotate(var(--rotation, 0deg)) translateY(-5px); }
}

/* Image Border Styles */
.img-border-simple {
    border: 3px solid var(--primary);
    border-radius: var(--radius-lg);
}

.img-border-shadow {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-lg);
}

.img-border-fancy {
    border: 4px solid transparent;
    border-image: linear-gradient(135deg, #667eea, #764ba2, #f093fb) 1;
    padding: 4px;
}

/* Style Picker for Properties */
.style-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.style-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border: 2px solid var(--light-dark);
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

/* Filter Buttons */
.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.filter-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--light);
    border: 1px solid var(--light-dark);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

/* ===========================================
   STATS COMPONENT
   =========================================== */
.stats-wrapper {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.75rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
}

.stats-cards .stat-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 80px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.stats-minimal .stat-item {
    border-right: 1px solid #e2e8f0;
    padding: 0 1rem;
}

.stats-minimal .stat-item:last-child {
    border-right: none;
}

.stats-highlight .stat-item {
    background: var(--stats-color, #6366F1);
    color: white;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    min-width: 80px;
}

.stats-highlight .stat-number,
.stats-highlight .stat-label {
    color: white;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--stats-color, #6366F1);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ===========================================
   ICON BOX COMPONENT
   =========================================== */
.iconbox-wrapper {
    padding: 1rem;
}

.iconbox-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--iconbox-color, #6366F1);
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

.iconbox-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.iconbox-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.iconbox-content {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

/* ===========================================
   TABLE OF CONTENTS COMPONENT
   =========================================== */
.toc-wrapper {
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
}

.toc-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #6366F1;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    display: flex;
    align-items: center;
    padding: 0.375rem 0;
    font-size: 0.8rem;
}

.toc-text {
    color: #334155;
    flex-shrink: 0;
}

.toc-dots .toc-dots-line {
    flex: 1;
    border-bottom: 1px dotted #cbd5e1;
    margin: 0 0.5rem;
    min-width: 20px;
}

.toc-dots .toc-item .toc-dots {
    flex: 1;
    border-bottom: 1px dotted #cbd5e1;
    margin: 0 0.5rem;
    min-width: 20px;
}

.toc-page {
    font-weight: 600;
    color: #6366F1;
    flex-shrink: 0;
}

.toc-arrows .toc-item::before {
    content: '→';
    margin-right: 0.5rem;
    color: #6366F1;
}

.toc-arrows .toc-dots {
    display: none;
}

.toc-bullets .toc-item::before {
    content: '•';
    margin-right: 0.5rem;
    color: #6366F1;
    font-size: 1.2em;
}

.toc-bullets .toc-dots {
    display: none;
}

/* ===========================================
   SEPARATOR COMPONENT
   =========================================== */
.separator-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
    color: var(--separator-color, #6366F1);
}

.separator-pattern {
    font-size: 1rem;
    letter-spacing: 0.5em;
    opacity: 0.7;
}

.separator-ornament .separator-pattern {
    font-size: 1.25rem;
    letter-spacing: 0.25em;
}

.separator-line::before,
.separator-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: 0.3;
    margin: 0 0.5rem;
}

.separator-double {
    flex-direction: column;
    gap: 3px;
}

.separator-double::before,
.separator-double::after {
    content: '';
    width: 60%;
    height: 1px;
    background: currentColor;
    opacity: 0.3;
}
