:root {
    --accordion-header-odd-bg: #85c1e9;  /* Light Blue */
    --accordion-header-even-bg: #5dade2;
    --accordion-summary-bg: #ecf0f1;
}

.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.accordion-header {
    color: #333;
    border-radius: 5px;
    padding: .5rem 1rem;
    margin-bottom: .5rem;
    cursor: pointer;
    font-size: 1.5em;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

summary::after {
    display: none;
}

.accordion-content {
    margin-bottom: .5rem;
    border-radius: 5px;
}

.accordion-content fieldset {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 2px groove #FFF;
}

/* ------------------------------------------------------------------------
 * ACCORDION ANIMATION & SCROLL FIXES
 * ------------------------------------------------------------------------ */

/* 1. Base item - keep hidden initially to clip closing animation */
.accordion-item {
    overflow: hidden;
}

/* 2. When OPEN, allow the accordion to overflow so dropdowns and focus work normally */
.accordion-item[open] {
    overflow: visible;
}

/* 3. The content transition */
.accordion-item .accordion-content {
    will-change: max-height;
    max-height: 0; /* Initial max-height set to 0 */
    overflow: hidden; /* Prevent content from overflowing during the transition */
    transition: max-height 0.8s ease-in-out; /* Slightly longer for larger panels */
}

/* 4. THE FIX: Raise the ceiling massively so copious forms aren't chopped off */
.accordion-item[open] .accordion-content {
    max-height: 5000px; /* Massively increased from 1000px to accommodate large forms */
    transform: scaleY(1);
    /* Set overflow visible after open so select dropdowns aren't clipped */
}

/* ------------------------------------------------------------------------ */

.accordion-header i {
    transition: transform 0.75s ease-in-out;
}

.accordion-item[open] .accordion-header i.fa-arrow-up {
    transform: rotate(180deg);
}

.accordion-item[open] .accordion-header {
    border-radius: 5px 5px 3px 3px;
}

.odd {
    background-color: var(--accordion-header-odd-bg);
}

.even {
    background-color: var(--accordion-header-even-bg);
}

.data-title-wrapper {
    position: relative; /* To position the tooltip relative to this span */
}

.data-title-wrapper:hover:after {
    opacity: .98;
    visibility: visible;
    transition: all 0.1s ease 0.6s;
    z-index: 999999999;
    content: attr(data-title); /* Get the data-title from the parent summary */
    position: absolute;
    left: 100%; /* Position to the right of the text */
    top: 50%;
    transform: translateY(-50%); /* Center vertically */
    padding: 10px;
    color: darkslategray;
    background-color: white;
    border: 2px solid blue;
    border-radius: 8px;
    width: 400px;
    font-size: .9rem;
}

#tooltip {
    background-color: black;
    color: white;
    border: 2px solid white;
    padding: 5px;
    border-radius: 7px;
    font-size: 18px;
    max-width: 350px;
    word-wrap: break-word;
    position: absolute; /* Ensure correct positioning */
    z-index: 1000; /* Ensure it's on top */
}
/* * ------------------------------------------------------------------------
 * MASTER SCROLL OVERRIDE FOR ADVERT EDITOR
 * ------------------------------------------------------------------------
 * Bypasses the strict 100vh / overflow: hidden locks from afors_layout.css.
 * Forces the browser to render a vertical scrollbar for the copious form.
 * ------------------------------------------------------------------------
 */

html, body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100vh !important;
}

#outer, #main {
    overflow-y: visible !important;
    height: auto !important;
}

#mainArticle {
    overflow-y: visible !important;
    height: auto !important;
    padding-bottom: 150px !important; /* Copious breathing room at the bottom */
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Fix for the disappearing buttons: Allow open panels to grow dynamically */
#accordion-container details[open] {
    height: auto !important;
    max-height: none !important;
}

#accordion-container details[open] .accordion-content {
    height: auto !important;
    max-height: none !important;
    padding-bottom: 20px;
}

/* Restrict textareas to vertical resizing only */
textarea {
    resize: vertical;
    min-height: 150px;
}

textarea.no-min {
    min-height: auto;
}

/* Optional: Keep the save button visible at all times within the panel */
.panel-actions {
    position: sticky;
    bottom: 0;
    background: #1a1a1a;
    padding: 10px 0;
    z-index: 5;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Scoped input margins from the basics panel */
#advertBasics input {
    margin-bottom: 10px;
}
details {
    padding: 0;
    border-radius: 12px;
    border: solid 1px rgb(228, 229, 233);
}

details form {
    margin: 1rem;
    background: var(--accordion-summary-bg);
    border-radius: 12px;
}