/* ═══════════════════════════════════════════════════════════
   K9 ATF — Event Banner Display + Admin Inline Editor
   Depends on variables defined in civilian.css
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   ANIMATIONS
   ───────────────────────────────────────────── */
@keyframes bannerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bannerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.25); }
    50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ─────────────────────────────────────────────
   BANNER SECTION CONTAINER
   ───────────────────────────────────────────── */
.k9-banner-section {
    padding: 1rem 0 0;
    margin: 0;
}

/* ─────────────────────────────────────────────
   INDIVIDUAL BANNER CARD
   ───────────────────────────────────────────── */
.k9-banner {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1rem;
    background: var(--card-bg, rgba(30, 41, 59, 0.85));
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    animation: bannerSlideIn 0.5s ease-out both;
}

.k9-banner:nth-child(2) { animation-delay: 0.1s; }
.k9-banner:nth-child(3) { animation-delay: 0.2s; }
.k9-banner:nth-child(4) { animation-delay: 0.3s; }
.k9-banner:nth-child(5) { animation-delay: 0.4s; }

.k9-banner:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

/* ─────────────────────────────────────────────
   LAYOUT: TEXT ONLY
   ───────────────────────────────────────────── */
.k9-banner[data-layout='text_only'] {
    padding: 2rem 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ─────────────────────────────────────────────
   LAYOUT: IMAGE LEFT
   ───────────────────────────────────────────── */
.k9-banner[data-layout='image_left'] {
    display: grid;
    grid-template-columns: 200px 1fr;
    align-items: stretch;
}

.k9-banner[data-layout='image_left'] .k9-banner-img-wrap {
    border-radius: 16px 0 0 16px;
    overflow: hidden;
}

.k9-banner[data-layout='image_left'] .k9-banner-text {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ─────────────────────────────────────────────
   LAYOUT: IMAGE RIGHT
   ───────────────────────────────────────────── */
.k9-banner[data-layout='image_right'] {
    display: grid;
    grid-template-columns: 1fr 200px;
    align-items: stretch;
}

.k9-banner[data-layout='image_right'] .k9-banner-img-wrap {
    border-radius: 0 16px 16px 0;
    overflow: hidden;
    order: 2;
}

.k9-banner[data-layout='image_right'] .k9-banner-text {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    order: 1;
}

/* ─────────────────────────────────────────────
   LAYOUT: IMAGE BOTH
   ───────────────────────────────────────────── */
.k9-banner[data-layout='image_both'] {
    display: grid;
    grid-template-columns: 160px 1fr 160px;
    align-items: stretch;
}

.k9-banner[data-layout='image_both'] .k9-banner-img-wrap:first-of-type {
    border-radius: 16px 0 0 16px;
    overflow: hidden;
}

.k9-banner[data-layout='image_both'] .k9-banner-img-wrap:last-of-type {
    border-radius: 0 16px 16px 0;
    overflow: hidden;
}

.k9-banner[data-layout='image_both'] .k9-banner-text {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

/* ─────────────────────────────────────────────
   LAYOUT: BACKGROUND IMAGE
   ───────────────────────────────────────────── */
.k9-banner[data-layout='background_image'] {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.k9-banner-bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 100%);
    z-index: 1;
}

.k9-banner-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2.5rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─────────────────────────────────────────────
   BANNER TYPOGRAPHY
   ───────────────────────────────────────────── */
.k9-banner-headline {
    font-family: var(--font-display, 'Outfit', 'Inter', sans-serif);
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.k9-banner-subtext {
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    max-width: 600px;
    margin-top: 0.5rem;
    line-height: 1.6;
}

/* ─────────────────────────────────────────────
   BANNER CTA BUTTON
   ───────────────────────────────────────────── */
.k9-banner-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    background: var(--green, #22c55e);
    text-decoration: none;
    margin-top: 1rem;
    border: none;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.k9-banner-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.35);
    background: #16a34a;
    color: #ffffff;
}

.k9-banner-cta:active {
    transform: translateY(0);
}

/* ─────────────────────────────────────────────
   BANNER IMAGE
   ───────────────────────────────────────────── */
.k9-banner-img-wrap {
    overflow: hidden;
    line-height: 0;
}

.k9-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.k9-banner:hover .k9-banner-img {
    transform: scale(1.04);
}

/* ─────────────────────────────────────────────
   RESPONSIVE — ALL LAYOUTS
   ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .k9-banner[data-layout='image_left'],
    .k9-banner[data-layout='image_right'] {
        grid-template-columns: 1fr;
    }

    .k9-banner[data-layout='image_left'] .k9-banner-img-wrap,
    .k9-banner[data-layout='image_right'] .k9-banner-img-wrap {
        border-radius: 16px 16px 0 0;
        max-height: 180px;
        order: -1;
    }

    .k9-banner[data-layout='image_right'] .k9-banner-text {
        order: 2;
    }

    .k9-banner[data-layout='image_both'] {
        grid-template-columns: 1fr;
    }

    .k9-banner[data-layout='image_both'] .k9-banner-img-wrap:first-of-type {
        border-radius: 16px 16px 0 0;
        max-height: 160px;
    }

    .k9-banner[data-layout='image_both'] .k9-banner-img-wrap:last-of-type {
        border-radius: 0 0 16px 16px;
        max-height: 160px;
    }

    .k9-banner[data-layout='text_only'] {
        padding: 1.5rem 1.25rem;
    }

    .k9-banner-headline {
        font-size: 1.2rem;
    }

    .k9-banner-subtext {
        font-size: 0.85rem;
    }

    .k9-banner[data-layout='background_image'] {
        min-height: 160px;
    }

    .k9-banner-content {
        padding: 1.5rem;
    }
}


/* ═══════════════════════════════════════════════════════════
   ADMIN INLINE EDITOR — VISIBLE ONLY IN ADMIN MODE
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   ADMIN ACTION BAR (per banner)
   ───────────────────────────────────────────── */
.k9-banner-admin-bar {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    gap: 4px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.k9-banners-admin-mode .k9-banner-admin-bar {
    display: flex;
}

.k9-banner-edit-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.k9-banner-edit-btn:hover {
    background: var(--green, #22c55e);
    color: #ffffff;
}

.k9-banner-edit-btn.btn-delete:hover {
    background: var(--red, #D35147);
}

.k9-banner-edit-btn.btn-toggle-active {
    position: relative;
}

.k9-banner-edit-btn.btn-toggle-active.is-active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
}

.k9-banner-edit-btn.btn-toggle-active.is-inactive::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}

/* ─────────────────────────────────────────────
   ADD NEW BANNER BUTTON
   ───────────────────────────────────────────── */
.k9-banner-add-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 80px;
    border: 2px dashed rgba(34, 197, 94, 0.4);
    border-radius: 12px;
    background: transparent;
    color: var(--green, #22c55e);
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s ease, border-color 0.25s ease;
    width: 100%;
    margin-top: 0.5rem;
}

.k9-banners-admin-mode .k9-banner-add-btn {
    display: flex;
}

.k9-banner-add-btn:hover {
    background: rgba(34, 197, 94, 0.08);
    border-color: var(--green, #22c55e);
}

.k9-banner-add-btn i {
    font-size: 1.1rem;
}


/* ═══════════════════════════════════════════════════════════
   BANNER EDITOR MODAL
   ═══════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   OVERLAY + CARD
   ───────────────────────────────────────────── */
#bannerEditorModal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#bannerEditorModal.is-open {
    display: flex;
}

.banner-editor-card {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    animation: bannerSlideIn 0.3s ease-out;
}

.banner-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.5);
}

.banner-editor-header h3 {
    font-family: var(--font-display, 'Outfit', 'Inter', sans-serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: #f8fafc;
    margin: 0;
}

.banner-editor-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.banner-editor-close:hover {
    background: rgba(211, 81, 71, 0.3);
    color: #ffffff;
}

.banner-editor-body {
    overflow-y: auto;
    padding: 1.5rem;
    flex: 1;
}

.banner-editor-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.5);
}

