    
/* --- Global Styles & Variables --- */
:root {
    --epulse-primary-color: #007bff; /* Example: Bright Blue */
    --epulse-primary-hover-color: #0056b3;
    --epulse-secondary-color: #6c757d; /* Example: Muted Grey */
    --epulse-secondary-hover-color: #545b62;
    --epulse-success-color: #28a745;
    --epulse-danger-color: #dc3545;
    --epulse-warning-color: #ffc107;
    --epulse-info-color: #17a2b8;
    --epulse-light-color: #f8f9fa;
    --epulse-dark-color: #343a40;
    --epulse-text-color: #333;
    --epulse-text-muted-color: #6c757d;
    --epulse-border-color: #dee2e6;
    --epulse-background-color: #ffffff;
    --epulse-body-background: #f4f6f8; /* Light grey for page background */

    --epulse-font-family: 'Poppins', sans-serif;
    --epulse-border-radius-soft: 0.8rem; /* 8px */
    --epulse-border-radius-card: 2rem; /* 20px */
    --epulse-border-radius-pill: 50rem;
    --epulse-box-shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.08);
    --epulse-box-shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.1);
    --epulse-input-height: 4.2rem; /* 42px */
}

html {
    font-size: 60%; /* Base 10px for easy rem calculations (1rem = 10px) */
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--epulse-font-family);
    font-size: 1.6rem; /* Default text size 16px */
    line-height: 1.6;
    color: var(--epulse-text-color);
    background-color: var(--epulse-body-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.epulse-page-title { /* h1 */
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--epulse-dark-color);
    margin-bottom: 2rem;
}

.epulse-form-card__title { /* h2 */
    font-size: 2rem;
    font-weight: 600;
    color: var(--epulse-primary-color);
    display: flex;
    align-items: center;
    margin-bottom: 0; /* Handled by card header padding */
}

.epulse-form-card__icon {
    margin-right: 1rem;
    font-size: 1.8rem; /* Slightly smaller than title */
}

.epulse-dynamic-fields-group__title { /* h3 */
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--epulse-dark-color);
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--epulse-border-color);
}

/* --- Message Banner --- */
.epulse-message-banner {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    width: auto;
    max-width: 90%;
}
.epulse-message-banner__item {
    background-color: var(--epulse-success-color);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: var(--epulse-border-radius-soft);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--epulse-box-shadow-medium);
    font-size: 1.5rem;
}
.epulse-message-banner__item--error { /* Add this class in PHP if it's an error */
    background-color: var(--epulse-danger-color);
}
.epulse-message-banner__close {
    cursor: pointer;
    margin-left: 1.5rem;
    font-size: 1.8rem;
}


/* --- Main Layout --- */
.epulse-main-container {
    max-width: 90rem; /* Max width for the form area */
    margin: 3rem auto;
    padding: 2rem;
}

/* --- Tab Navigation --- */
.epulse-tab-navigation {
    display: flex;
    margin-bottom: 2.5rem;
    background-color: var(--epulse-background-color);
    border-radius: var(--epulse-border-radius-pill);
    box-shadow: var(--epulse-box-shadow-soft);
    padding: 0.5rem;
    overflow: hidden;
}
.epulse-tab-navigation__link {
    flex: 1;
    text-align: center;
    padding: 1.2rem 2rem;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--epulse-secondary-color);
    text-decoration: none;
    border-radius: var(--epulse-border-radius-pill);
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.epulse-tab-navigation__icon {
    margin-right: 0.8rem;
}
.epulse-tab-navigation__link:hover {
    color: var(--epulse-primary-color);
}
.epulse-tab-navigation__link--active {
    background-color: var(--epulse-primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
}
.epulse-tab-navigation__link--active:hover {
    color: white;
    background-color: var(--epulse-primary-hover-color);
}

/* --- Page Header --- */
.epulse-page-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* --- Progress Tracker --- */
.epulse-progress-tracker {
    width: 100%;
    background-color: #e9ecef;
    border-radius: var(--epulse-border-radius-pill);
    margin-bottom: 3rem;
    overflow: hidden;
    position: relative;
    height: 2.5rem; /* Increased height */
}
.epulse-progress-tracker__bar {
    width: 0%;
    height: 100%;
    background-color: var(--epulse-success-color); /* Green for progress */
    border-radius: var(--epulse-border-radius-pill);
    transition: width 0.4s ease-in-out;
}
.epulse-progress-tracker__text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--epulse-dark-color);
}
.epulse-progress-tracker__bar:not([style*="width: 0%;"]):not([style*="width: 0px;"]) + .epulse-progress-tracker__text {
    color: white; /* Text color when bar is visible */
}


