/* Inline Editor CSS */
/* Main Editor Styles */

[x-cloak] {
    display: none !important;
}

/* Loading States */
.editor-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.editor-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3182ce;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Edit Mode Styles */
body.edit-mode {
    cursor: crosshair;
}

body.edit-mode .editable-block {
    position: relative;
    transition: all 0.2s ease;
    cursor: pointer;
}

body.edit-mode .editable-block:hover {
    background-color: rgba(59, 130, 246, 0.05) !important;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
    border-radius: 4px;
}

body.edit-mode .editable-block:focus {
    outline: 2px solid #3b82f6 !important;
    outline-offset: 2px;
    background-color: rgba(59, 130, 246, 0.1) !important;
}

/* Active Block Styles */
.active-block {
    outline: 2px dashed #4299e1 !important;
    position: relative;
    background-color: rgba(66, 153, 225, 0.05) !important;
}

.active-block:hover {
    outline: 2px dashed #2b6cb0 !important;
    background-color: rgba(66, 153, 225, 0.1) !important;
}

/* Editing Active Styles */
.editing-active {
    outline: 2px solid #3182ce !important;
    background-color: rgba(66, 153, 225, 0.15) !important;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.2);
    min-height: 1em;
    border-radius: 4px;
}

/* Block Controls */
.block-controls {
    position: absolute;
    top: -35px;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 10;
}

.active-block .block-controls {
    display: block;
}

.block-controls-toolbar {
    display: flex;
    gap: 4px;
}

.block-controls button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #718096;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.block-controls button:hover {
    background: #f7fafc;
    color: #2d3748;
}

/* Edit Gear Icon */
.edit-gear-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #3182ce;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-size: 12px;
    border: none;
    transition: all 0.2s;
}

.edit-gear-icon:hover {
    background-color: #2c5282;
    transform: scale(1.1);
}

/* Style Panel */
.style-panel {
    position: absolute;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 250px;
    z-index: 100;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.style-panel-header {
    background-color: #3182ce;
    color: white;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
}

.style-panel-content {
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
}

.enhanced-style-panel {
    max-height: 600px;
    overflow-y: auto;
}

.style-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.style-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.style-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
}

.style-option {
    margin-bottom: 12px;
}

.style-option label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 500;
}

.style-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.style-button {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.style-button:hover {
    transform: translateY(-1px);
}

#save-style {
    background-color: #3182ce;
    color: white;
}

#save-style:hover {
    background-color: #2c5282;
}

#cancel-style {
    background-color: #e2e8f0;
    color: #4a5568;
}

#cancel-style:hover {
    background-color: #cbd5e0;
}

/* Color Controls */
.color-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.color-input {
    width: 50px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    cursor: pointer;
}

.color-hex-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 14px;
}

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

.color-preset {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-preset:hover {
    border-color: #3182ce;
    transform: scale(1.1);
}

.bg-transparent-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #718096;
    transition: all 0.2s;
}

.bg-transparent-btn:hover,
.bg-transparent-btn.active {
    background: #f7fafc;
    color: #2d3748;
    border-color: #3182ce;
}

/* Font Controls */
.style-range {
    width: 100%;
    margin: 8px 0;
}

.font-size-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.font-size-preset {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: all 0.2s;
}

.font-size-preset:hover,
.font-size-preset.active {
    background: #3182ce;
    color: white;
    border-color: #3182ce;
}

