/* ============================================
   統一的下拉選單/覆蓋面板系統
   適用於：搜尋、通知、會員選單
   ============================================ */

/* 基礎樣式 - 所有覆蓋面板共用 */
.header-icon {
    position: relative;
}

.header-icons {
    position: relative;
}

.header-icon.dropdown {
    position: relative;
}

.overlay-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: none !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    transform: translateY(-10px);
    overflow: hidden;
    pointer-events: none;
}

.overlay-panel.active {
    display: flex !important;
    flex-direction: column;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* 關閉按鈕 - 統一樣式 */
.overlay-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #666;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.overlay-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: rotate(90deg);
}

/* 桌面版樣式 */
@media (min-width: 769px) {
    /* 搜尋面板 */
    .search-panel {
        width: 450px;
        max-width: calc(100vw - 40px);
        padding: 24px;
        margin-top: 12px;
    }
    
    /* 通知面板 */
    .notification-panel {
        width: 400px;
        max-width: calc(100vw - 40px);
        max-height: 600px;
        margin-top: 12px;
    }
    
    /* 會員面板 */
    .member-panel {
        width: 280px;
        min-width: 240px;
        margin-top: 12px;
        padding: 8px 0;
    }
    
    /* 桌面版關閉按鈕隱藏 */
    .overlay-close-btn {
        display: none;
    }
}

/* 移動版/平板版樣式 - 全屏覆蓋 */
@media (max-width: 768px) {
    .overlay-panel.active {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 6vh 0 0 0 !important;
        z-index: 1005 !important;
        animation: slideDownFullScreen 0.3s ease-out;
    }
    
    .overlay-panel.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, #2D5B69 0%, #1a3d47 100%);
        z-index: 1;
    }
    
    .overlay-panel.active > * {
        position: relative;
        z-index: 2;
    }
    
    /* 移動版關閉按鈕 */
    .overlay-panel.active .overlay-close-btn {
        position: fixed !important;
        top: 12px !important;
        left: 10px !important;
        width: 44px !important;
        height: 44px !important;
        background: rgba(255, 255, 255, 0.2) !important;
        backdrop-filter: blur(10px) !important;
        border: 2px solid rgba(255, 255, 255, 0.3) !important;
        color: white !important;
        font-size: 20px !important;
        z-index: 1006 !important;
        display: flex !important;
    }
    
    .overlay-close-btn:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg) scale(1.1);
    }
    
}

/* 動畫 */
@keyframes slideDownFullScreen {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   搜尋面板專用樣式
   ============================================ */
.search-panel form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-panel .search-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: stretch;
    width: 100%;
}

.search-panel .form-control {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-panel .form-control:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.search-panel .btn-primary {
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 500;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .search-panel.active form {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100% - 40px);
        max-width: 500px;
        z-index: 2;
    }
    
    .search-panel.active .form-control {
        background: rgba(255, 255, 255, 0.98);
        border-color: rgba(255, 255, 255, 0.4);
        font-size: 18px;
        padding: 18px 24px;
    }
    
    .search-panel.active .form-control:focus {
        background: white;
        border-color: #4CAF50;
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.25), 0 6px 24px rgba(0, 0, 0, 0.15);
    }
}

/* ============================================
   通知面板專用樣式
   ============================================ */
.notification-panel {
    display: flex;
    flex-direction: column;
}

.notification-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.notification-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.notification-actions {
    display: flex;
    gap: 12px;
}

.notification-actions button,
.notification-actions a {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: #f5f5f5;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.notification-actions button:hover,
.notification-actions a:hover {
    background: #4CAF50;
    color: white;
}

.notification-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    max-height: 400px;
}

.notification-footer {
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    background: white;
}

.notification-footer a {
    color: #4CAF50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.notification-footer a:hover {
    color: #45a049;
}

@media (max-width: 768px) {
    .notification-panel.active .notification-header,
    .notification-panel.active .notification-list,
    .notification-panel.active .notification-footer {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        margin: 20px;
        border-radius: 16px;
    }
    
    .notification-panel.active .notification-header {
        margin-bottom: 12px;
    }
    
    .notification-panel.active .notification-list {
        margin: 0 20px;
        max-height: calc(100vh - 200px);
    }
    
    .notification-panel.active .notification-footer {
        margin-top: 12px;
    }
}

/* ============================================
   會員面板專用樣式
   ============================================ */
.member-panel {
    display: flex;
    flex-direction: column;
}

.member-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.member-menu-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    background: white;
}

.member-menu-header strong {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 4px;
}

.member-menu-header small {
    display: block;
    font-size: 13px;
    color: #666;
}

.member-menu-item {
    display: block;
    padding: 14px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    border-bottom: 1px solid #f8f8f8;
}

.member-menu-item:hover {
    background: #f8f9fa;
    color: #4CAF50;
    padding-left: 24px;
}

.member-menu-item.text-danger {
    color: #e74c3c;
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
}

.member-menu-item.text-danger:hover {
    background: #fee;
    color: #c82333;
}

@media (max-width: 768px) {
    .member-panel.active .member-menu-list {
        margin: 20px;
        flex: 1;
        overflow-y: auto;
    }
    
    .member-panel.active .member-menu-header {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        margin: 20px 20px 0 20px;
        border-radius: 16px;
    }
    
    .member-panel.active .member-menu-item {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        margin: 8px 20px;
        border-radius: 12px;
        border: none;
    }
}

