* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body, html {
            width: 100%;
            min-height: 100%;
            font-family: 'Inter', sans-serif;
            background: #282828;
            color: #ffffff;
            height: 100vh;
            overflow: hidden;
        }

        .app-layout {
            display: flex;
            height: 100vh;
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            margin-left: 250px;
            position: relative;
            z-index: 1;
        }

        .top-bar {
            padding: 24px 40px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .top-bar h2 {
            font-size: 24px;
            font-weight: 600;
            color: #fff;
        }

        .top-bar-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .preview-button {
            padding: 10px 20px;
            font-size: 14px;
            font-weight: 600;
            color: #fff;
            background: transparent;
            border: 1px solid rgba(255,255,255,0.4);
            border-radius: 8px;
            cursor: pointer;
            font-family: inherit;
            transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
        }

        .preview-button:hover:not(:disabled) {
            background: rgba(255,255,255,0.08);
            border-color: rgba(255,255,255,0.6);
        }

        .preview-button:disabled {
            opacity: 0.45;
            cursor: not-allowed;
            border-color: rgba(255,255,255,0.2);
        }

        /* Create form page title alignment with checkboxes */
        .create-form-page .top-bar h2 {
            margin-left: -6px; /* Adjust to align with checkbox column */
            margin-top: -6px; /* Move title up by 2px */
        }

        /* Create widget page title alignment with checkboxes */
        .create-widget-page .top-bar h2 {
            margin-left: -6px; /* Adjust to align with checkbox column */
            margin-top: -6px; /* Move title up by 2px */
        }

        .content-wrapper {
            display: flex;
            flex: 1;
            overflow: hidden;
            position: relative;
            z-index: 1;
        }

        /* Toolbar */
        .toolbar {
            width: 280px;
            background: rgba(255,255,255,0.02);
            border-right: 1px solid rgba(255,255,255,0.1);
            padding: 24px;
            padding-bottom: 60px;
            overflow-y: auto;
            position: relative;
            z-index: 20;
        }

        .toolbar-section {
            margin-bottom: 32px;
        }

        .toolbar-section h3 {
            font-size: 12px;
            font-weight: 600;
            color: #9ca3af;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 16px;
        }

        .header-inputs {
            margin-bottom: 24px;
        }

        .header-inputs .form-group {
            margin-bottom: 16px;
        }

        .header-inputs label {
            display: block;
            margin-bottom: 8px;
            color: #9ca3af;
            font-size: 13px;
            font-weight: 500;
        }

        .header-inputs input {
            width: 100%;
            padding: 10px;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 6px;
            color: #fff;
            font-size: 14px;
            font-family: 'Inter', sans-serif;
        }

        .header-inputs input:focus {
            outline: none;
            border-color: rgba(255,255,255,0.3);
            background: rgba(255,255,255,0.08);
        }

        /* Toolbar dropdowns (e.g. Verification) – full width, match form settings UI */
        .header-inputs .custom-select {
            position: relative;
            display: block;
            width: 100%;
        }
        .header-inputs .custom-select select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            width: 100%;
            padding: 10px 36px 10px 12px;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 6px;
            color: #fff;
            font-size: 14px;
            font-family: 'Inter', sans-serif;
            cursor: pointer;
            transition: border-color 0.15s ease, background 0.15s ease;
        }
        .header-inputs .custom-select select:hover {
            border-color: rgba(255,255,255,0.2);
            background: rgba(255,255,255,0.08);
        }
        .header-inputs .custom-select select:focus {
            outline: none;
            border-color: rgba(255,255,255,0.3);
            background: rgba(255,255,255,0.08);
        }
        .header-inputs .custom-select::after {
            content: '';
            position: absolute;
            top: 50%;
            right: 12px;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-left: 5px solid transparent;
            border-right: 5px solid transparent;
            border-top: 5px solid #9ca3af;
            pointer-events: none;
        }
        .header-inputs .custom-select select option {
            background: #1f2937;
            color: #fff;
        }

        .submit-align-selector {
            display: flex;
            gap: 0;
            border-radius: 6px;
            overflow: hidden;
            border: 1px solid rgba(255,255,255,0.1);
            background: rgba(255,255,255,0.05);
            width: 100%;
        }
        .submit-align-selector .submit-align-btn {
            flex: 1;
            padding: 10px 14px;
            font-size: 13px;
            font-weight: 500;
            color: #9ca3af;
            background: transparent;
            border: none;
            border-right: 1px solid rgba(255,255,255,0.1);
            cursor: pointer;
            font-family: 'Inter', sans-serif;
            transition: background 0.15s ease, color 0.15s ease;
        }
        .submit-align-selector .submit-align-btn:last-child {
            border-right: none;
        }
        .submit-align-selector .submit-align-btn:hover {
            color: #fff;
            background: rgba(255,255,255,0.08);
        }
        .submit-align-selector .submit-align-btn.active {
            color: #fff;
            background: rgba(255,255,255,0.15);
        }

        .header-align-selector {
            display: flex;
            gap: 0;
            border-radius: 6px;
            overflow: hidden;
            border: 1px solid rgba(255,255,255,0.1);
            background: rgba(255,255,255,0.05);
            width: 100%;
        }
        .header-align-selector .header-align-btn {
            flex: 1;
            padding: 10px 14px;
            font-size: 13px;
            font-weight: 500;
            color: #9ca3af;
            background: transparent;
            border: none;
            border-right: 1px solid rgba(255,255,255,0.1);
            cursor: pointer;
            font-family: 'Inter', sans-serif;
            transition: background 0.15s ease, color 0.15s ease;
        }
        .header-align-selector .header-align-btn:last-child {
            border-right: none;
        }
        .header-align-selector .header-align-btn:hover {
            color: #fff;
            background: rgba(255,255,255,0.08);
        }
        .header-align-selector .header-align-btn.active {
            color: #fff;
            background: rgba(255,255,255,0.15);
        }

        .notifications-selector {
            display: flex;
            gap: 0;
            border-radius: 6px;
            overflow: hidden;
            border: 1px solid rgba(255,255,255,0.1);
            background: rgba(255,255,255,0.05);
            width: 100%;
        }
        .notifications-selector .notifications-btn {
            flex: 1;
            padding: 10px 14px;
            font-size: 13px;
            font-weight: 500;
            color: #9ca3af;
            background: transparent;
            border: none;
            border-right: 1px solid rgba(255,255,255,0.1);
            cursor: pointer;
            font-family: 'Inter', sans-serif;
            transition: background 0.15s ease, color 0.15s ease;
        }
        .notifications-selector .notifications-btn:last-child {
            border-right: none;
        }
        .notifications-selector .notifications-btn:hover {
            color: #fff;
            background: rgba(255,255,255,0.08);
        }
        .notifications-selector .notifications-btn.active {
            color: #fff;
            background: rgba(255,255,255,0.15);
        }

        .draggable-module {
            padding: 16px;
            background: rgba(255,255,255,0.05);
            border: 2px dashed rgba(255,255,255,0.2);
            border-radius: 8px;
            cursor: grab;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 12px;
            position: relative;
        }

        .draggable-module:hover {
            background: rgba(255,255,255,0.08);
            border-color: rgba(255,255,255,0.4);
            transform: translateY(-2px);
        }

        .draggable-module:active {
            cursor: grabbing;
            transform: translateY(0);
        }

        .draggable-module.disabled {
            opacity: 0.5;
            cursor: not-allowed;
            background: rgba(255,255,255,0.02);
            border-color: rgba(255,255,255,0.1);
        }

        .draggable-module.disabled:hover {
            background: rgba(255,255,255,0.02);
            border-color: rgba(255,255,255,0.1);
            transform: none;
        }

        .draggable-module.disabled:active {
            cursor: not-allowed;
            transform: none;
        }

        .draggable-module.already-added {
            opacity: 0.4;
            cursor: not-allowed;
            background: rgba(255,255,255,0.02);
            border-color: rgba(34,197,94,0.3);
            pointer-events: none;
            position: relative;
        }

        .draggable-module.already-added::after {
            content: '';
            position: absolute;
            top: 50%;
            right: 12px;
            transform: translateY(-50%);
            width: 8px;
            height: 8px;
            background: #22c55e;
            border-radius: 50%;
            box-shadow: 0 0 8px rgba(34,197,94,0.6);
        }

        .details-container {
            position: relative;
            border: 2px dashed rgba(255,255,255,0.2);
            border-radius: 8px;
            padding: 0;
            margin-bottom: 32px;
            width: 100%;
        }

        .details-container .draggable-module {
            width: 100%;
            margin-left: 0;
            margin-right: 0;
        }

        .details-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(40, 40, 40, 0.7);
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            z-index: 10;
            pointer-events: none;
        }

        .details-container.has-media .details-overlay {
            display: none;
        }

        .details-container.has-media {
            border: none;
        }

        .survey-container {
            position: relative;
            border: 2px dashed rgba(255,255,255,0.2);
            border-radius: 8px;
            padding: 0;
            margin-bottom: 32px;
            width: 100%;
        }

        .survey-container .draggable-module {
            width: 100%;
            margin-left: 0;
            margin-right: 0;
        }

        .survey-overlay {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(40, 40, 40, 0.7);
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            font-size: 14px;
            font-weight: 500;
            z-index: 10;
            pointer-events: none;
        }

        .survey-option-builder {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: -5px;
            min-width: 0;
        }
        .survey-option-builder .survey-option-input {
            flex: 1;
            min-width: 0;
            padding: 6px 10px;
            font-size: 13px;
            background: #ffffff;
            border: 1px solid rgba(0,0,0,0.12);
            border-radius: 6px;
            color: #000000;
            font-family: 'Inter', sans-serif;
        }
        .survey-option-builder .survey-option-input:focus {
            outline: none;
            border-color: rgba(0,0,0,0.4);
            background: #ffffff;
            color: #000000;
        }
        .survey-option-builder .survey-option-remove {
            flex-shrink: 0;
            width: 24px;
            height: 24px;
            padding: 0;
            border: none;
            border-radius: 4px;
            background: rgba(239,68,68,0.2);
            color: #f87171;
            font-size: 16px;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .survey-option-builder .survey-option-remove:hover {
            background: rgba(239,68,68,0.35);
        }
        .survey-option-add {
            margin-top: 8px;
            padding: 6px 12px;
            font-size: 13px;
            color: #9ca3af;
            background: transparent;
            border: 1px dashed rgba(255,255,255,0.2);
            border-radius: 6px;
            cursor: pointer;
            font-family: 'Inter', sans-serif;
        }

        .survey-container.has-media .survey-overlay {
            display: none;
        }

        .survey-container.has-media {
            border: none;
        }

        .module-icon {
            font-size: 24px;
        }

        .module-text h4 {
            font-size: 14px;
            font-weight: 600;
            color: #fff;
            margin-bottom: 4px;
        }

        .module-text p {
            font-size: 12px;
            color: #9ca3af;
        }

        /* Preview Area */
        .preview-area {
            flex: 1;
            padding: 40px;
            overflow-y: auto;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            background: #ffffff;
            scroll-behavior: smooth;
        }

        .preview-container {
            background: transparent;
            width: 100%;
            max-width: 650px;
            margin-bottom: 10rem;
            position: relative;
        }

        .preview-header {
            padding: 0;
            background: #FFFFFF;
            color: #000000;
            border-bottom: none;
            display: flex;
            flex-direction: column;
            gap: 0;
            position: relative;
            z-index: 10;
        }

        .preview-header-title {
            padding: 0.75rem 2rem 1rem 2rem;
            background: #282828;
            color: #FFFFFF;
        }

        .preview-header-title h1 {
            font-size: 1.25rem;
            font-weight: 600;
            color: #FFFFFF;
            margin: 0;
            letter-spacing: 1px;
            text-align: center;
            text-transform: uppercase;
        }

        .preview-header-content {
            padding: 2.5rem 2rem 2rem 2rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.5rem;
            background: #FFFFFF;
            text-align: center;
            position: relative;
        }

        .remove-header-btn {
            position: absolute;
            top: 2.5rem;
            right: 2rem;
            background: #f8f8f8;
            border: 2px solid #e0e0e0;
            color: #666666;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            padding: 0;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.2s ease;
            opacity: 0;
            line-height: 1;
            z-index: 10;
        }

        .preview-header-content:hover .remove-header-btn {
            opacity: 1;
        }

        .remove-header-btn:hover {
            background: #ff4444;
            border-color: #ff4444;
            color: #ffffff;
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(255, 68, 68, 0.2);
        }

        .preview-company-info {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
        }

        .preview-company-info h2 {
            font-size: 1.5rem;
            font-weight: 700;
            color: #000000;
            margin: 0 0 0.5rem 0;
            letter-spacing: -0.02em;
        }

        .preview-company-info p {
            font-size: 0.875rem;
            color: #6B7280;
            margin: 0;
            line-height: 1.5;
        }

        .form-card .card-body.card-body-dropzone {
            position: relative;
        }

        .form-card .card-body {
            min-height: 120px;
            position: relative;
        }

        /* Editor: verification block is a direct child of #dropZone (sibling of .survey-section),
           so give it the same horizontal padding as .survey-section content for alignment */
        #dropZone > .survey-verification-wrap {
            padding-left: 2rem;
            padding-right: 2rem;
        }

        /* Newsletter opt-in preview (aligned with verification; matches public view-form look) */
        #dropZone > .newsletter-optin-row {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin: 1.25rem 2rem 0;
            padding: 1rem 1.25rem;
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            cursor: pointer;
            box-sizing: border-box;
            max-width: calc(100% - 4rem);
        }
        #dropZone > .newsletter-optin-row:hover {
            background: #f1f5f9;
            border-color: #cbd5e1;
        }
        #dropZone > .newsletter-optin-row input[type="checkbox"] {
            width: 1.25rem;
            height: 1.25rem;
            min-width: 1.25rem;
            min-height: 1.25rem;
            margin: 0;
            cursor: pointer;
            accent-color: #000000;
            flex-shrink: 0;
        }
        #dropZone > .newsletter-optin-row span {
            font-size: 0.9375rem;
            font-weight: 500;
            color: #111827;
            line-height: 1.4;
            flex: 1;
        }

        .drop-zone {
            border: 2px dashed #d1d5db;
            border-radius: 8px;
            padding: 32px 24px;
            background: #f9fafb;
            transition: all 0.2s ease;
            min-height: 80px;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            margin-top: 0.5rem;
        }

        /* Offset for empty drop zone when header is present */
        #dropZone:not(.no-header) .drop-zone {
            margin-top: 0rem;
        }

        /* Offset for empty drop zone when no header */
        #dropZone.no-header .drop-zone {
            margin-top: 0rem;
        }

        .drop-zone::before {
            content: 'Drop a Block';
            font-size: 14px;
            color: #000000;
            font-weight: 500;
            text-align: center;
            width: 100%;
            display: block;
        }

        .drop-zone.drag-over {
            background: #F0F0F0;
            border-color: #CCCCCC;
        }

        .drop-zone.drag-over::before {
            color: #000000;
        }

        /* Show drop zone when empty (fresh load or after deleting all content) */
        #dropZone:empty .drop-zone,
        #dropZone .drop-zone:only-child {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            text-align: center !important;
        }

        /* 2-column row in builder - minmax(0,1fr) lets columns shrink below content size */
        .form-column-row {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            gap: 1rem;
            margin-bottom: 1.5rem;
            padding: 0.5rem;
            /* Remove solid grey fill so editor UI doesn't sit on top of controls */
            background: transparent;
            border-radius: 8px;
            border: 1px dashed rgba(0,0,0,0.15);
        }

        .form-column-row .form-column {
            min-width: 0;
            /* Allow toolbars to float above questions vertically without being clipped,
               while still constraining content horizontally inside the column. */
            overflow-x: hidden;
            overflow-y: visible;
            min-height: 48px;
            border-radius: 6px;
            border: 1px dashed rgba(0,0,0,0.2);
            padding: 8px;
            transition: background 0.15s ease, border-color 0.15s ease;
        }

        .form-column-row .form-column.drag-over-col {
            background: rgba(0,0,0,0.06);
            border-color: rgba(0,0,0,0.35);
        }

        .form-column-row .form-column .column-drop-zone {
            min-height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            color: #9ca3af;
            padding: 4px 0;
        }

        .form-column-row .form-column:not(:has(.survey-question)) .column-drop-zone {
            min-height: 48px;
        }

        .form-column-row .form-column .survey-question {
            margin-bottom: 1rem;
        }

        .form-column-row .form-column .survey-question:last-child {
            margin-bottom: 0;
        }

        /* In 2-column rows, move the builder toolbar below the question so it never covers the title. */
        .form-column-row .form-column .survey-question-toolbar {
            top: auto;
            bottom: -40px;
        }

        .form-column-row .form-column .survey-option-builder,
        .form-column-row .form-column .survey-option-builder .survey-option-input {
            min-width: 0;
        }

        .form-column-row .row-actions {
            grid-column: 1;
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 4px;
        }

        .form-column-row .row-arrow-btn {
            width: 24px;
            height: 24px;
            padding: 0;
            border: 1px solid rgba(0,0,0,0.15);
            border-radius: 4px;
            background: #fff;
            color: #6b7280;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .form-column-row .row-arrow-btn:hover:not(:disabled) {
            background: #f5f5f5;
            border-color: rgba(0,0,0,0.25);
            color: #000;
        }

        .form-column-row .row-arrow-btn:disabled {
            opacity: 0.35;
            cursor: not-allowed;
            color: #bbb;
        }

        .form-column-row .row-arrow-btn svg {
            width: 12px;
            height: 12px;
        }

        .form-column-row .row-remove-btn {
            grid-column: 2;
            justify-self: end;
            margin-top: 4px;
            padding: 4px 10px;
            font-size: 12px;
            color: #9ca3af;
            background: transparent;
            border: none;
            cursor: pointer;
            border-radius: 4px;
        }

        .form-column-row .row-remove-btn:hover {
            color: #ef4444;
            background: rgba(239,68,68,0.1);
        }

        /* Reorder drop indicator – shows where the module will land when dragging */
        .survey-reorder-indicator {
            position: absolute;
            left: 0;
            height: 4px;
            pointer-events: none;
            z-index: 20;
            border-radius: 2px;
            background: #282828;
            box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(0,0,0,0.2);
            opacity: 0;
            transform: scaleX(0.98);
            transition: opacity 0.12s ease, transform 0.12s ease;
        }

        .survey-reorder-indicator.survey-reorder-indicator-visible {
            opacity: 1;
            transform: scaleX(1);
        }

        /* Hide drop zone when content is present */
        #dropZone:not(:empty) .drop-zone {
            display: none !important;
        }

        /* Ensure drop zone is visible when no media items or surveys are present */
        #dropZone:not(:has(.media-item)):not(:has(.survey-section)) .drop-zone {
            display: flex !important;
            align-items: center !important;
            justify-content: center !important;
            text-align: center !important;
        }

        .top-drop-zone {
            padding: 8px;
            margin-bottom: 16px;
            border-bottom: 2px solid transparent;
            transition: all 0.2s ease;
            text-align: center;
            pointer-events: auto;
            display: none !important;
        }

        .top-drop-zone.drag-over {
            border-bottom-color: #000000;
            border-bottom-width: 3px;
        }

        .top-drop-indicator {
            font-size: 0.75rem;
            color: transparent;
            font-weight: 600;
            pointer-events: none;
        }

        .top-drop-zone.drag-over .top-drop-indicator {
            color: transparent;
        }

        .bottom-drop-zone {
            padding: 8px;
            margin-top: -2rem;
            padding-top: 2rem;
            transition: all 0.2s ease;
            text-align: center;
            pointer-events: auto;
        }

        .bottom-drop-indicator {
            font-size: 0.75rem;
            color: #999999;
            font-weight: 600;
            pointer-events: none;
        }

        .bottom-drop-zone.drag-over .bottom-drop-indicator {
            color: #000000;
        }
        
        /* Make the last media item's border black when bottom drop zone is active */
        .media-item.bottom-drop-active {
            border-bottom-color: #000000 !important;
            border-bottom-width: 3px !important;
        }


        /* Media Items */
        .media-item {
            margin-bottom: 2rem;
            padding-bottom: 2rem;
            border-bottom: 2px solid #E0E0E0;
            position: relative;
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                        opacity 0.3s ease,
                        box-shadow 0.3s ease,
                        border-color 0.2s ease;
            transform-origin: center;
        }

        /* Add proper offset for the first media item to create hard line boundary */
        .preview-card-body .media-item:first-child {
            margin-top: 0;
            border-top: none;
            padding-top: 0;
        }

        #dropZone.no-header {
            padding-top: 2rem;
        }

        /* Add hard line boundary when no header but has content */
        #dropZone.no-header:not(:empty) {
            border-top: 2px solid #E0E0E0;
            padding-top: 1.5rem;
        }

        /* Match view page: no extra padding when header present (header padding provides gap) */
        #dropZone:not(:empty) {
            padding-top: 0;
        }

        /* Single line between header and form (survey-section provides it; no extra border here) */
        #dropZone:not(.no-header):not(:empty) {
            padding-top: 0;
        }

        /* Hard boundary - prevent any content from going above the disclosure header */
        #dropZone {
            position: relative;
            z-index: 1;
        }

        #dropZone::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 0;
            background: transparent;
            z-index: 1000;
            pointer-events: none;
        }

        .media-item:last-child {
            margin-bottom: 0;
            padding-bottom: 0;
            border-bottom: none;
        }

        .media-item:hover::before {
            content: '';
            position: absolute;
            top: -12px;
            left: -12px;
            right: -12px;
            bottom: calc(2rem - 12px);
            border: 2px solid #cccccc;
            border-radius: 8px;
            pointer-events: none;
        }

        .media-item:focus::before {
            content: '';
            position: absolute;
            top: -12px;
            left: -12px;
            right: -12px;
            bottom: calc(2rem - 12px);
            border: 2px solid #000000;
            border-radius: 8px;
            pointer-events: none;
        }

        .media-item.selected::before {
            content: '';
            position: absolute;
            top: -12px;
            left: -12px;
            right: -12px;
            bottom: calc(2rem - 12px);
            border: 2px solid #000000;
            border-radius: 8px;
            pointer-events: none;
        }

        .media-item.detail-hover::before {
            content: '';
            position: absolute;
            top: -12px;
            left: -12px;
            right: -12px;
            bottom: calc(2rem - 12px);
            border: 2px solid #cccccc;
            border-radius: 8px;
            pointer-events: none;
        }

        .media-item:last-child:hover::before,
        .media-item:last-child:focus::before,
        .media-item:last-child.selected::before,
        .media-item:last-child.detail-hover::before {
            bottom: -12px;
        }

        /* Selected takes priority over hover */
        .media-item.selected:hover::before {
            border-color: #000000;
        }

        .media-label {
            font-size: 0.6875rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1.5px;
            color: #666666;
            margin-bottom: 0.75rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
        }

        .media-label span:nth-child(2) {
            margin-left: 0;
            text-align: left;
        }

        .media-arrows {
            display: flex;
            flex-direction: row;
            gap: 8px;
            margin-right: 12px;
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .media-item:hover .media-arrows {
            opacity: 1;
        }

        .media-arrow-btn {
            background: #f8f8f8;
            border: 2px solid #ddd;
            cursor: pointer;
            color: #666;
            font-size: 14px;
            line-height: 1;
            padding: 0;
            transition: all 0.15s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            width: 32px;
            height: 32px;
            font-weight: bold;
        }

        .media-arrow-btn:hover:not(:disabled) {
            color: #000000;
            background: #e8e8e8;
            border-color: #999;
            transform: scale(1.05);
        }

        .media-arrow-btn:active:not(:disabled) {
            background: #d0d0d0;
            transform: scale(0.95);
        }

        .media-arrow-btn:disabled {
            opacity: 0.3;
            cursor: not-allowed;
            background: #f8f8f8;
            border-color: #eee;
            color: #ccc;
            transform: none;
        }

        .media-item.dragging {
            opacity: 0.4;
            transform: scale(0.95) rotate(2deg);
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
            z-index: 1000;
            background: #ffffff;
            border-radius: 8px;
        }

        .media-item.drag-over-bottom {
            border-bottom-color: #000000;
            border-bottom-width: 3px;
        }
        
        .media-item.dragging {
            opacity: 0.4;
            border-bottom-color: transparent;
        }

        .media-item.will-move-down {
            transform: translateY(50px);
        }

        .media-item.will-move-up {
            transform: translateY(-50px);
        }

        .media-preview-container {
            width: 100%;
            margin-bottom: 1rem;
            border-radius: 8px;
            overflow: hidden;
            background: transparent;
            border: none;
        }

        .media-preview-container img {
            width: 100%;
            height: auto;
            display: block;
            max-height: 70vh;
            object-fit: contain;
            background: transparent;
        }

        .media-preview-container video {
            width: 100%;
            height: auto;
            display: block;
            max-height: 400px;
            background: transparent;
        }

        .media-preview-container iframe {
            width: 100%;
            height: 315px;
            border: none;
            display: block;
        }

        .media-preview-placeholder {
            padding: 2rem;
            text-align: center;
            color: #9CA3AF;
            font-size: 0.875rem;
        }

        .remove-media-btn {
            background: #f8f8f8;
            border: 2px solid #e0e0e0;
            color: #666666;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            padding: 0;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.2s ease;
            opacity: 0;
            line-height: 1;
        }

        .media-item:hover .remove-media-btn {
            opacity: 1;
        }

        .remove-media-btn:hover {
            background: #ff4444;
            border-color: #ff4444;
            color: #ffffff;
            transform: scale(1.05);
            box-shadow: 0 2px 8px rgba(255, 68, 68, 0.2);
        }

        .remove-detail-btn {
            position: absolute;
            top: calc(0.875rem + 0.25rem + 9px + 0.5 * (9px + 0.875rem + 9px));
            right: 8px;
            background: #f8f8f8;
            border: 2px solid #e0e0e0;
            color: #666666;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            padding: 0;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: opacity 0.2s ease, transform 0.2s ease;
            opacity: 0;
            line-height: 1;
            min-width: 28px;
            min-height: 28px;
            z-index: 10;
            pointer-events: none;
            transform: translateY(-50%);
        }

        .detail-row:hover .remove-detail-btn {
            opacity: 1;
            pointer-events: auto;
        }


        .remove-detail-btn:hover {
            background: #ff4444;
            border-color: #ff4444;
            color: #ffffff;
            transform: translateY(-50%) scale(1.05);
            box-shadow: 0 2px 8px rgba(255, 68, 68, 0.2);
        }

        .media-url {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1.25rem;
            background: transparent;
            border: 1px solid #E0E0E0;
            border-radius: 0;
            font-family: 'Monaco', 'Courier New', monospace;
            font-size: 0.875rem;
            color: #000000;
            word-break: break-all;
            margin-bottom: 0.5rem;
        }

        .url-text {
            flex: 1;
            margin-right: 1rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .url-text input {
            width: 100%;
            border: none;
            background: transparent;
            font-family: 'Monaco', 'Courier New', monospace;
            font-size: 0.875rem;
            color: #000000;
            outline: none;
        }

        .url-text input::placeholder {
            color: #9ca3af;
        }

        .media-url-actions {
            display: flex;
            gap: 0.75rem;
        }

        .view-btn, .info-btn {
            padding: 0.5rem 1rem;
            border: 2px solid #000000;
            border-radius: 0;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            white-space: nowrap;
            background: transparent;
        }

        .view-btn {
            background: #282828;
            color: #FFFFFF;
        }

        .view-btn:hover {
            background: #FFFFFF;
            color: #000000;
        }

        .info-btn {
            background: #282828;
            color: #FFFFFF;
            padding: 0.5rem;
            min-width: 2.5rem;
        }

        .info-btn:hover {
            background: #FFFFFF;
            color: #000000;
        }


        .media-details {
            margin-top: 0.5rem;
            padding: 0.75rem;
            background: transparent;
            border: none;
            display: block;
        }

        .detail-row {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            margin-bottom: 0.5rem;
            padding: 0.25rem 0;
            text-align: left;
            gap: 0;
            position: relative;
        }

        .detail-row:hover {
            background: rgba(0, 0, 0, 0.02);
        }

        .detail-row:last-child {
            margin-bottom: 0;
        }

        .type-badges {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .type-badge {
            padding: 6px 12px;
            border: 2px solid #E0E0E0;
            border-radius: 16px;
            background: #FFFFFF;
            color: #666666;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            user-select: none;
        }

        .type-badge:hover {
            border-color: #CCCCCC;
            background: #F9F9F9;
        }

        .type-badge.selected {
            background: #282828;
            color: #FFFFFF;
            border-color: #000000;
        }

        .type-badge.selected:hover {
            background: #333333;
            border-color: #333333;
        }

        .detail-label {
            font-size: 0.875rem;
            font-weight: 600;
            color: #6B7280;
            margin-bottom: 0.25rem;
            text-align: left;
            white-space: nowrap;
        }

        .detail-value {
            font-size: 0.875rem;
            font-weight: 400;
            color: #000000;
            text-align: left;
            width: 100%;
            word-wrap: break-word;
            line-height: 1.5;
        }

        .detail-row input,
        .detail-row select,
        .detail-row textarea {
            width: 100%;
            padding: 9px 12px;
            border: 1.5px solid #E0E0E0;
            border-radius: 6px;
            font-size: 0.875rem;
            font-family: 'Inter', sans-serif;
            color: #000000;
            background: #FFFFFF;
            transition: width 0.2s ease, padding-right 0.2s ease;
            position: relative;
        }

        .detail-row:hover input,
        .detail-row:hover select,
        .detail-row:hover textarea {
            width: calc(100% - 44px);
            padding-right: 12px;
        }

        .detail-row input:focus,
        .detail-row select:focus,
        .detail-row textarea:focus {
            outline: none;
            border-color: #000000;
            box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
        }
        
        .detail-row select {
            cursor: pointer;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 10px center;
            padding-right: 32px;
            appearance: none;
        }

        .detail-row:hover select {
            background-position: right 10px center;
            padding-right: 32px;
        }
        
        .detail-row textarea {
            resize: vertical;
            min-height: 60px;
            line-height: 1.5;
        }

        .submit-button {
            width: 100%;
            padding: 14px;
            background: #FFFFFF;
            color: #000000;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            margin-top: 8px;
            outline: none;
        }

        .submit-button:hover {
            background: #F5F5F5;
            color: #000000;
        }

        .submit-button:focus,
        .submit-button:active {
            outline: none;
            border: none;
            box-shadow: none;
        }

        .submit-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* Only apply fixed positioning to disclosure pages, not widget pages */
        body:not(.widget-page) #message {
            display: none;
        }

        .error-message {
            background: rgba(239,68,68,0.95);
            border: 1px solid rgba(239,68,68,0.3);
            color: #ffffff;
        }

        .success-message {
            background: rgba(34,197,94,0.95);
            border: 1px solid rgba(34,197,94,0.3);
            color: #ffffff;
        }

        @keyframes slideInUp {
            from {
                transform: translateY(100%);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }


        .preview-empty-message {
            background: #d1fae5;
            color: #065f46;
            padding: 12px 20px;
            border-radius: 4px;
            font-size: 14px;
            font-weight: 500;
            text-align: center;
            margin: 20px auto;
            max-width: 280px;
        }

        .add-media-btn {
            width: 100%;
            padding: 16px;
            background: #FFFFFF;
            border: 2px dashed #E0E0E0;
            border-radius: 8px;
            color: #666666;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-bottom: 1rem;
        }

        .add-media-btn:hover {
            border-color: #000000;
            color: #000000;
            background: #FAFAFA;
        }

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

        /* Popup Modal */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

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

        .modal-content {
            background: #FFFFFF;
            border-radius: 8px;
            padding: 32px;
            max-width: 400px;
            width: 90%;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        .modal-header {
            margin-bottom: 24px;
        }

        .modal-header h3 {
            font-size: 20px;
            font-weight: 600;
            color: #000000;
            margin: 0;
        }

        .modal-options {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .modal-option {
            padding: 16px;
            background: #F9F9F9;
            border: 2px solid #E0E0E0;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .modal-option:hover {
            border-color: #000000;
            background: #FFFFFF;
        }

        .modal-option-icon {
            width: 40px;
            height: 40px;
            background: #282828;
            color: #FFFFFF;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
        }

        .modal-option-text h4 {
            font-size: 14px;
            font-weight: 600;
            color: #000000;
            margin: 0 0 4px 0;
        }

        .modal-option-text p {
            font-size: 12px;
            color: #666666;
            margin: 0;
        }

        .modal-close {
            margin-top: 20px;
            width: 100%;
            padding: 12px;
            background: #F0F0F0;
            border: none;
            border-radius: 6px;
            color: #666666;
            font-size: 14px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .modal-close:hover {
            background: #E0E0E0;
            color: #000000;
        }


        /* Pulse animation for keyboard reorder */
        @keyframes pulse {
            0% {
                box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.4);
            }
            50% {
                box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
            }
            100% {
                box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
            }
        }

        .media-item.pulse {
            animation: pulse 0.5s ease-out;
        }

        /* Smooth entry animation for new items */
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .media-item.new-item {
            animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        }