/* FlyPingStart 管理後台自定義樣式 */

/* 全局樣式 */
:root {
    --flyping-primary: #007bff;
    --flyping-secondary: #6c757d;
    --flyping-success: #28a745;
    --flyping-danger: #dc3545;
    --flyping-warning: #ffc107;
    --flyping-info: #17a2b8;
    --flyping-light: #f8f9fa;
    --flyping-dark: #343a40;
}

/* 品牌樣式 */
.brand-link {
    border-bottom: 1px solid var(--bs-border-color);
}

.brand-link .brand-image {
    margin-top: -3px;
    margin-right: 10px;
    max-height: 33px;
    width: auto;
}

/* 側邊欄樣式（AdminLTE 4） */
.app-sidebar {
    box-shadow: 0 14px 28px rgba(var(--bs-black-rgb), .25), 0 10px 10px rgba(var(--bs-black-rgb), .22);
}

.sidebar .nav-link {
    border-radius: 0.25rem;
    margin: 0 0.5rem;
}

.sidebar .nav-link.active {
    background-color: var(--flyping-primary);
    color: white;
}

.sidebar .nav-link:hover {
    background-color: rgba(var(--bs-white-rgb), .1);
}

/* 優化導航圖標和文字 */
.nav-sidebar .nav-icon {
    font-size: 0.9rem !important; /* 縮小圖標 */
    width: 1.2rem !important;
    text-align: center;
    margin-right: 0.6rem !important; /* 減少圖標和文字間距 */
}

.nav-sidebar .nav-item .nav-link p {
    margin: 0 !important;
    font-size: 0.9rem !important; /* 縮小文字 */
    line-height: 1.2 !important;
}

/* 優化子選單 */
.nav-treeview .nav-link {
    padding: 0.3rem 0.8rem 0.3rem 2.2rem !important; /* 減少子選單內邊距 */
    font-size: 0.85rem !important; /* 縮小子選單字體 */
}

.nav-treeview .nav-icon {
    font-size: 0.7rem !important; /* 縮小子選單圖標 */
    margin-right: 0.5rem !important;
}

/* 優化選單標題 */
.nav-header {
    padding: 0.8rem 1rem 0.4rem 1rem !important; /* 減少標題內邊距 */
    font-size: 0.75rem !important; /* 縮小標題字體 */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem !important;
}

/* 內容區域樣式 */
.content-wrapper {
    background-color: var(--bs-body-bg);
}

.content-header {
    padding: 15px 0;
}

.content-header h1 {
    font-size: 1.8rem;
    font-weight: 500;
    margin: 0;
}

/* 卡片樣式 */
.card {
    box-shadow: 0 0 1px rgba(var(--bs-black-rgb), .125), 0 1px 3px rgba(var(--bs-black-rgb), .2);
    border: none;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(var(--bs-black-rgb), .125);
    padding: 0.75rem 1.25rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

/* 統計卡片樣式 */
.small-box {
    border-radius: 0.5rem;
    box-shadow: 0 0 1px rgba(var(--bs-black-rgb), .125), 0 1px 3px rgba(var(--bs-black-rgb), .2);
    display: block;
    margin-bottom: 20px;
    position: relative;
}

.small-box > .inner {
    padding: 10px;
}

.small-box h3 {
    font-size: 2.2rem;
    font-weight: bold;
    margin: 0 0 10px 0;
    white-space: nowrap;
    padding: 0;
}

.small-box p {
    font-size: 1rem;
    margin: 0;
}

.small-box .icon {
    color: rgba(var(--bs-black-rgb), .15);
    z-index: 0;
}

.small-box .icon > i {
    font-size: 70px;
    position: absolute;
    right: 15px;
    top: 15px;
}

.small-box .small-box-footer {
    background-color: rgba(var(--bs-black-rgb), .1);
    color: rgba(var(--bs-white-rgb), .8);
    display: block;
    padding: 3px 0;
    position: relative;
    text-align: center;
    text-decoration: none;
    z-index: 10;
}

.small-box .small-box-footer:hover {
    color: #fff;
    background-color: rgba(var(--bs-black-rgb), .15);
}

/* 表格樣式 */
.table {
    background-color: var(--bs-body-bg);
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--bs-secondary-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-black-rgb), .075);
}

/* 按鈕樣式 */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--flyping-primary);
    border-color: var(--flyping-primary);
}

.btn-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* 徽章樣式 */
.badge {
    font-weight: 500;
    border-radius: 0.375rem;
}

/* 警告框樣式 */
.alert {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0 1px rgba(var(--bs-black-rgb), .125), 0 1px 3px rgba(var(--bs-black-rgb), .2);
}

