/* Drag and Drop Page Builder Styles */

/* Page Builder Preview Mode */
.page-preview {
    padding: 20px;
    background: #f8f9fa;
    min-height: 100vh;
    position: relative;
}

.preview-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #007bff;
    position: relative;
}

.preview-header::before {
    content: "👁️ PREVIEW MODE";
    position: absolute;
    top: -12px;
    left: 20px;
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

.preview-content {
    background: white;
    min-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.page-preview .component {
    margin: 0;
    border: none;
}

/* Enhanced page builder styles */
.drag-drop-page-builder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: white;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.builder-header h2 {
    margin: 0;
    color: #333;
}

.builder-actions {
    display: flex;
    gap: 12px;
}

.builder-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Component Library Sidebar - Two Column Design */
.component-library {
    width: 450px;
    min-width: 450px;
    background: #ffffff !important;
    border-right: 1px solid #e9ecef;
    padding: 24px;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.component-library h3 {
    margin: 0 0 20px 0;
    color: var(--admin-primary, #3b82f6) !important;
    font-size: 20px;
    font-weight: 700;
    text-align: left;
    padding: 12px 0;
    border-bottom: 2px solid var(--admin-primary, #3b82f6);
}

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

.component-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff !important;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    min-height: 85px;
    justify-content: center;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.component-item:hover {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #3b82f6;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.15);
}

.component-item:active {
    cursor: grabbing;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.component-icon {
    font-size: 24px;
    width: auto;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.component-name {
    font-weight: 700;
    color: #000000 !important;
    font-size: 11px;
    line-height: 1.3;
    letter-spacing: 0.025em;
    text-shadow: none !important;
}

/* Main Canvas Area */
.builder-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f1f3f4;
    position: relative;
}

.drop-zone {
    flex: 1;
    margin: 24px;
    background: white;
    border: 3px dashed #dee2e6;
    border-radius: 16px;
    position: relative;
    overflow-y: auto;
    transition: all 0.3s ease;
    min-height: 600px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.02);
}

.drop-zone.drag-over {
    border-color: #007bff;
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
    border-style: solid;
    border-width: 3px;
    box-shadow: inset 0 0 20px rgba(0, 123, 255, 0.1);
}

.drop-zone.reordering {
    background-color: rgba(0, 123, 255, 0.02);
    border: 2px dashed rgba(0, 123, 255, 0.2);
}

.drop-zone.reordering .component-drop-zone {
    opacity: 0.8;
    background: rgba(0, 123, 255, 0.1);
    height: 40px;
    border: 2px dashed #007bff;
    margin: 20px 0;
    padding: 12px 0;
    border-radius: 6px;
}

/* Drop indicator styles */
.drop-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 123, 255, 0.15);
    border-radius: 6px;
    animation: pulse 1.5s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
    pointer-events: none;
}

.drop-text {
    font-size: 12px;
    color: #007bff;
    font-weight: 600;
    margin-bottom: 4px;
    pointer-events: none;
}

.drop-arrow {
    font-size: 16px;
    color: #007bff;
    animation: bounce 1s ease-in-out infinite;
    pointer-events: none;
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
    60% { transform: translateY(-2px); }
}

.empty-canvas {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
}

.empty-message {
    max-width: 400px;
}

.empty-message h3 {
    color: #495057;
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: 600;
}

.empty-message p {
    color: #6c757d;
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
}

.canvas-components {
    padding: 20px;
    min-height: 100%;
}

/* Drop zones hidden by default, shown during reordering */
.canvas-components .component-drop-zone {
    margin: 0;
    height: 0;
}

.canvas-components .drop-zone.reordering .component-drop-zone {
    margin: 20px 0;
    height: 40px;
}

.canvas-component {
    position: relative;
    margin: 12px 0;
    border: 2px solid transparent;
    border-radius: 8px;
    min-height: 40px;
    cursor: move;
    transition: all 0.2s ease, opacity 0.3s ease, transform 0.3s ease;
}

.canvas-component:hover {
    border-color: #007bff;
}

.canvas-component:hover .drag-handle {
    opacity: 1;
}

.canvas-component.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.canvas-component.selected .drag-handle {
    opacity: 1;
}

/* Drag handle styles */
.drag-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 123, 255, 0.8);
    color: white;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: grab;
    z-index: 12;
    opacity: 0;
    transition: opacity 0.2s ease;
    user-select: none;
    pointer-events: none;
}

.drag-handle:hover {
    background: rgba(0, 123, 255, 1);
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Component reorder drop zone styles - hidden by default */
.component-drop-zone {
    height: 0;
    margin: 0;
    background: transparent;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0;
    min-height: 0;
    position: relative;
    z-index: 10;
    padding: 0;
    overflow: hidden;
}

.component-drop-zone.active {
    height: 50px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    opacity: 1;
    box-shadow: 0 0 20px rgba(0, 123, 255, 0.7);
    margin: 24px 0;
    border: 3px dashed #ffffff;
    border-radius: 8px;
    padding: 12px 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.component-drop-zone.active::before {
    content: "Drop component here ↓";
    color: white;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    animation: pulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

/* Component being dragged - handled via inline styles now */

.component-controls {
    position: absolute;
    top: -35px;
    right: 0;
    display: flex;
    gap: 4px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.control-btn {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.control-btn:hover {
    background: #f8f9fa;
}

/* Component Editor */
.component-editor {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

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

.editor-header h4 {
    margin: 0;
    color: #333;
}

.editor-actions {
    display: flex;
    gap: 8px;
}

/* Modal Properties Panel - HIGHEST Z-INDEX */
.properties-modal {
    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: 99999 !important; /* HIGHEST z-index to appear above ALL elements */
    cursor: pointer; /* Show it's clickable to close */
}

.properties-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    cursor: default; /* Override parent cursor */
    position: relative;
    z-index: 100000 !important; /* Even higher than modal overlay */
}

/* Keep page builder header at normal level */
.page-builder-header {
    position: relative;
    z-index: 10; /* Normal level - modal will always be above */
}

/* Modal Header Styling */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e9ecef;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: #f8f9fa;
    color: #495057;
}

.modal-body {
    padding: 24px;
}

/* Enhanced Properties Panel Styling */
.panel-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.properties-panel h3 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.component-type-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.badge-icon {
    font-size: 16px;
}

.badge-text {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}

.property-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.property-section {
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    background: #fafbfc;
}

.section-title {
    margin: 0 0 16px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 8px;
}

.property-group {
    margin-bottom: 16px;
}

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

.property-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 13px;
}

.property-value {
    padding: 8px 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #6c757d;
    font-size: 13px;
    font-family: monospace;
}

.property-preview {
    padding: 12px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    max-height: 100px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.4;
}

.property-group input,
.property-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    color: #333;
    transition: all 0.2s ease;
}

.property-group input:focus,
.property-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    background: white;
    color: #333;
}

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

.color-input-group input[type="color"] {
    width: 50px;
    height: 36px;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
}

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

.alignment-buttons {
    display: flex;
    gap: 4px;
}

.align-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.align-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.align-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.action-btn.primary {
    background: #007bff;
    color: white;
}

.action-btn.primary:hover {
    background: #0056b3;
}

.action-btn.secondary {
    background: #6c757d;
    color: white;
}

.action-btn.secondary:hover {
    background: #545b62;
}

.action-btn.danger {
    background: #dc3545;
    color: white;
}

.action-btn.danger:hover {
    background: #c82333;
}

.no-selection {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-selection-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-selection h4 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 16px;
}

.no-selection p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.property-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    background: #fff;
    color: #333;
}

/* Ensure readable text in all states */
.property-group input:active,
.property-group input:focus-visible {
    background: #fff !important;
    color: #333 !important;
}

/* Placeholder styling */
.property-group input::placeholder {
    color: #6c757d;
    opacity: 0.8;
}

/* Webkit autofill fix */
.property-group input:-webkit-autofill,
.property-group input:-webkit-autofill:hover,
.property-group input:-webkit-autofill:focus,
.property-group input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    -webkit-text-fill-color: #333 !important;
}