/* --- Form Card --- */
.epulse-form-card {
    background-color: var(--epulse-background-color);
    border-radius: var(--epulse-border-radius-card);
    box-shadow: var(--epulse-box-shadow-soft);
    margin-bottom: 3rem;
    overflow: hidden; /* Ensures child elements respect border radius */
}
.epulse-form-card__header {
    padding: 1.5rem 2.5rem;
    border-bottom: 1px solid var(--epulse-border-color);
    background-color: #fcfdff; /* Slightly off-white header */
}
.epulse-form-card__body {
    padding: 2.5rem;
}

/* --- Form Grid & Groups --- */
.epulse-form-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile first: full width */
    gap: 2rem;
}
.epulse-form-grid--nested {
    gap: 1.5rem; /* Smaller gap for nested grids */
    margin-top: 1.5rem;
}

@media (min-width: 768px) { /* Tablet and up */
    .epulse-form-grid {
        grid-template-columns: repeat(12, 1fr); /* 12 column grid */
        gap: 2.5rem;
    }
    .epulse-form-group--full { grid-column: span 12; }
    .epulse-form-group--half { grid-column: span 6; }
    .epulse-form-group--third { grid-column: span 4; }
    .epulse-form-group--two-thirds { grid-column: span 8; }
    .epulse-form-group--quarter { grid-column: span 3; }
}

.epulse-form-group {
    display: flex;
    flex-direction: column;
}

/* --- Form Elements --- */
.epulse-form-label {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.8rem;
    color: var(--epulse-dark-color);
}
.epulse-form-label--required::after {
    content: ' *';
    color: var(--epulse-danger-color);
    font-weight: bold;
}

