/* =========================================
   Form Panel Base Structure & Header
   ========================================= */

/* Main wrapper layout - Enhanced for Maximum Focus */
.form-panel {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    background-color: var(--bg-card);
    border-radius: var(--border-radius-2xl);
    /* Full primary border to distinguish from the passive preview */
    border: 2px solid var(--color-primary) !important;
    /* Strong shadow combined with a subtle primary glow */
    box-shadow:
        0 0 0 4px var(--color-primary-light),
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden;
    z-index: 10;
    /* Sit clearly above the preview frame */
    transition: all 0.3s ease;
}

/* =========================================
   Auto Saving Info
   ========================================= */
.dt-auto-saving-info {
    position: absolute;
    top: 20px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    z-index: 10;
}

.dt-auto-saving-active {
    color: #16a34a;
    /* green-600 */
    background-color: #f0fdf4;
    /* green-50 */
    border-color: #dcfce7;
    /* green-100 */
}

.dt-auto-saving-inactive {
    color: #64748b;
    /* slate-500 */
    background-color: #f8fafc;
    /* slate-50 */
    border-color: #e2e8f0;
    /* slate-200 */
}

@media (max-width: 600px) {
    .dt-auto-saving-info {
        position: relative;
        top: 0;
        right: 0;
        margin: 16px 20px 0;
        width: max-content;
    }
}

/* Header layout structure */
.form-panel__title-wrapper {
    flex: 1;
}

/* Typography and alignment for the card title */
.form-panel__title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
   Pagination / Multi-Step Navigation
   ========================================= */

/* Container for the Next/Prev buttons */
.dt-pagination-nav {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Container to keep Loader and Button together on the right side */
.dt-nav-right-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* The Loading Bar */
.dt-loader-bar {
    width: 100px;
    height: 4px;
    background: #edf2f7;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    display: none;
}

.dt-loader-bar::after {
    content: '';
    position: absolute;
    left: -50%;
    height: 100%;
    width: 50%;
    background: #3182ce;
    border-radius: 2px;
    animation: dt-slide 1s infinite linear;
}

@keyframes dt-slide {
    0% {
        left: -50%;
    }

    100% {
        left: 100%;
    }
}

/* Optional: Fade out the button slightly when loading */
.dt-loading-active {
    opacity: 0.7;
    pointer-events: none;
    cursor: wait;
}

/* =========================================
   GravityView Specific Overrides
   ========================================= */

/* Hide the default GravityView edit title since the wrapper has its own header */
.form-panel .gv-edit-entry-title {
    display: none !important;
}

/* =========================================
   Form & Preview Side-by-Side Layout
   ========================================= */
.form-preview-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--spacing-xl);
    align-items: start;
    /* Prevents cards from stretching vertically to match each other */
    margin-bottom: var(--spacing-xl);
}

/* Force the shortcode elements to respect the grid sizing and remove their default centering margins */
.form-preview-layout>.form-panel,
.form-preview-layout>.preview-frame {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
}

/* * Responsive Breakpoint:
 * Ensures the form wrapper maintains a minimum width.
 * Once the screen is smaller than 1050px, the layout stacks into 1 column.
 */
@media (max-width: 1050px) {
    .form-preview-layout {
        grid-template-columns: 1fr;
    }

    /* Optional: Remove sticky positioning on mobile so it doesn't take up the whole screen */
    .form-preview-layout>.preview-frame {
        position: relative;
        top: 0;
    }
}

/* =========================================
   Injected Field Links (Datenschutz etc.)
   ========================================= */
.dt-injected-field-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    margin-left: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    background-color: var(--color-primary-light);
    border-radius: 9999px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.dt-injected-field-link:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dt-injected-field-link .material-icons-outlined {
    font-size: 14px;
    margin-right: 4px;
}