/* Component Specific Styles */
.placeholder-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
    font-size: 16px;
}

.component-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.component-button:hover {
    background: #0056b3;
}

.component-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 100px;
    padding: 20px;
}

.component-container .placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    color: #6c757d;
    font-style: italic;
}

.component-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.component-three-column {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.component-two-column .column,
.component-three-column .column {
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    color: #6c757d;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Two-Column Responsive Design */
@media (max-width: 1200px) {
    .component-library {
        width: 280px;
    }

    .component-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .component-item {
        flex-direction: row;
        min-height: auto;
        padding: 12px 16px;
        text-align: left;
    }

    .component-name {
        font-size: 13px;
    }
}

@media (max-width: 992px) {
    .component-library {
        width: 260px;
    }

    .property-sections {
        gap: 16px;
    }

    .property-section {
        padding: 12px;
    }

    .properties-modal-content {
        width: 95%;
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    .builder-layout {
        flex-direction: column;
        height: auto;
    }

    .component-library {
        width: 100%;
        order: 2;
        max-height: 200px;
        padding: 16px;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    }

    .builder-canvas {
        order: 1;
        min-height: 600px;
    }

    .drop-zone {
        margin: 16px;
        min-height: 500px;
    }

    .component-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .component-item {
        padding: 10px;
        min-height: 60px;
    }

    .component-name {
        font-size: 11px;
    }

    .properties-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .property-sections {
        gap: 12px;
    }

    .action-buttons {
        flex-direction: row;
        gap: 8px;
    }

    .action-btn {
        flex: 1;
        padding: 8px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .component-grid {
        grid-template-columns: 1fr;
    }

    .component-item {
        flex-direction: row;
        text-align: left;
        min-height: 50px;
        padding: 8px 12px;
    }

    .component-icon {
        font-size: 18px;
        height: 20px;
    }

    .drop-zone {
        margin: 12px;
        min-height: 400px;
    }

    .empty-message h3 {
        font-size: 18px;
    }

    .empty-message p {
        font-size: 14px;
    }

    .properties-modal-content {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: none;
    }
}

/* Enhanced Page Builder Styles */
.enhanced-page-builder {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-builder-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10; /* Normal level - modal will always be above */
}

.page-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    position: relative;
    z-index: 20; /* Normal level - modal will always be above */
}

.form-group {
    display: flex;
    flex-direction: column;
    min-width: 180px;
}

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

.form-control {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.page-selector {
    min-width: 200px;
}

.btn {
    border-radius: 8px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
    /* Default to large size */
    padding: 20px 40px;
    font-size: 18px;
}

/* Button Size Classes */
.btn-small {
    padding: 8px 16px !important;
    font-size: 12px !important;
}

.btn-medium {
    padding: 12px 24px !important;
    font-size: 14px !important;
}

.btn-large {
    padding: 20px 40px !important;
    font-size: 18px !important;
}

.btn-xl {
    padding: 32px 64px !important;
    font-size: 24px !important;
}

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

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
    transform: translateY(-1px);
}

.btn-outline-secondary {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-outline-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
}

.btn-info {
    background: #0ea5e9;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background: #0284c7;
    transform: translateY(-1px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
}

.alert {
    padding: 16px 20px;
    margin: 20px 24px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    border-left: 4px solid;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: #ef4444;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #22c55e;
}

.page-builder-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.expanded-builder-area {
    flex: 1;
    margin: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.page-preview {
    padding: 40px;
    min-height: 600px;
}

.page-preview h1 {
    margin-bottom: 24px;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 12px;
}

.preview-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-component {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.component-content {
    padding: 20px;
    line-height: 1.6;
}

/* Responsive Design for Enhanced Page Builder */
@media (max-width: 1024px) {
    .page-builder-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-info {
        flex-direction: column;
        gap: 16px;
    }
    
    .page-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .page-builder-header {
        padding: 16px;
    }
    
    .expanded-builder-area {
        margin: 16px;
    }
    
    .page-preview {
        padding: 20px;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        justify-content: center;
    }
}

/* Dark mode support for page builder */
@media (prefers-color-scheme: dark) {
    .drag-drop-page-builder {
        background: #0f172a;
        color: #e2e8f0;
    }
    
    .component-library {
        background: #1e293b;
        border-color: #334155;
    }
    
    .component-library h3 {
        color: #e2e8f0;
        background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        border-bottom-color: #334155;
    }
    
    .component-item {
        background: linear-gradient(135deg, #334155 0%, #475569 100%);
        border-color: #475569;
        color: #e2e8f0 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }
    
    .component-item:hover {
        background: linear-gradient(135deg, #3730a3 0%, #4338ca 100%);
        border-color: #6366f1;
        box-shadow: 0 8px 25px rgba(99, 102, 241, 0.25);
    }
    
    .component-name {
        color: #f1f5f9;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    }
    
    .page-component {
        background: #475569;
        border-color: #64748b;
        color: #e2e8f0 !important;
    }
    
    .component-preview {
        color: #e2e8f0 !important;
    }
    
    .canvas-header {
        background: #475569;
        border-color: #64748b;
        color: #e2e8f0;
    }
    
    .empty-canvas {
        color: #94a3b8;
    }
    
    .markdown-editor {
        background: #475569;
        color: #e2e8f0;
        border-color: #64748b;
    }
    
    .markdown-toolbar {
        background: #334155;
        border-bottom-color: #475569;
    }
    
    .toolbar-btn {
        background: #475569;
        color: #e2e8f0;
        border-color: #64748b;
    }
    
    .toolbar-btn:hover {
        background: #64748b;
        border-color: #94a3b8;
    }
    
    .properties-modal {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .properties-modal-content {
        background: #1e293b;
        color: #e2e8f0;
        border-color: #334155;
    }
    
    .modal-header {
        background: linear-gradient(135deg, #334155 0%, #475569 100%);
        border-bottom-color: #475569;
    }
    
    .modal-header h3 {
        color: #e2e8f0;
    }
    
    .property-section {
        background: #334155;
        border-color: #475569;
    }
    
    .section-title {
        color: #e2e8f0;
    }
    
    .property-group label {
        color: #cbd5e1;
    }
    
    .property-group input,
    .property-group select,
    .property-group textarea {
        background: #475569;
        color: #e2e8f0;
        border-color: #64748b;
    }
    
    .property-group input:focus,
    .property-group select:focus,
    .property-group textarea:focus {
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }
    
    .align-btn {
        background: #475569;
        color: #e2e8f0;
        border-color: #64748b;
    }
    
    .align-btn:hover {
        background: #64748b;
    }
    
    .align-btn.active {
        background: #6366f1;
        color: white;
    }
    
    .alignment-buttons {
        border-color: #64748b;
    }
    
    .property-preview {
        background: #475569;
        border-color: #64748b;
        color: #e2e8f0;
    }
    
    .action-btn.secondary {
        background: #64748b;
        color: #e2e8f0;
        border-color: #75859a;
    }
    
    .action-btn.secondary:hover {
        background: #75859a;
        border-color: #8b9bb0;
    }
    
    .action-btn.danger {
        background: #7f1d1d;
        color: #fca5a5;
        border-color: #991b1b;
    }
    
    .action-btn.danger:hover {
        background: #991b1b;
        border-color: #b91c1c;
    }
    
    .form-group label {
        color: #e2e8f0;
    }
    
    .form-control {
        background: #475569;
        color: #e2e8f0;
        border-color: #64748b;
    }
}

/* Enhanced Properties Panel Styles */
.properties-modal {
    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: 1000;
    backdrop-filter: blur(8px);
}

.properties-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    border: 1px solid #e2e8f0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.component-type-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-icon {
    font-size: 16px;
}

.badge-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #3b82f6;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: #64748b;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(248, 113, 113, 0.1);
    color: #ef4444;
}

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.property-sections {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.property-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.section-title {
    margin: 0 0 20px 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 2px;
}

.property-group {
    margin-bottom: 20px;
}

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

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

.property-group input,
.property-group select,
.property-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: #1f2937;
    transition: all 0.2s ease;
}

.property-group input:focus,
.property-group select:focus,
.property-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

.color-input-group input[type="color"] {
    width: 60px;
    height: 44px;
    padding: 2px;
    border-radius: 8px;
    cursor: pointer;
}

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

.alignment-buttons {
    display: flex;
    gap: 4px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.align-btn {
    flex: 1;
    padding: 12px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.align-btn:hover {
    background: #f3f4f6;
}

.align-btn.active {
    background: #3b82f6;
    color: white;
}

.checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-weight: normal !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    margin-bottom: 0 !important;
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin: 0 !important;
}

.opacity-value {
    margin-left: 12px;
    font-weight: 600;
    color: #3b82f6;
    font-size: 0.875rem;
}

.property-preview {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    min-height: 100px;
    max-height: 200px;
    overflow: auto;
}

.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.action-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.action-btn.secondary {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.action-btn.secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.action-btn.danger {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.action-btn.danger:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Live Edit Mode Styles */
.live-edit-mode {
    position: relative;
}

.live-edit-mode .canvas-component {
    position: relative;
    transition: all 0.2s ease;
}

.live-edit-mode .canvas-component:not(.selected):not(:hover) {
    opacity: 0.7;
    filter: grayscale(20%);
}

.live-edit-mode .canvas-component.selected {
    border: 3px solid #007bff !important;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25) !important;
    opacity: 1 !important;
    filter: none !important;
    z-index: 1000 !important;
    position: relative;
}

.live-edit-mode .canvas-component:hover:not(.selected) {
    border: 2px solid #17a2b8 !important;
    box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.15) !important;
    opacity: 0.9 !important;
    filter: grayscale(10%) !important;
    cursor: pointer !important;
}

/* Live edit selection indicator */
.live-edit-mode .canvas-component.selected::before {
    content: "✓ Selected";
    position: absolute;
    top: -25px;
    left: 0;
    background: #007bff;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1001;
    white-space: nowrap;
}

/* Live edit hover indicator */
.live-edit-mode .canvas-component:hover:not(.selected)::before {
    content: "Click to select";
    position: absolute;
    top: -25px;
    left: 0;
    background: #17a2b8;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    z-index: 999;
    white-space: nowrap;
}

/* Enhanced live edit system styles */
[data-live-editable="true"] {
    outline: 2px dashed rgba(0, 150, 255, 0.8) !important;
    outline-offset: -2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

[data-live-editable="true"]:hover {
    outline: 3px solid rgba(0, 150, 255, 1) !important;
    outline-offset: -3px !important;
    background-color: rgba(0, 150, 255, 0.05) !important;
}

[data-live-editable="true"].selected {
    outline: 3px solid #007bff !important;
    outline-offset: -3px !important;
    background-color: rgba(0, 123, 255, 0.1) !important;
}

[data-live-component-editable="true"] {
    outline: 2px dashed rgba(0, 150, 255, 0.6) !important;
    outline-offset: -2px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

[data-live-component-editable="true"]:hover {
    outline: 2px solid rgba(0, 150, 255, 0.9) !important;
    outline-offset: -2px !important;
    background-color: rgba(0, 150, 255, 0.03) !important;
}

[data-live-component-editable="true"].selected {
    outline: 3px solid #007bff !important;
    outline-offset: -3px !important;
    background-color: rgba(0, 123, 255, 0.08) !important;
}

/* Prevent selection conflicts */
.live-edit-mode .canvas-component * {
    pointer-events: none;
}

.live-edit-mode .canvas-component {
    pointer-events: all;
}