.epulse-form-input,
.epulse-form-select,
.epulse-form-textarea {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    line-height: 1.5;
    color: var(--epulse-text-color);
    background-color: var(--epulse-background-color);
    border: 1px solid var(--epulse-border-color);
    border-radius: var(--epulse-border-radius-soft);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    height: var(--epulse-input-height);
}
.epulse-form-textarea {
    height: auto;
    min-height: 10rem; /* Minimum height for textareas */
    resize: vertical;
}
.epulse-form-input:focus,
.epulse-form-select:focus,
.epulse-form-textarea:focus {
    border-color: var(--epulse-primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
.epulse-select-wrapper {
    position: relative;
}
.epulse-select-wrapper::after { /* Custom arrow for select */
    content: '\f078'; /* Font Awesome down arrow */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--epulse-text-muted-color);
    font-size: 1.2rem;
}
.epulse-form-select {
    appearance: none; /* Remove default system appearance */
    -webkit-appearance: none;
    -moz-appearance: none;
}

.epulse-form-text-helper {
    font-size: 1.3rem;
    color: var(--epulse-text-muted-color);
    margin-top: 0.6rem;
}
.epulse-form-text-helper--emphasized {
    font-style: italic;
    margin-bottom: 1.5rem; /* More space if it's a section intro */
}
.epulse-form-error-message {
    font-size: 1.3rem;
    color: var(--epulse-danger-color);
    margin-top: 0.6rem;
    display: none; /* Hidden by default, shown by JS */
}
.epulse-hidden-textarea {
    display: none !important;
}
.epulse-new-category-input-group {
    margin-top: 1rem;
}

/* --- Rich Text Editor --- */
.epulse-rich-editor {
    border: 1px solid var(--epulse-border-color);
    border-radius: var(--epulse-border-radius-soft);
    overflow: hidden; /* to keep children within rounded corners */
}
.epulse-rich-editor__toolbar {
    background-color: #f8f9fa;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--epulse-border-color);
}
.epulse-rich-editor__button {
    background: none;
    border: none;
    color: var(--epulse-dark-color);
    padding: 0.6rem 0.8rem;
    margin-right: 0.5rem;
    cursor: pointer;
    border-radius: 0.4rem;
    transition: background-color 0.2s ease;
}
.epulse-rich-editor__button:hover,
.epulse-rich-editor__button:focus {
    background-color: #e2e6ea;
    outline: none;
}
.epulse-rich-editor__button i {
    font-size: 1.4rem;
}
.epulse-rich-editor__content {
    min-height: 15rem;
    padding: 1.5rem;
    font-size: 1.5rem;
    line-height: 1.6;
    overflow-y: auto;
}
.epulse-rich-editor__content:focus {
    outline: none;
    border-color: var(--epulse-primary-color); /* Though the parent border handles this */
}
.epulse-rich-editor__content ul, .epulse-rich-editor__content ol {
    margin-left: 3rem; /* Indent lists */
    margin-bottom: 1rem;
}
.epulse-rich-editor__content li {
    margin-bottom: 0.5rem;
}


/* --- Image Uploader --- */
.epulse-image-uploader-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); /* Responsive columns */
    gap: 2rem;
    margin-top: 1rem;
}
.epulse-image-upload-slot {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Creates a square aspect ratio container */
    border: 2px dashed var(--epulse-border-color);
    border-radius: var(--epulse-border-radius-soft);
    background-color: #fdfdfd;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    overflow: hidden; /* To contain the absolute positioned children */
}
.epulse-image-upload-slot:hover,
.epulse-image-upload-slot.epulse-image-upload-slot--dragging { /* JS can add this class on dragover */
    border-color: var(--epulse-primary-color);
    background-color: #f0f7ff;
}
.epulse-image-upload-slot__input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}
.epulse-image-upload-slot__label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--epulse-text-muted-color);
    cursor: pointer;
    padding: 1rem;
    z-index: 5; /* Below input but above preview initially */
}
.epulse-image-upload-slot__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--epulse-primary-color);
}
.epulse-image-upload-slot__text {
    font-size: 1.4rem;
    font-weight: 500;
}
.epulse-image-upload-slot__subtext {
    font-size: 1.2rem;
}
.epulse-image-upload-slot__preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, might crop */
    border-radius: var(--epulse-border-radius-soft); /* Match slot's radius */
    display: none; /* Hidden initially */
    z-index: 1;
}
.epulse-image-upload-slot__remove-btn {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background-color: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: background-color 0.2s ease;
}
.epulse-image-upload-slot__remove-btn:hover {
    background-color: var(--epulse-danger-color);
}
.epulse-image-upload-slot .epulse-form-error-message { /* Error below the slot */
    position: absolute;
    bottom: -2.2rem; /* Adjust as needed */
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 1.2rem;
}

/* --- Toggle Switches --- */
/* For Checkbox Toggle */
.epulse-toggle-switch-group {
    display: flex;
    align-items: center;
    margin: 1rem 0;
}
.epulse-toggle-switch-group__checkbox {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.epulse-toggle-switch-group__label {
    width: 5rem; /* Width of the switch */
    height: 2.6rem; /* Height of the switch */
    background-color: #ccc;
    border-radius: var(--epulse-border-radius-pill);
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-right: 1.2rem; /* Space between switch and text */
}
.epulse-toggle-switch-group__slider {
    position: absolute;
    content: "";
    height: 2rem; /* Circle height */
    width: 2rem; /* Circle width */
    left: 0.3rem; /* Initial position */
    bottom: 0.3rem;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}
.epulse-toggle-switch-group__checkbox:checked + .epulse-toggle-switch-group__label {
    background-color: var(--epulse-success-color);
}
.epulse-toggle-switch-group__checkbox:checked + .epulse-toggle-switch-group__label .epulse-toggle-switch-group__slider {
    transform: translateX(2.4rem); /* Move slider to the right */
}
.epulse-toggle-switch-group__text {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--epulse-dark-color);
}

