/**
 * 底部彈出菜單樣式 - Instagram 風格
 */

/* 菜單模態框 */
.post-menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000; /* 確保在 post-detail (z-index: 10000) 之上 */
    display: flex;
    align-items: flex-end;
}

/* 背景遮罩 */
.menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* 菜單面板 */
.menu-sheet {
    position: relative;
    width: 100%;
    max-width: 100vw;
    background: var(--white, #ffffff);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    z-index: 100001; /* 確保菜單面板在最前面 */
}

/* 顯示狀態 */
.post-menu-modal.show .menu-sheet {
    transform: translateY(0);
}

/* 菜單標題區域 */
.menu-header {
    position: relative;
    padding: 20px 24px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.01);
}

/* 拖拽手柄 */
.menu-handle {
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    margin: 0 auto 16px;
    transition: background 0.2s ease;
}

.menu-handle:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* 菜單標題 */
.menu-title {
    font-size: 17px;
    font-weight: 600;
    color: #262626;
    margin: 0;
    letter-spacing: -0.01em;
}

/* 菜單選項容器 */
.menu-options {
    padding: 8px 0 24px;
    max-height: 60vh;
    overflow-y: auto;
}

/* 菜單選項 */
.menu-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px 20px;
    background: none;
    border: none;
    text-decoration: none;
    color: #262626;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    min-height: 56px;
}

.menu-option:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #262626;
    text-decoration: none;
}

.menu-option:active {
    background: rgba(0, 0, 0, 0.08);
}

/* 選項圖標 */
.option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 16px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.menu-option:hover .option-icon {
    transform: scale(1.05);
}

.option-icon i {
    font-size: 16px;
    color: #262626;
    transition: color 0.2s ease;
}

/* 選項文字 */
.option-text {
    flex: 1;
    text-align: left;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 500;
    color: #262626;
    transition: color 0.2s ease;
}

.menu-option:hover .option-text {
    color: #1a1a1a;
}

/* 選項箭頭 */
.option-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-left: 12px;
    flex-shrink: 0;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.menu-option:hover .option-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.option-arrow i {
    font-size: 14px;
    color: #8e8e8e;
    transition: color 0.2s ease;
}

.menu-option:hover .option-arrow i {
    color: #666;
}

/* 儲存選項特殊樣式 */
.menu-option.save-option {
    position: relative;
}

.menu-option.save-option[aria-pressed="true"] .option-icon i {
    color: #1da1f2;
}

.menu-option.save-option[aria-pressed="true"] .option-text {
    color: #1da1f2;
}

/* 收藏選項特殊樣式 */
.menu-option.bookmark-option {
    position: relative;
    transition: all 0.3s ease;
}

/* 收藏選項圖標顏色 - 統一使用 primary-dark */
.menu-option.bookmark-option .option-icon i {
    color: var(--primary-dark);
}

/* 編輯選項特殊樣式 */
.menu-option.edit-option .option-icon i {
    color: #22c55e;
}

/* 複製連結選項特殊樣式 */
.menu-option.copy-link-option .option-icon i {
    color: #a855f7;
}

/* 分隔線 */
.menu-option + .menu-option {
    border-top: 1px solid rgba(0, 0, 0, 0.04);
    margin-top: 2px;
}