/* ─────────────────────────────────────────────
   FORM GROUPS (inside modal)
   ───────────────────────────────────────────── */
.banner-editor-form .be-form-group {
    margin-bottom: 1.25rem;
}

.banner-editor-form .be-form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-family: var(--font-main, 'Inter', sans-serif);
    font-weight: 600;
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.banner-editor-form .be-form-group input[type='text'],
.banner-editor-form .be-form-group input[type='url'],
.banner-editor-form .be-form-group input[type='color'],
.banner-editor-form .be-form-group select,
.banner-editor-form .be-form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: #0f172a;
    border: 1px solid var(--slate, #334155);
    color: #f8fafc;
    border-radius: 8px;
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.9rem;
    transition: border-color 0.25s ease;
}

.banner-editor-form .be-form-group input:focus,
.banner-editor-form .be-form-group select:focus,
.banner-editor-form .be-form-group textarea:focus {
    outline: none;
    border-color: var(--green, #22c55e);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.banner-editor-form .be-form-group textarea {
    resize: vertical;
    min-height: 70px;
}

.banner-editor-form .be-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ─────────────────────────────────────────────
   COLOR PICKER SWATCH
   ───────────────────────────────────────────── */
.be-color-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.be-color-field input[type='color'] {
    width: 40px;
    height: 36px;
    padding: 2px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.be-color-field input[type='text'] {
    flex: 1;
}

.be-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   LAYOUT PICKER — 5-Card Grid
   ───────────────────────────────────────────── */
.banner-layout-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.banner-layout-option {
    height: 80px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: #0f172a;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    padding: 0.4rem;
}

.banner-layout-option:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(30, 41, 59, 0.6);
}

.banner-layout-option.is-selected {
    border-color: var(--green, #22c55e);
    background: rgba(34, 197, 94, 0.08);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.2);
}

.banner-layout-option .layout-icon {
    font-size: 1.1rem;
    color: #94a3b8;
    transition: color 0.2s;
}

.banner-layout-option.is-selected .layout-icon {
    color: var(--green, #22c55e);
}

.banner-layout-option .layout-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: center;
    line-height: 1.2;
}

.banner-layout-option.is-selected .layout-label {
    color: #22c55e;
}

@media (max-width: 500px) {
    .banner-layout-picker {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ─────────────────────────────────────────────
   IMAGE PICKER (thumbnail preview)
   ───────────────────────────────────────────── */
.be-image-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.be-image-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f172a;
    flex-shrink: 0;
}

.be-image-choose-btn {
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.be-image-choose-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ─────────────────────────────────────────────
   FONT PICKER DROPDOWN
   ───────────────────────────────────────────── */
.banner-editor-form select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* ─────────────────────────────────────────────
   LIVE PREVIEW (inside modal)
   ───────────────────────────────────────────── */
.banner-preview {
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    background: #0f172a;
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.banner-preview-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.banner-preview-area {
    padding: 1rem;
    min-height: 100px;
}

.banner-preview-area .k9-banner {
    margin-bottom: 0;
    animation: none;
    transform: scale(0.85);
    transform-origin: top left;
}

/* ─────────────────────────────────────────────
   MODAL BUTTONS
   ───────────────────────────────────────────── */
.be-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-family: var(--font-main, 'Inter', sans-serif);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.be-btn:active {
    transform: scale(0.97);
}

.be-btn-primary {
    background: var(--green, #22c55e);
    color: #ffffff;
}

.be-btn-primary:hover {
    background: #16a34a;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
}

.be-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.be-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.be-btn-danger {
    background: rgba(211, 81, 71, 0.15);
    color: #f87171;
    border: 1px solid rgba(211, 81, 71, 0.25);
}

.be-btn-danger:hover {
    background: rgba(211, 81, 71, 0.3);
}

/* ─────────────────────────────────────────────
   INACTIVE BANNER STATE
   ───────────────────────────────────────────── */
.k9-banner.is-inactive {
    opacity: 0.45;
    filter: grayscale(0.4);
}

.k9-banners-admin-mode .k9-banner.is-inactive {
    opacity: 0.6;
    filter: grayscale(0.2);
    border-style: dashed;
}

/* ─────────────────────────────────────────────
   DRAG HANDLE (admin reorder)
   ───────────────────────────────────────────── */
.k9-banner-drag-handle {
    display: none;
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 20px;
    cursor: grab;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    text-align: center;
}

.k9-banners-admin-mode .k9-banner-drag-handle {
    display: block;
}

.k9-banner-drag-handle:active {
    cursor: grabbing;
    color: var(--green, #22c55e);
}

/* ─────────────────────────────────────────────
   EMPTY STATE
   ───────────────────────────────────────────── */
.k9-banner-empty {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: #64748b;
    font-size: 0.95rem;
}

.k9-banner-empty i {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

/* ─────────────────────────────────────────────
   RESPONSIVE MODAL
   ───────────────────────────────────────────── */
@media (max-width: 640px) {
    .banner-editor-card {
        max-height: 95vh;
        border-radius: 12px 12px 0 0;
        align-self: flex-end;
    }

    .banner-editor-body {
        padding: 1rem;
    }

    .banner-editor-form .be-form-row {
        grid-template-columns: 1fr;
    }

    .banner-editor-footer {
        flex-wrap: wrap;
    }

    .be-btn {
        flex: 1;
        justify-content: center;
    }
}