/* For Radio Button Status Toggle */
.epulse-status-toggle {
    display: flex;
    border: 1px solid var(--epulse-border-color);
    border-radius: var(--epulse-border-radius-pill);
    overflow: hidden;
    position: relative;
    width: fit-content; /* Adjusts to content */
}
.epulse-status-toggle__radio {
    opacity: 0;
    position: absolute;
    width: 0; height: 0;
}
.epulse-status-toggle__label {
    padding: 1rem 2.5rem;
    font-size: 1.4rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    color: var(--epulse-text-muted-color);
    transition: color 0.3s ease;
    position: relative;
    z-index: 2;
}
.epulse-status-toggle__radio:checked + .epulse-status-toggle__label {
    color: white;
}
.epulse-status-toggle__slider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%; /* Assuming two options */
    background-color: var(--epulse-primary-color);
    border-radius: var(--epulse-border-radius-pill);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy effect */
    z-index: 1;
}
#epulseStatusPublished:checked ~ .epulse-status-toggle__slider {
    transform: translateX(0%);
}
#epulseStatusDraft:checked ~ .epulse-status-toggle__slider {
    transform: translateX(100%);
}

/* --- Info Box --- */
.epulse-info-box {
    display: flex;
    align-items: flex-start;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: var(--epulse-border-radius-soft);
    border: 1px solid var(--epulse-border-color);
}
.epulse-info-box--highlight {
    background-color: #e7f3ff; /* Light blue */
    border-color: var(--epulse-primary-color);
}
.epulse-info-box__icon {
    font-size: 2rem;
    color: var(--epulse-primary-color);
    margin-right: 1.5rem;
    margin-top: 0.3rem;
}
.epulse-info-box__text {
    font-size: 1.4rem;
    line-height: 1.6;
    margin-bottom: 0;
}

/* --- Dynamic Fields --- */
.epulse-dynamic-fields-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}
.epulse-dynamic-fields-group {
    margin-top: 2rem;
    padding: 2rem;
    border: 1px solid #e9ecef;
    border-radius: var(--epulse-border-radius-soft);
    background-color: #fcfdff;
}
.epulse-dynamic-field-entry {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}
.epulse-dynamic-field-entry .epulse-form-input {
    flex-grow: 1;
    margin-bottom: 0; /* No margin as it's part of a group */
}
.epulse-remove-field-button {
    background-color: var(--epulse-danger-color);
    color: white;
    border: none;
    border-radius: var(--epulse-border-radius-pill);
    width: 3.6rem;
    height: 3.6rem;
    font-size: 1.4rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    flex-shrink: 0; /* Prevent shrinking */
}
.epulse-remove-field-button:hover {
    background-color: #c82333; /* Darker danger */
}
.epulse-dynamic-field-entry--key-value .epulse-form-input {
    flex-basis: calc(50% - 2.3rem); /* Approx half width minus button and gap */
}


