/* ===== Pop-up Dialog ===== */
/* ===== Dialog 關閉狀態 ===== */
.dialog {
    display:block;
    width: 340px;
    position: fixed;
    top:0;
    left: 50%;
    
    border-radius: 5px;
    overflow: hidden;
    border: none;
    filter: drop-shadow(0 4px 60px rgba(170, 170, 170, 1));
    color: var(--secondary);

    /* 動畫的核心：預設為透明、不可見 */
    opacity: 0;
    transform: translateX(-50%) scale(0.95);
    visibility: hidden;
    transition: opacity 0.3s, transform 0.3s, visibility 0.3s, top 0.3s;
}

/* Dialog 打開時的狀態 */
.dialog[open] {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    visibility: visible;
    top: 80px;
}

/* 背景遮罩 */
.dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.dialog[open]::backdrop {
    opacity: 1;
}

.dialog__close-btn {
    height: 30px;
    width: 30px;
    position: absolute;
    top: 20px;
    right: 10px;
    z-index: 3;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}


.dialog__close-btn img {
    height: 16px;
    width: 16px;
}

.dialog__decorator-bar {
    width: 100%;
    height: 10px;
    background-image: linear-gradient(to right, rgba(102, 170, 187, 1), rgba(51, 119, 136, 1));
}

.dialog__wapper {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 15px;
}

.dialog__form {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
}

.dialog__title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.dialog__field {
    width: 100%;
}

.dialog__input {
    padding: 15px;
    border-radius: 5px;
    border: 1px solid rgba(204, 204, 204, 1);
    width: 100%;
}

.dialog__input::placeholder {
    font-size: 1rem;
    font-weight: 500;
    transform: translateY(2px);
}

.dialog__form-btn {
    background-color: var(--primary);
    color: var(--bg);
    line-height: 16px;
    font-size: 19px;
    font-weight: 400;
    border-radius: 5px;
    width: 100%;
    padding: 15px 20px;
    transition: all 0.2s ease;
}

.dialog__form-btn:hover {
    background-color: #397281;
}

.dialog__form-btn:disabled {
    opacity: 0.8;
    cursor: progress;
}

.dialog__message {
    color: tomato;
    font-weight: 700;
    display: none;
}

.dialog__switch {
    height: 22px;
    cursor: pointer;
}

.dialog__switch:hover {
    text-decoration: underline;
}

/* loading effect */
.loading-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.hidden {
    display: none;
}

/* 簡單的轉圈圈動畫 */
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}