/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(50px);
        opacity: 0;
    }
}

/* Modal Styles */
.banner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.banner-modal.show {
    display: flex;
    opacity: 1;
}

.banner-modal.hiding {
    opacity: 0;
}

.banner-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.banner-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.banner-modal.show .banner-modal-content {
    transform: translateY(0);
    opacity: 1;
}

.banner-modal.hiding .banner-modal-content {
    transform: translateY(50px);
    opacity: 0;
}

/* Close Button (X) - DIPINDAHKAN ke dalam banner-image */
.banner-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
    line-height: 1;
    padding: 0;
}

.banner-close-btn:hover {
    background: rgba(220, 53, 69, 0.9);
    transform: rotate(90deg) scale(1.1);
}

.banner-close-btn span {
    display: block;
    line-height: 1;
}

/* Banner Items */
.banner-item {
    display: none;
    flex: 1;
    flex-direction: column;
}

.banner-item.active {
    display: flex;
    animation: slideInUp 0.4s ease-out forwards;
}

.banner-item.exiting {
    animation: slideOutDown 0.3s ease-in forwards;
}

.banner-image {
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    /* Pastikan banner-image memiliki posisi relative untuk tombol close */
}

.banner-image img {
    width: 100%;
    height: auto;
    max-height: 60vh;
    /* Batasi tinggi maksimal gambar */
    object-fit: contain;
    /* Pastikan gambar tidak terdistorsi */
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    display: block;
}

.banner-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    max-height: 30vh;
    /* Batasi tinggi konten teks */
}

.banner-body h3 {
    margin: 0 0 12px 0;
    color: #212529;
    font-size: 1.5rem;
    font-weight: 600;
}

.banner-description {
    color: #6c757d;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Style untuk konten HTML dari TinyMCE */
.banner-description p {
    margin: 0 0 12px 0;
}

.banner-description p:last-child {
    margin-bottom: 0;
}

.banner-description ul,
.banner-description ol {
    margin: 12px 0;
    padding-left: 20px;
}

.banner-description li {
    margin-bottom: 4px;
}

.banner-description strong {
    font-weight: 600;
    color: #495057;
}

.banner-description em {
    font-style: italic;
}

.banner-description a {
    color: #007bff;
    text-decoration: underline;
}

.banner-description a:hover {
    color: #0056b3;
}

/* Banner Controls */
.banner-controls {
    padding: 16px 24px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    flex-shrink: 0;
}

.dont-show-again {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dont-show-again .form-check-input {
    cursor: pointer;
    margin: 0;
}

.dont-show-again .form-check-label {
    margin: 0;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    user-select: none;
}

.banner-actions {
    display: flex;
    gap: 10px;
}

.banner-actions .btn {
    transition: all 0.3s ease;
}

.banner-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Scrollbar Styling */
.banner-body::-webkit-scrollbar {
    width: 6px;
}

.banner-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.banner-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.banner-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 576px) {
    .banner-modal-content {
        max-width: 95%;
        border-radius: 8px;
    }

    .banner-close-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }

    .banner-image img {
        max-height: 50vh;
        /* Lebih kecil di mobile */
    }

    .banner-body {
        padding: 20px 16px;
        max-height: 25vh;
        /* Lebih kecil di mobile */
    }

    .banner-body h3 {
        font-size: 1.25rem;
    }

    .banner-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .dont-show-again {
        justify-content: center;
    }

    .banner-actions {
        justify-content: center;
    }
}

/* Style untuk banner tanpa gambar */
.banner-item:not(:has(.banner-image)) .banner-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}