.button-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.style-option-btn {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.style-option-btn:hover,
.style-option-btn.active {
    background: #3182ce;
    color: white;
    border-color: #3182ce;
}

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

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

/* Context Menu */
.context-menu {
    max-width: 280px;
    transform-origin: top left;
}

.context-menu-item {
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: #f7fafc;
}

.context-menu-item.danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

.context-menu-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

/* Notification Styles */
.notification-container {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
}

.notification-container.position-top-right {
    top: 80px;
    right: 20px;
}

.notification-container.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.notification {
    pointer-events: auto;
    margin-bottom: 12px;
    min-width: 300px;
    max-width: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.notification-enter {
    opacity: 0;
    transform: translateX(100%);
}

.notification-show {
    opacity: 1 !important;
    transform: translateX(0) !important;
    transition: all 0.3s ease;
}

.notification-exit {
    opacity: 0 !important;
    transform: translateX(100%) !important;
    transition: all 0.3s ease;
}

.notification-content {
    display: flex;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
}

.notification-icon {
    flex-shrink: 0;
    font-size: 18px;
}

.notification-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.notification-close:hover {
    background: #f7fafc;
    color: #2d3748;
}

.notification-progress {
    height: 3px;
    background: #f7fafc;
}

.notification-progress-bar {
    height: 100%;
    background: #3182ce;
    animation: progress linear;
    transform-origin: left;
}

@keyframes progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* Notification Types */
.notification-success .notification-icon {
    color: #059669;
}

.notification-success .notification-progress-bar {
    background: #059669;
}

.notification-error .notification-icon {
    color: #dc2626;
}

.notification-error .notification-progress-bar {
    background: #dc2626;
}

.notification-warning .notification-icon {
    color: #d97706;
}

.notification-warning .notification-progress-bar {
    background: #d97706;
}

.notification-info .notification-icon {
    color: #2563eb;
}

/* Editor Toolbar */
.editor-toolbar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}

.main-edit-btn {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.main-edit-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.toolbox-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
    cursor: pointer;
}

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

.toolbox-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Section Management */
.edit-mode .page-section {
    position: relative;
    outline: 1px solid #e2e8f0;
    margin: 1rem 0;
    transition: all 0.3s;
}

.edit-mode .page-section:hover {
    outline: 1px solid #6366f1;
    background-color: rgba(99, 102, 241, 0.02);
}

.edit-mode .page-section::before {
    content: attr(data-section-id);
    position: absolute;
    top: -8px;
    left: 0;
    background: #6366f1;
    color: white;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 4px;
    z-index: 10;
}

.section-controls {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.edit-mode .section-controls {
    opacity: 1;
    visibility: visible;
}

.edit-mode .page-section:hover .section-controls {
    opacity: 1;
}

.section-ghost {
    opacity: 0.5;
    background: #f7fafc;
}

.section-handle {
    cursor: move;
}

/* Add Section Buttons */
.add-section-between {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.edit-mode .add-section-between {
    opacity: 1;
    visibility: visible;
}

.add-section-btn {
    transition: all 0.3s ease;
}

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

.quick-add-btn {
    transition: all 0.3s duration-300;
    border: none;
    cursor: pointer;
}

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

/* Modal Styles */
.modal-overlay {
    backdrop-filter: blur(4px);
}

.modal-container {
    transform: scale(0.95);
    transition: all 0.3s ease;
}

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

/* Sortable Drag & Drop */
.sortable-ghost {
    opacity: 0.5;
    background: #f3f4f6 !important;
}

.sortable-chosen {
    transform: rotate(2deg);
}

.sortable-drag {
    transform: rotate(5deg);
    z-index: 1000;
}

/* Admin Image Block */
.admin-image-block {
    position: relative;
}

.admin-image-block:hover {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .style-panel {
        width: 280px;
        max-width: 90vw;
    }

    .notification {
        min-width: 280px;
        max-width: 90vw;
    }

    .editor-toolbar {
        bottom: 15px;
        right: 15px;
    }

    .toolbox-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .style-panel {
        width: 260px;
    }

    .notification {
        min-width: 260px;
    }

    .color-presets {
        grid-template-columns: repeat(4, 1fr);
    }

    .font-size-presets {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in-out;
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.slide-out-right {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Focus Management for Accessibility */
*:focus {
    outline: 2px solid #3182ce;
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #3182ce;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Print Styles */
@media print {

    .edit-mode .editable-block,
    .active-block,
    .editing-active,
    .block-controls,
    .editor-toolbar,
    .style-panel,
    .notification-container,
    .add-section-between {
        display: none !important;
    }

    .edit-mode .page-section::before {
        display: none !important;
    }
}