/* --- Buttons --- */
.epulse-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 500;
    padding: 1.2rem 2.5rem; /* Generous padding */
    border: 1px solid transparent;
    border-radius: var(--epulse-border-radius-pill);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    line-height: 1; /* For consistent height with icons */
}
.epulse-button--primary {
    background-color: var(--epulse-primary-color);
    color: white;
}
.epulse-button--primary:hover,
.epulse-button--primary:focus {
    background-color: var(--epulse-primary-hover-color);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
    outline: none;
}
.epulse-button--secondary {
    background-color: var(--epulse-light-color);
    color: var(--epulse-dark-color);
    border-color: var(--epulse-border-color);
}
.epulse-button--secondary:hover,
.epulse-button--secondary:focus {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: var(--epulse-dark-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    outline: none;
}
.epulse-button--danger { /* For cancel, though secondary might be better unless destructive */
    background-color: var(--epulse-danger-color);
    color: white;
}
.epulse-button--danger:hover,
.epulse-button--danger:focus {
    background-color: #c82333; /* Darker red */
    box-shadow: 0 4px 12px rgba(220,53,69,0.3);
}

.epulse-button--icon-left i {
    margin-right: 0.8rem;
}
.epulse-button--icon-right i {
    margin-left: 0.8rem;
}


/* --- Form Actions --- */
.epulse-form-actions {
    display: flex;
    justify-content: flex-end; /* Align buttons to the right */
    gap: 1.5rem;
    padding: 2rem;
    background-color: #f8f9fa; /* Light footer background */
    border-top: 1px solid var(--epulse-border-color);
    border-radius: 0 0 var(--epulse-border-radius-card) var(--epulse-border-radius-card); /* Rounded bottom corners */
    margin-top: -0.1rem; /* Overlap slightly with card if not separate */
}
/* If form-actions is outside the last card, it needs its own top margin */
.epulse-item-form > .epulse-form-actions {
    margin-top: 3rem;
    border-radius: var(--epulse-border-radius-card);
}


/* --- Responsive Adjustments --- */
@media (max-width: 767px) { /* Mobile phones */
    .epulse-main-container {
        margin: 1.5rem auto;
        padding: 1rem;
    }
    .epulse-page-title {
        font-size: 2.4rem;
    }
    .epulse-form-card__title {
        font-size: 1.8rem;
    }
    .epulse-form-card__header,
    .epulse-form-card__body {
        padding: 1.5rem;
    }
    .epulse-button {
        padding: 1rem 2rem;
        font-size: 1.4rem;
    }
    .epulse-tab-navigation {
        flex-direction: column; /* Stack tabs on small screens */
        border-radius: var(--epulse-border-radius-soft);
    }
    .epulse-tab-navigation__link {
        border-radius: var(--epulse-border-radius-soft);
    }
    .epulse-image-uploader-grid {
        grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
        gap: 1.5rem;
    }
    .epulse-dynamic-fields-controls {
        flex-direction: column; /* Stack control buttons */
    }
    .epulse-dynamic-fields-controls .epulse-button {
        width: 100%; /* Full width buttons in column */
    }
    .epulse-dynamic-field-entry {
        flex-direction: column; /* Stack input and remove button */
        align-items: stretch; /* Make children full width */
    }
    .epulse-dynamic-field-entry .epulse-form-input {
        margin-bottom: 1rem; /* Space before button */
    }
     .epulse-dynamic-field-entry--key-value {
        flex-direction: row; /* Keep key-value side by side if possible */
        flex-wrap: wrap; /* Allow wrapping if too narrow */
    }
    .epulse-dynamic-field-entry--key-value .epulse-form-input {
        flex-basis: 100%; /* Full width for inputs on small screens in key-value */
        margin-bottom: 1rem;
    }
    .epulse-dynamic-field-entry--key-value .epulse-form-input:last-of-type {
         margin-bottom: 0; /* No margin for the last input before button */
    }
    .epulse-remove-field-button {
        width: 100%; /* Full width remove button when stacked */
    }
    .epulse-status-toggle {
        width: 100%; /* Full width for status toggle */
    }
    .epulse-status-toggle__label {
        flex-grow: 1; /* Distribute space */
    }
    .epulse-form-actions {
        flex-direction: column-reverse; /* Stack action buttons, primary on top */
        padding: 1.5rem;
    }
    .epulse-form-actions .epulse-button {
        width: 100%;
    }
}

@media (max-width: 480px) { /* Smaller mobile screens */
    .epulse-page-title {
        font-size: 2.2rem;
    }
     html {
        font-size: 58%; /* Slightly smaller base for very small screens if needed */
    }
    .epulse-progress-tracker__text {
        font-size: 1.2rem;
    }
}