/* 分頁樣式 */
.pagination {
    margin: 0;
}

.page-link {
    border-radius: 0.375rem;
    margin: 0 2px;
    border: 1px solid var(--bs-border-color);
}

.page-item.active .page-link {
    background-color: var(--flyping-primary);
    border-color: var(--flyping-primary);
}

/* 表單樣式 */
.form-control {
    border-radius: 0.375rem;
    border: 1px solid var(--bs-border-color);
}

.form-control:focus {
    border-color: var(--flyping-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* 載入動畫 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(var(--bs-black-rgb), 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bs-secondary-bg);
    border-top: 4px solid var(--flyping-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* @keyframes spin 已收斂至 common/global-styles.css（全站單一真值，TD-09） */

/* 響應式設計 */
@media (max-width: 768px) {
    .content-header h1 {
        font-size: 1.5rem;
    }

    .small-box h3 {
        font-size: 1.8rem;
    }

    .small-box .icon > i {
        font-size: 50px;
        right: 10px;
        top: 10px;
    }
}

/* 深色模式：已改由 data-bs-theme 手動切換（theme-dark.css）統一處理。
   原本這裡的 @media (prefers-color-scheme: dark) 區塊是無效的——它把顏色換成
   var(--bs-body-bg) 等 token，但 Bootstrap 5.3 只在 [data-bs-theme=dark] 下重定義這些
   token、不掛媒體查詢，所以 OS 深色時解析出來仍是淺色值。且與手動切換並存會造成
   「OS 深色 + 使用者選淺色」的半深半淺破圖。 */

/* 自定義工具提示 */
.tooltip-inner {
    background-color: var(--bs-dark);
    color: var(--bs-light);
    border-radius: 0.375rem;
}

/* 狀態指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-active {
    background-color: var(--flyping-success);
}

.status-inactive {
    background-color: var(--flyping-secondary);
}

.status-suspended {
    background-color: var(--flyping-warning);
}

.status-banned {
    background-color: var(--flyping-danger);
}

/* 通知系統樣式 */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    pointer-events: none;
}

.notification {
    position: relative;
    background: var(--bs-body-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(var(--bs-black-rgb), 0.15);
    margin-bottom: 10px;
    padding: 16px;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    overflow: hidden;
    pointer-events: auto;
}

/* SweetAlert2 Toast 不應阻擋頁面操作 */
.swal2-container.swal2-top-end,
.swal2-container.swal2-top-right,
.swal2-container.swal2-top-left,
.swal2-container.swal2-top-start {
    pointer-events: none;
}

.swal2-container.swal2-top-end .swal2-toast,
.swal2-container.swal2-top-right .swal2-toast,
.swal2-container.swal2-top-left .swal2-toast,
.swal2-container.swal2-top-start .swal2-toast {
    pointer-events: auto;
}

.notification.show {
    transform: translateX(0);
    opacity: 1;
}

.notification-success {
    border-left: 4px solid var(--flyping-success);
}

.notification-error {
    border-left: 4px solid var(--flyping-danger);
}

.notification-warning {
    border-left: 4px solid var(--flyping-warning);
}

.notification-info {
    border-left: 4px solid var(--flyping-info);
}

.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--flyping-primary), var(--bs-primary));
    border-radius: 0 0 8px 8px;
}

