/* ======================================================= */
/* CSS UNTUK SEKSI UCAPAN - (REVISI FINAL DENGAN JS HEIGHT)*/
/* ======================================================= */

.ucapan {
    width: 100%;
    margin-top: 4rem;
    margin-bottom: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

/* --- Gaya Form Ucapan --- */
.ucapan-form-container {
    width: 100%;
    max-width: 500px;
    padding: 4rem 1.5rem;
    background-image: url('../assets/images/miftah/bg-ucapan.png');
    background-size: cover;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.ucapan-form-container h3 {
    font-size: 1.8rem;
    font-family: var(--sacramento);
    font-weight: 600;
    color: var(--main-text-color);
}

.ucapan-form-container p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    font-weight: 400;
}

.ucapan-form-container form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--main-text-color);
    opacity: 0.5;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 3rem;
    border-radius: 30px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    color: var(--main-text-color);
    font-family: 'Josefin Sans', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.7rem top 50%;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.input-group textarea {
    border-radius: 20px;
    min-height: 120px;
    resize: vertical;
    padding-top: 1rem;
}

.ucapan-form-container form button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    color: #fff;
    background: linear-gradient(45deg, #a855f7, #6366f1);
    padding: 0.9rem 0;
    border-radius: 30px;
    margin-top: 1rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.ucapan-form-container form button:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* --- Gaya Linimasa --- */
.timeline-wrapper {
    /* KUNCI UTAMA ADA DI DUA BARIS INI */
    position: relative;
    /* Membuat wadah ini sebagai referensi posisi */
    overflow: hidden;
    /* Memastikan efek blur tidak "bocor" keluar */

    /* Gaya asli Anda dipertahankan */
    width: 100%;
    max-width: 500px;
    padding: 4rem 1.5rem;
    background-image: url('../assets/images/miftah/bg-ucapan.png');
    background-size: cover;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    text-align: center;

    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}


.timeline-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    -webkit-backdrop-filter: blur(5px);
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);

    z-index: 1;
    /* Lapisan kaca ada di level 1 */
}

.ucapan-header,
.timeline-scrollbox {
    position: relative;
    z-index: 2;
    /* Konten ada di level 2, di atas kaca */
}

.ucapan-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-left: 10px;
}

.ucapan-header h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.timeline-scrollbox {
    max-height: 450px;
    overflow-y: auto;
    padding: 10px 10px 10px 0;
    position: relative;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 20px;
    width: 2px;
    background-color: var(--main-text-color);
    transition: height 0.3s ease;
    /* Transisi untuk tinggi garis */
}

.timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-item-empty {
    text-align: center;
    width: 100%;
    list-style: none;
}

.timeline-node {
    flex-shrink: 0;
    width: 40px;
    position: relative;
    z-index: 2;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    border: 2px solid #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.timeline-content-ucapan {
    flex-grow: 1;
    background-color: var(--main-bg-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

.timeline-content-ucapan::before {
    content: '';
    position: absolute;
    top: 15px;
    left: -10px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid #fff;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--main-text-color);
    position: relative;
}

.name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #6366f1;
}

.status {
    font-size: 0.7rem;
    font-weight: 500;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 3px 8px;
    border-radius: 10px;
    color: #a855f7;
}

.message {
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    margin-bottom: auto;
    color: var(--main-text-color);
}

.timestamp {
    font-size: 0.7rem;
    color: #000000;
    opacity: 0.8;
    align-self: flex-start;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--main-text-color);
    width: 100%;
}

.timeline-scrollbox::-webkit-scrollbar {
    width: 6px;
}

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

.timeline-scrollbox::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.timeline-scrollbox::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* (PERBAIKAN) Gaya untuk placeholder loading */
@keyframes pulse {
    0% {
        background-color: #eee;
    }

    50% {
        background-color: #e0e0e0;
    }

    100% {
        background-color: #eee;
    }
}

.timeline-item-loading .timeline-content-ucapan,
.timeline-item-loading .timeline-content-ucapan::before {
    background-color: #f9f9f9;
}

.skeleton {
    animation: pulse 1.5s ease-in-out infinite;
    background-color: #eee;
    border-radius: 4px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-line {
    height: 1em;
    margin-bottom: 0.5rem;
}

.timeline-item-loading .timeline-content-ucapan {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Tambahkan di akhir file ucapan.css */

.host-reply {
    margin-top: 1rem;
    padding: 0.8rem;
    background-color: #f3f4f6;
    /* Warna latar sedikit beda */
    border-left: 3px solid var(--main-text-color);
    border-radius: 0 4px 4px 0;
}

.host-reply strong {
    font-size: 0.8rem;
    color: var(--main-text-color);
}

.host-reply p {
    margin: 0.3rem 0 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
    font-style: italic;
}

.edit-ucapan-btn {
    position: absolute;
    bottom: .3rem;
    /* <-- Diubah dari top */
    right: 0.8rem;
    /* <-- Sedikit disesuaikan agar tidak terlalu mepet */
    background: transparent;
    border: none;
    color: var(--main-text-color);
    opacity: 0.5;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem;
    transition: opacity 0.2s ease;
}

.edit-ucapan-btn:hover {
    opacity: 1;
}

.edit-container {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.edit-textarea {
    width: 100%;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--main-bg-color);
    color: var(--main-text-color);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.edit-actions button {
    padding: 0.3rem 0.8rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.edit-actions button:hover {
    opacity: 0.8;
}

.cancel-edit-btn {
    background-color: #e0e0e0;
    color: #333;
}

.save-edit-btn {
    background-color: #6366f1;
    color: white;
}

.save-edit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Animasi kilat saat berhasil update */
@keyframes flash {
    0% {
        background-color: rgba(76, 175, 80, 0);
    }

    50% {
        background-color: rgba(76, 175, 80, 0.2);
    }

    100% {
        background-color: rgba(76, 175, 80, 0);
    }
}

.timeline-item.success-flash {
    animation: flash 1s ease-out;
}

/* ▼▼▼ AWAL PERUBAHAN (Tambahkan di akhir file) ▼▼▼ */
/* --- Style untuk Fitur Pop-up Ucapan Proaktif --- */

.ucapan-popup-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ucapan-popup-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.ucapan-popup-content {
    background-color: var(--card-bg-color);
    border-radius: 15px;
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.ucapan-popup-overlay.visible .ucapan-popup-content {
    transform: scale(1);
}

/* Menggunakan kembali gaya dari form utama, namun dalam konteks pop-up */
.ucapan-popup-content .ucapan-form-container {
    padding: 0;
    background-image: none;
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
}

/* ▲▲▲ AKHIR PERUBAHAN ▲▲▲ */

.ucapan-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    /* Mulai dari bawah layar */
    background-color: #d32f2f;
    /* Warna merah untuk error */
    color: white;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    /* Pastikan di atas segalanya */
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.ucapan-toast.visible {
    transform: translateX(-50%) translateY(0);
    /* Bergerak ke posisi akhir */
    opacity: 1;
}