/* 響應式設計 */
@media (min-width: 768px) {
    .menu-sheet {
        max-width: 400px;
        margin: 0 auto;
        border-radius: 20px;
        margin-bottom: 20px;
    }
    
    .post-menu-modal {
        align-items: center;
        justify-content: center;
        padding: 20px;
    }
    
    .menu-sheet {
        transform: scale(0.8) translateY(50px);
        opacity: 0;
    }
    
    .post-menu-modal.show .menu-sheet {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* 動畫效果 */
@keyframes menuSlideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes menuSlideDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .menu-sheet {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .menu-title,
    .option-text {
        color: #ffffff;
    }
    
    .option-icon i {
        color: #ffffff;
    }
    
    .menu-option:hover {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .menu-handle {
        background: rgba(255, 255, 255, 0.3);
    }
    
    .menu-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .menu-option + .menu-option {
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* 滾動條樣式 */
.menu-options::-webkit-scrollbar {
    width: 2px;
}

.menu-options::-webkit-scrollbar-track {
    background: transparent;
}

.menu-options::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1px;
}

/* 觸摸設備優化 */
@media (hover: none) and (pointer: coarse) {
    .menu-option {
        padding: 20px 24px;
        font-size: 18px;
    }
    
    .option-icon {
        width: 28px;
        height: 28px;
        margin-right: 20px;
    }
    
    .option-icon i {
        font-size: 20px;
    }
}

/* 菜單觸發按鈕保持原有樣式 */
.post-menu-toggle {
    background: transparent !important;
    border: none;
    color: #262626;
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.2s ease;
    outline: none;
    font-size: 1.1rem;
}

.post-menu-toggle:hover,
.post-menu-toggle:focus {
    background: rgba(0, 0, 0, 0.05) !important;
}

/* 過渡動畫優化 */
.post-menu-modal {
    transition: opacity 0.3s ease;
    opacity: 0;
}

.post-menu-modal.show {
    opacity: 1;
}

/* 無障礙支持 */
.menu-option:focus {
    outline: 2px solid #1da1f2;
    outline-offset: -2px;
}

/* 高對比度模式 */
@media (prefers-contrast: high) {
    .menu-option {
        border: 1px solid transparent;
    }
    
    .menu-option:focus {
        border-color: #000000;
        outline: none;
    }
    
    .menu-option.danger {
        border-color: #ff3040;
    }
}

/* 額外的美化效果 */

/* 載入狀態 */
.menu-option.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* 成功狀態動畫 */
.menu-option.success .option-icon {
    /* 移除動畫，保持簡潔 */
}

/* 菜單開啟動畫優化 */
.menu-sheet {
    /* 保持原有的過渡效果 */
}

/* 菜單關閉動畫 */
.menu-sheet.closing {
    /* 移除複雜動畫，保持簡潔 */
}

/* 選項點擊效果 */
.menu-option:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* 圖標懸停效果 */
.menu-option:hover .option-icon {
    /* 保持簡潔，只保留縮放效果 */
}

/* 文字懸停效果 */
.menu-option:hover .option-text {
    /* 移除位移效果，保持簡潔 */
}

/* 特殊選項的漸變背景 */
.menu-option.edit-option:hover {
    background: rgba(34, 197, 94, 0.04);
}

.menu-option.save-option:hover {
    background: rgba(29, 161, 242, 0.04);
}

.menu-option.copy-link-option:hover {
    background: rgba(168, 85, 247, 0.04);
}

.menu-option.danger:hover {
    background: rgba(255, 48, 64, 0.04);
}

/* 菜單背景模糊效果增強 */
.menu-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 菜單面板陰影增強 */
.menu-sheet {
    box-shadow: 
        0 -4px 24px rgba(0, 0, 0, 0.15),
        0 -8px 32px rgba(0, 0, 0, 0.1);
}

/* 響應式優化 */
@media (max-width: 480px) {
    .menu-option {
        padding: 18px 20px;
        min-height: 60px;
    }
    
    .option-icon {
        width: 32px;
        height: 32px;
        margin-right: 18px;
    }
    
    .option-icon i {
        font-size: 18px;
    }
    
    .option-text {
        font-size: 17px;
    }
}

/* 深色模式下的特殊效果 */
@media (prefers-color-scheme: dark) {
    
    .menu-sheet {
        box-shadow: 
            0 -4px 24px rgba(0, 0, 0, 0.3),
            0 -8px 32px rgba(0, 0, 0, 0.2);
    }
    
    .menu-option.edit-option:hover {
        background: rgba(34, 197, 94, 0.08);
    }
    
    .menu-option.save-option:hover {
        background: rgba(29, 161, 242, 0.08);
    }
    
    .menu-option.copy-link-option:hover {
        background: rgba(168, 85, 247, 0.08);
    }
    
    .menu-option.danger:hover {
        background: rgba(255, 48, 64, 0.08);
    }
}

/* 刪除確認視窗樣式 */
.delete-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000000; /* 確保在選單 (z-index: 100000) 上方 */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* 背景遮罩 */
.delete-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 確認視窗 */
.delete-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px 24px 28px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: deleteModalSlideIn 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes deleteModalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 警告圖標 */
.delete-icon {
    margin-bottom: 20px;
}

.delete-icon i {
    font-size: 48px;
    color: #ff3040;
    animation: deleteIconPulse 2s infinite;
}

@keyframes deleteIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* 標題 */
.delete-title {
    font-size: 20px;
    font-weight: 600;
    color: #262626;
    margin: 0 0 12px 0;
    line-height: 1.3;
}

/* 描述文字 */
.delete-description {
    font-size: 16px;
    color: #666;
    margin: 0 0 32px 0;
    line-height: 1.5;
}

/* 按鈕組 */
.delete-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* 按鈕基礎樣式 */
.delete-confirm-modal .delete-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 取消按鈕 */
.delete-confirm-modal .delete-btn.cancel-btn {
    background: #f3f4f6;
    color: #374151;
}

.delete-confirm-modal .delete-btn.cancel-btn:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.delete-confirm-modal .delete-btn.cancel-btn:active {
    transform: translateY(0);
}

/* 確認刪除按鈕 */
.delete-confirm-modal .delete-btn.confirm-btn {
    background: #ff3040;
    color: #ffffff;
}

.delete-confirm-modal .delete-btn.confirm-btn:hover {
    background: #e02432;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 48, 64, 0.3);
}

.delete-confirm-modal .delete-btn.confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 48, 64, 0.2);
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .delete-dialog {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .delete-title {
        color: #ffffff;
    }
    
    .delete-description {
        color: #a0a0a0;
    }
    
    .delete-confirm-modal .delete-btn.cancel-btn {
        background: #374151;
        color: #ffffff;
    }
    
    .delete-confirm-modal .delete-btn.cancel-btn:hover {
        background: #4b5563;
    }
}

/* 響應式設計 */
@media (max-width: 480px) {
    .delete-confirm-modal {
        padding: 16px;
    }
    
    .delete-dialog {
        padding: 24px 20px 20px;
    }
    
    .delete-icon i {
        font-size: 40px;
    }
    
    .delete-title {
        font-size: 18px;
    }
    
    .delete-description {
        font-size: 15px;
        margin: 0 0 28px 0;
    }
    
    .delete-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .delete-confirm-modal .delete-btn {
        width: 100%;
        padding: 14px 24px;
        min-width: auto;
        height: 44px;
    }
}

/* 無障礙支援 */
.delete-confirm-modal .delete-btn:focus {
    outline: 2px solid #1da1f2;
    outline-offset: 2px;
}

/* 載入狀態 */
.delete-confirm-modal .delete-btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.delete-confirm-modal .delete-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 關閉動畫 */
.delete-confirm-modal.closing {
    opacity: 0;
}

.delete-confirm-modal.closing .delete-dialog {
    transform: scale(0.9) translateY(-20px);
    opacity: 0;
}

/* 貼文卡片刪除動畫 */
.post-card.deleting {
    opacity: 0.5;
    transform: scale(0.95);
    transition: all 0.3s ease;
}

/* 按鈕禁用狀態 */
.delete-confirm-modal .delete-btn.disabled {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

/* 確保按鈕可以被點擊 */
.delete-confirm-modal .delete-btn {
    pointer-events: auto !important;
    position: relative;
    z-index: 1000001;
    cursor: pointer !important;
}

/* 確保對話框不會阻止按鈕點擊 */
.delete-dialog {
    pointer-events: auto;
    position: relative;
    z-index: 1000002;
}

/* 確保按鈕組不會被覆蓋 */
.delete-actions {
    pointer-events: auto;
    position: relative;
    z-index: 1000003;
}

/* 特別確保取消按鈕可以點擊 */
.delete-cancel-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    user-select: none !important;
    position: relative;
    z-index: 1000004;
}

.delete-cancel-btn:hover {
    opacity: 0.9;
}

.delete-cancel-btn:active {
    transform: scale(0.98);
}

/* 特別確保確認刪除按鈕可以點擊 */
.delete-confirm-btn {
    pointer-events: auto !important;
    cursor: pointer !important;
    user-select: none !important;
    position: relative;
    z-index: 1000004;
}

.delete-confirm-btn:hover {
    opacity: 0.9;
}

.delete-confirm-btn:active {
    transform: scale(0.98);
}

/* 加強載入狀態的視覺效果 */
.delete-confirm-modal .delete-btn.loading {
    position: relative;
    color: transparent;
}

.delete-confirm-modal .delete-btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: white;
}



/* 危險操作樣式 */
.menu-option.danger {
    color: #ff3040 !important;
}

.menu-option.danger .option-icon i {
    color: #ff3040 !important;
}

.menu-option.danger:hover {
    background: rgba(255, 48, 64, 0.06);
}

.menu-option.danger .option-text {
    color: #ff3040 !important;
}