/* 表單增強樣式 */
.mb-3.has-validation .form-control.is-valid {
    border-color: var(--flyping-success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='m2.3 6.73.94-.94 1.88 1.88 3.75-3.75.94.94-4.69 4.69z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.mb-3.has-validation .form-control.is-invalid {
    border-color: var(--flyping-danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 4.6 1.4 1.4m0-1.4-1.4 1.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* 自動儲存指示器 */
.auto-save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 1000;
    display: none;
}

/* 圖表工具列 */
.chart-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.chart-toolbar .btn {
    background: rgba(var(--bs-white-rgb), 0.9);
    border: 1px solid rgba(var(--bs-black-rgb), 0.1);
    margin-left: 2px;
}

.chart-toolbar .btn:hover {
    background: var(--bs-body-bg);
    box-shadow: 0 2px 4px rgba(var(--bs-black-rgb), 0.1);
}

/* 動畫效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 懸停效果 */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(var(--bs-black-rgb), 0.1);
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.small-box:hover {
    transform: scale(1.02);
    transition: all 0.3s ease;
}

/* 進度條動畫 */
.progress-bar {
    transition: width 0.6s ease;
}

.progress-bar.animated {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* 表格增強 */
.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.table th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* 徽章動畫 */
.badge {
    transition: all 0.2s ease;
}

.badge:hover {
    transform: scale(1.1);
}

/* 模態框增強 */
.modal.fade .modal-dialog {
    transform: translate(0, -50px);
    transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

/* 側邊欄增強 */
.nav-sidebar .nav-item .nav-link {
    transition: all 0.3s ease;
}

.nav-sidebar .nav-item .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 1.5rem;
}

/* 搜索框增強 */
.form-control:focus {
    border-color: var(--flyping-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: scale(1.02);
    transition: all 0.2s ease;
}

/* 工具提示增強 */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: rgba(0, 0, 0, 0.9);
    border-radius: 6px;
    padding: 8px 12px;
}

/* 下拉選單增強 */
.dropdown-menu {
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    animation: fadeIn 0.2s ease;
}

.dropdown-item:hover {
    background-color: var(--bs-secondary-bg);
    transform: translateX(5px);
    transition: all 0.2s ease;
}

/* ==========================================================================
   分頁組件優化設計 - 企業級用戶體驗
   ========================================================================== */

/* 分頁容器基礎樣式 */
.pagination {
    margin: 0;
    gap: 4px;
}

/* 分頁按鈕基礎樣式 */
.pagination .page-link {
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    background-color: var(--bs-body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

/* 數字頁碼按鈕 - 圓形設計 */
.pagination .page-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 2px;
}

/* 導航按鈕 - 自適應寬度 */
.pagination .page-nav {
    padding: 8px 16px;
    border-radius: 20px;
    min-width: 44px;
    height: 40px;
    margin: 0 4px;
}

/* 省略號 */
.pagination .page-ellipsis {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 2px;
    border: none;
    background: transparent;
    color: var(--bs-secondary-color);
    cursor: default;
}

/* 懸停效果 */
.pagination .page-link:hover:not(.page-ellipsis) {
    background-color: var(--flyping-primary);
    border-color: var(--flyping-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.3);
}

/* 數字按鈕懸停效果 */
.pagination .page-number:hover {
    transform: translateY(-2px) scale(1.05);
}

/* 導航按鈕懸停效果 */
.pagination .page-nav:hover {
    transform: translateY(-2px);
}

/* 活動狀態 */
.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--flyping-primary), var(--flyping-secondary));
    border-color: var(--flyping-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(var(--bs-primary-rgb), 0.4);
    transform: translateY(-1px);
}

/* 禁用狀態 */
.pagination .page-item.disabled .page-link {
    color: var(--bs-secondary-color);
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.pagination .page-item.disabled .page-link:hover {
    transform: none;
    box-shadow: none;
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
}

/* 分頁資訊樣式 */
.pagination-info {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    margin: 0;
}

/* 焦點狀態 - 可訪問性 */
.pagination .page-link:focus {
    outline: 2px solid var(--flyping-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(var(--bs-primary-rgb), 0.25);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .pagination {
        gap: 2px;
    }

    .pagination .page-number {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .pagination .page-nav {
        padding: 6px 12px;
        height: 36px;
        font-size: 0.875rem;
    }

    .pagination .page-ellipsis {
        width: 36px;
        height: 36px;
    }

    .pagination-info {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .card-footer .d-flex {
        flex-direction: column;
        gap: 12px;
        align-items: center !important;
    }

    .pagination-info {
        order: 2;
        text-align: center;
    }

    .pagination {
        order: 1;
        justify-content: center;
    }

    .pagination .page-number {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
        margin: 0 1px;
    }

    .pagination .page-nav {
        padding: 4px 8px;
        height: 32px;
        font-size: 0.8rem;
        margin: 0 2px;
    }
}

/* 輸入群組增強 */
.input-group .form-control:focus {
    z-index: 3;
}

.input-group-text {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color);
    transition: all 0.2s ease;
}

.input-group:hover .input-group-text {
    background-color: var(--bs-tertiary-bg);
}

/* 卡片標題增強 */
.card-title {
    font-weight: 600;
    color: var(--flyping-dark);
}

.card-subtitle {
    color: var(--flyping-secondary);
    font-size: 0.9rem;
}

/* 按鈕群組增強 */
.btn-group .btn {
    transition: all 0.2s ease;
}

.btn-group .btn:hover {
    z-index: 2;
    transform: scale(1.05);
}

/* 標籤增強 */
.nav-tabs .nav-link {
    border-radius: 8px 8px 0 0;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    background-color: var(--bs-secondary-bg);
    transform: translateY(-2px);
}

.nav-tabs .nav-link.active {
    background-color: var(--bs-body-bg);
    border-color: var(--bs-border-color) var(--bs-border-color) var(--bs-body-bg);
    transform: translateY(-2px);
}

/* 警告框增強 */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.alert-dismissible .btn-close {
    padding: 0.75rem 1rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-dismissible .btn-close:hover {
    opacity: 1;
}

/* 麵包屑增強 */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: var(--flyping-secondary);
}

.breadcrumb-item a {
    color: var(--flyping-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: var(--flyping-dark);
    text-decoration: underline;
}

/* 列表群組增強 */
.list-group-item {
    border: none;
    border-bottom: 1px solid var(--bs-border-color);
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background-color: var(--bs-secondary-bg);
    transform: translateX(5px);
}

.list-group-item.active {
    background-color: var(--flyping-primary);
    border-color: var(--flyping-primary);
}

/* 載入狀態 */
.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 空狀態 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--flyping-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h4 {
    color: var(--flyping-dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* 骨架載入 */
.skeleton {
    background: linear-gradient(90deg, var(--bs-secondary-bg) 25%, var(--bs-tertiary-bg) 50%, var(--bs-secondary-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

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

.skeleton-button {
    height: 2.5rem;
    width: 100px;
    border-radius: 4px;
}

/* 快速登出按鈕樣式 */
.navbar .logout-btn {
    padding: 0.5rem 0.75rem;
    margin: 0;
    display: flex;
    align-items: center;
    border: none;
    background: transparent;
    color: var(--bs-body-color); /* 隨主題：淺色為深字、深色為淺字（原硬編碼 rgba(0,0,0,.7) 在深色下等於隱形） */
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.navbar .logout-btn:hover {
    background-color: rgba(0, 0, 0, 0.05); /* 滑鼠懸停時的背景顏色 */
    color: var(--bs-body-color);
    transform: translateY(-1px);
}

.navbar .logout-btn:focus {
    box-shadow: none;
    outline: none;
    background-color: rgba(0, 0, 0, 0.05);
}

.navbar .logout-btn:active {
    transform: translateY(0);
    background-color: rgba(0, 0, 0, 0.1);
}

.navbar .logout-btn i {
    font-size: 16px;
    margin-right: 6px; /* 調整圖示和文字之間的距離 */
}

.navbar .logout-btn .logout-text {
    font-weight: 500;
    display: inline-block;
}

/* 下拉菜單中的登出按鈕 */
.dropdown-menu form {
    margin: 0;
    padding: 0;
}

.dropdown-menu button.dropdown-item {
    border: none !important;
    background: none !important;
    width: 100% !important;
    text-align: left !important;
    padding: 0.375rem 1rem !important;
    color: var(--bs-body-color) !important;
    display: block !important;
    font-size: inherit !important;
    line-height: inherit !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dropdown-menu button.dropdown-item:hover {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-emphasis-color) !important;
    transform: translateX(5px);
}

.dropdown-menu button.dropdown-item:focus {
    background-color: var(--bs-secondary-bg) !important;
    color: var(--bs-emphasis-color) !important;
    outline: none !important;
}

/* 確保下拉菜單正確顯示 */
.dropdown-menu {
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
    animation: fadeIn 0.2s ease;
}

/* 用戶下拉菜單樣式 */
.navbar .dropdown-toggle::after {
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.navbar .dropdown.show .dropdown-toggle::after {
    transform: rotate(180deg);
}

/* 登出確認對話框樣式 */
.logout-confirm {
    background-color: rgba(0, 0, 0, 0.5);
    /* 修正 Safari 相容性問題：添加 webkit 前綴 */
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* 響應式登出按鈕 */
@media (max-width: 768px) {
    .navbar .logout-btn .logout-text {
        font-size: 12px !important;
        margin-left: 4px !important;
    }

    .navbar .logout-btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 12px !important;
    }

    .navbar .logout-btn i {
        font-size: 14px !important;
    }
}

/* 確保登出文字始終可見 */
.navbar .logout-btn .logout-text {
    display: inline !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 已移除 Select2 Bootstrap 4 主題（統一使用 select2-bootstrap-5-theme） */

/* ===== 錯誤提示樣式 ===== */

/* 全域錯誤提示區域 */
.alert-danger[data-valmsg-summary="true"] {
    border-left: 4px solid var(--flyping-danger);
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #f5c6cb;
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
    margin-bottom: 1.5rem;
}

.alert-danger[data-valmsg-summary="true"] h5 {
    color: var(--flyping-danger);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.alert-danger[data-valmsg-summary="true"] ul {
    margin-bottom: 0;
    padding-left: 1.2rem;
}

.alert-danger[data-valmsg-summary="true"] li {
    color: #721c24;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

/* 震動動畫效果 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.animated.shake {
    animation: shake 0.6s ease-in-out;
}

/* 表單驗證錯誤樣式增強 */
.text-danger {
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control.is-invalid {
    border-color: var(--flyping-danger);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-invalid:focus {
    border-color: var(--flyping-danger);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* 成功提示樣式 */
.alert-success {
    border-left: 4px solid var(--flyping-success);
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #c3e6cb;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.1);
}


/* ===== Fix: Dropdown menu covered by underlying buttons/icons (z-index/transform stacking) ===== */
/* Ensure dropdown sits above any hovered buttons that create new stacking contexts via transform */
.dropdown-menu {
    z-index: 1060 !important; /* above most controls, below modal (1050+ in BS4) */
}

/* In table/card button groups, disable hover scaling/z-index bump to avoid overlapping the open menu */
.table .btn-group .btn:hover,
.card .btn-group .btn:hover {
    transform: none !important;
    z-index: 1 !important;
}

/* Also when dropdown is open, keep siblings below the menu */
.btn-group.show .btn {
    z-index: 1 !important;
}


/* Ensure dropdown stacking context above adjacent rows/buttons when open */
.table .dropdown.show,
.table .btn-group.show,
.card .dropdown.show,
.card .btn-group.show {
    position: relative !important;
    z-index: 2001 !important;
}

/* Some icon buttons may still create stacking via transform on parent TR; ensure table rows have default z-index */
.table tr { position: relative; z-index: auto; }

/* ==========================================================================
   頁腳樣式
   ========================================================================== */

.main-footer {
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.footer-copyright {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-brand-icon {
    color: var(--flyping-primary);
    opacity: 0.85;
    font-size: 0.9rem;
}

.footer-copyright a {
    color: var(--flyping-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-copyright a:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

.footer-meta {
    display: flex;
    align-items: center;
}

.footer-version {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 500;
}

.footer-version i {
    font-size: 0.75rem;
    opacity: 0.75;
}

@media (max-width: 576px) {
    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* 頁尾深色：同上，原 @media (prefers-color-scheme: dark) 區塊無效且與手動切換衝突，
   已移除；深色下 .main-footer 直接繼承 Bootstrap 的 --bs-* token。 */


/* ==========================================================================
   驗證摘要（asp-validation-summary）
   ==========================================================================
   🔴 ASP.NET 的慣例：無錯誤時容器帶 .validation-summary-valid，有錯誤時換成
   .validation-summary-errors。標準 MVC 範本的 site.css 內建「-valid 就隱藏」這條規則，
   本專案原本沒有，所以各頁改用內聯 style="display:none" 自行遮蔽。

   內聯樣式擋不住別的腳本：notification-system.js 會把頁面上每個 .alert 當成通知組件處理，
   而 jQuery unobtrusive 在 summary="All" 模式下會預先注入一個空的佔位 <li>，
   讓「有 <li> 就 show()」這類判斷誤判成有錯誤，一 show() 內聯樣式就沒了
   ⇒ 常駐一條沒有內容的「操作失敗」紅色橫幅（實際發生過）。

   改用 class 驅動：class 由框架維護（伺服器端渲染 + unobtrusive 於用戶端切換），
   任何腳本改內聯 display 都蓋不過它。有錯誤時 class 變成 -errors，本規則自然不再適用。 */
.validation-summary-valid {
    display: none !important;
}

/* ── navbar 鈴鐺下拉（2026-09-14 owner 實報版面錯亂）──────────────────────────
   鈴鐺 09-13 起才真的載入內容，這個版面缺陷之前從未被看見：
   · 每則通知是 .dropdown-item，繼承 Bootstrap 的 white-space: nowrap ⇒ 長訊息不換行，
     實測內容寬 1772px 塞在 300px 選單裡，溢出到選單外，右側「標記已讀」按鈕被推出畫面
   · 選單無高度上限 ⇒ 實測 904px 超出視窗（911px 高的畫面底部被切掉），「查看所有通知」看不到
   只讓清單區捲動，標頭（全部已讀）與頁尾（查看所有通知）固定可見；訊息最多三行，全文在通知頁。 */
#notificationMenu {
    width: 380px;
    min-width: 0;
    max-width: calc(100vw - 16px);
    padding-bottom: 0;
}

#notificationMenu #notificationList {
    max-height: min(60vh, 520px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

#notificationMenu .notification-item {
    white-space: normal;
}

#notificationMenu .notification-item .flex-grow-1 {
    min-width: 0;
}

#notificationMenu .notification-title {
    overflow-wrap: anywhere;
}

#notificationMenu .notification-message {
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
