/**
 * 企業級導航按鈕設計系統
 * Enterprise Navigation Button Design System
 * 
 * 設計原則：
 * - 視覺協調：與白色導航欄完美融合
 * - 專業簡潔：企業級的視覺語言
 * - 圖示化設計：直觀的圖形界面
 * - 無動畫：穩重的企業風格
 */

/* ================================
   企業級設計變數
   Enterprise Design Variables
================================ */
:root {
    /* 主要企業色系 - 低飽和度 */
    --nav-enterprise-primary: #4A90E2;        /* 柔和藍色 */
    --nav-enterprise-primary-hover: #357ABD;   /* 懸停藍色 */
    --nav-enterprise-secondary: #6C757D;       /* 中性灰色 */
    --nav-enterprise-secondary-hover: #545B62; /* 懸停灰色 */
    --nav-enterprise-danger: #E74C3C;          /* 柔和紅色 */
    --nav-enterprise-danger-hover: #C0392B;    /* 懸停紅色 */
    
    /* 背景和邊框 */
    --nav-enterprise-bg: #F8F9FA;              /* 極淡背景 */
    --nav-enterprise-bg-hover: #E9ECEF;        /* 懸停背景 */
    --nav-enterprise-border: #DEE2E6;          /* 淡邊框 */
    
    /* 陰影系統 */
    --nav-enterprise-shadow-light: 0 1px 3px rgba(0, 0, 0, 0.06);
    --nav-enterprise-shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.1);
    
    /* 統一規格 */
    --nav-enterprise-border-radius: 4px;
    --nav-enterprise-transition: all 0.2s ease-in-out;
}

/* ================================
   Logo 連結優化 - 完全隱形設計
   Logo Link Optimization - Invisible Design
================================ */
.navbar-logo-wrapper {
    display: inline-block;
    /* 移除所有內邊距，讓 logo 直接貼合導航欄 */
    padding: 0;
    margin: 0;
    /* 移除所有邊框和圓角 */
    border: none;
    border-radius: 0;
    /* 完全透明背景 */
    background: transparent !important;
    /* 移除過渡效果，避免任何視覺變化 */
    transition: none;
    /* 保持點擊功能但隱藏按鈕外觀 */
    cursor: pointer;
    text-decoration: none;
    /* 移除任何可能的陰影或輪廓 */
    box-shadow: none !important;
    outline: none;
    /* 確保與導航欄完全對齊 */
    vertical-align: middle;
}

/* 懸停狀態 - 完全移除所有視覺效果 */
.navbar-logo-wrapper:hover {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    opacity: 1;
}

/* 確保logo圖片本身在懸停時不變色 */
.navbar-logo-wrapper:hover .navbar-logo {
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* 聚焦狀態 - 完全移除外框 */
.navbar-logo-wrapper:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* 點擊狀態 - 移除所有效果 */
.navbar-logo-wrapper:active {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
    outline: none !important;
}

/* Logo 圖片本身的樣式 */
.navbar-logo {
    height: 36px;
    width: auto;
    display: block;
    /* 移除任何邊距 */
    margin: 0;
    padding: 0;
    /* 確保圖片本身沒有邊框或陰影 */
    border: none;
    box-shadow: none;
    /* 保持原始外觀 */
    filter: none;
}

/* 移除所有偽元素效果 */
.navbar-logo-wrapper::before,
.navbar-logo-wrapper::after {
    display: none !important;
}

/* 確保在任何狀態下都不會有按鈕外觀 */
.navbar-logo-wrapper:link,
.navbar-logo-wrapper:visited,
.navbar-logo-wrapper:hover,
.navbar-logo-wrapper:active {
    color: inherit;
    text-decoration: none;
    background: transparent !important;
    border: none !important;
}

/* 移除Bootstrap可能添加的任何樣式 */
.navbar-logo-wrapper.btn,
.navbar-logo-wrapper[class*="btn"] {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* 確保在導航欄內的對齊 */
.sb-topnav .navbar-logo-wrapper {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

/* 強制移除任何可能的樣式干擾 */
.navbar-brand .navbar-logo-wrapper,
.navbar .navbar-logo-wrapper,
nav .navbar-logo-wrapper {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* 移除可能的 focus-visible 效果 */
.navbar-logo-wrapper:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* 確保在所有瀏覽器中都沒有按鈕外觀 */
.navbar-logo-wrapper {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

/* 移除任何可能的偽類效果 */
.navbar-logo-wrapper:not(:disabled):not(.disabled) {
    background: transparent !important;
    border: none !important;
}

/* 確保圖片不會被連結樣式影響 */
a.navbar-logo-wrapper img,
.navbar-logo-wrapper .navbar-logo {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* 移除可能的 Bootstrap 導航欄品牌樣式 */
.navbar-brand.navbar-logo-wrapper {
    padding: 0 !important;
    margin-right: 0.5rem;
    font-size: inherit !important;
    line-height: inherit !important;
    white-space: nowrap !important;
}

/* ================================
   統一按鈕基礎樣式
   Unified Button Base Styles
================================ */
.nav-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: var(--nav-enterprise-border-radius);
    background: var(--nav-enterprise-bg);
    border: 1px solid var(--nav-enterprise-border);
    color: var(--nav-enterprise-secondary);
    text-decoration: none;
    transition: var(--nav-enterprise-transition);
    cursor: pointer;
    position: relative;
    font-size: 16px;
    /* 移除所有變形效果 */
}

.nav-icon-button:hover {
    background: var(--nav-enterprise-bg-hover);
    color: var(--nav-enterprise-secondary-hover);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: var(--nav-enterprise-shadow-hover);
    /* 移除變形 */
    transform: none;
}

.nav-icon-button:focus {
    outline: 2px solid var(--nav-enterprise-primary);
    outline-offset: 2px;
}

.nav-icon-button:active {
    background: var(--nav-enterprise-border);
    /* 移除變形 */
    transform: none;
}

/* ================================
   首頁按鈕 - 圖示化設計
   Home Button - Icon Design
================================ */
.nav-home-button {
    color: var(--nav-enterprise-primary);
    margin-right: 8px;
}

.nav-home-button:hover {
    background: rgba(74, 144, 226, 0.1);
    color: var(--nav-enterprise-primary-hover);
    border-color: rgba(74, 144, 226, 0.2);
}

/* 特定的首頁連結樣式覆蓋 */
.sb-topnav a[href="/"]:hover {
    color: #495057 !important;
    /*background-color: #E9ECEF !important;*/
    /*border-color: #D0D0D0 !important;*/
    transform: none !important; /* 移除位移 */
    box-shadow: none !important; /* 移除陰影 */
}

/* ================================
   登出按鈕 - 圖示化設計
   Logout Button - Icon Design
================================ */
.nav-logout-button {
    color: var(--nav-enterprise-danger);
    border: 1px solid transparent;
    background: transparent;
    margin-left: 8px;
}

.nav-logout-button:hover {
    background: rgba(231, 76, 60, 0.1);
    color: var(--nav-enterprise-danger-hover);
    border-color: rgba(231, 76, 60, 0.2);
}

/* 隱藏的文字供螢幕閱讀器使用 */
.nav-logout-button .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 移除之前的圖標偽元素 */
.nav-logout-button::after {
    display: none;
}

/* 移除波紋效果 */
.nav-icon-button::before {
    display: none;
}

/* ================================
   使用者資訊優化 - 完全隱形設計
   User Info Enhancement - Invisible Design
================================ */
.navbar-user-info {
    display: flex;
    align-items: center;
    /* 移除所有內邊距和邊距 */
    padding: 0;
    margin: 0;
    margin-right: 8px;
    /* 完全透明背景 */
    background: transparent !important;
    /* 移除所有邊框和圓角 */
    border: none !important;
    border-radius: 0;
    /* 移除過渡效果 */
    transition: none;
    /* 移除陰影 */
    box-shadow: none !important;
    /* 確保與導航欄對齊 */
    vertical-align: middle;
}

/* 懸停狀態 - 完全移除所有視覺效果 */
.navbar-user-info:hover {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* 使用者文字樣式 - 融入導航欄 */
.navbar-user-info .navbar-text {
    font-size: 14px;
    font-weight: 500;
    /* 使用更深的灰色，但不要太突兀 */
    color: #495057;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    /* 移除任何背景或邊框 */
    background: transparent !important;
    border: none !important;
}

/* 移除所有可能的偽元素效果 */
.navbar-user-info::before,
.navbar-user-info::after {
    display: none !important;
}

/* 確保文字在任何狀態下都保持透明背景 */
.navbar-user-info:hover .navbar-text {
    color: #343a40;
    background: transparent !important;
    border: none !important;
}

/* 強制移除任何可能的樣式干擾 */
.navbar .navbar-user-info,
nav .navbar-user-info,
.sb-topnav .navbar-user-info {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin-right: 8px;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* 移除可能的 Bootstrap 樣式 */
.navbar-user-info.card,
.navbar-user-info[class*="bg-"],
.navbar-user-info[class*="border-"] {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* 確保在所有瀏覽器中都沒有字塊外觀 */
.navbar-user-info {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* 移除可能的焦點效果 */
.navbar-user-info:focus,
.navbar-user-info:focus-within {
    outline: none !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ================================
   響應式設計
   Responsive Design
================================ */

/* 桌面大螢幕 */
@media (min-width: 992px) {
    .nav-icon-button {
        width: 42px;
        height: 42px;
        font-size: 16px;
    }
    
    .navbar-logo {
        height: 36px;
    }
    
    .navbar-logo-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info {
        padding: 0 !important;
        margin: 0 !important;
        margin-right: 8px;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info .navbar-text {
        font-size: 14px;
    }
}

/* 平板 */
@media (max-width: 991px) and (min-width: 768px) {
    .nav-icon-button {
        width: 38px;
        height: 38px;
        font-size: 15px;
    }
    
    .navbar-logo {
        height: 32px;
    }
    
    .navbar-logo-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info {
        padding: 0 !important;
        margin: 0 !important;
        margin-right: 6px;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info .navbar-text {
        font-size: 13px;
    }
}

/* 手機 */
@media (max-width: 767px) and (min-width: 480px) {
    .nav-icon-button {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .navbar-logo {
        height: 28px;
    }
    
    .navbar-logo-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info {
        padding: 0 !important;
        margin: 0 !important;
        margin-right: 4px;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info .navbar-text {
        font-size: 12px;
    }
}

/* 極小螢幕 */
@media (max-width: 479px) {
    .nav-icon-button {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .navbar-logo {
        height: 24px;
    }
    
    .navbar-logo-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info {
        padding: 0 !important;
        margin: 0 !important;
        margin-right: 4px;
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info .navbar-text {
        font-size: 11px;
    }
}

/* ================================
   無障礙設計支援
   Accessibility Support
================================ */

/* 高對比模式 */
@media (prefers-contrast: high) {
    .nav-icon-button,
    .navbar-logo-wrapper {
        border-width: 2px;
    }
    
    .nav-home-button {
        background-color: var(--nav-enterprise-primary);
        color: white;
    }
    
    .nav-logout-button {
        background-color: var(--nav-enterprise-danger);
        color: white;
    }
    
    /* 使用者資訊在高對比模式下也保持透明 */
    .navbar-user-info {
        background: transparent !important;
        border: none !important;
    }
    
    .navbar-user-info .navbar-text {
        color: #000000;
        font-weight: 600;
    }
}

/* 減少動效模式 */
@media (prefers-reduced-motion: reduce) {
    .navbar-logo-wrapper,
    .nav-icon-button,
    .navbar-user-info {
        transition: none !important;
    }
    
    /* 使用者資訊確保無動畫 */
    .navbar-user-info,
    .navbar-user-info .navbar-text {
        transition: none !important;
        animation: none !important;
    }
}

/* ================================
   工具提示支援
   Tooltip Support
================================ */
.nav-tooltip {
    position: relative;
}

.nav-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 5px;
    z-index: 1000;
}

.nav-tooltip:hover::after {
    opacity: 1;
}

/* ================================
   載入和狀態樣式
   Loading and State Styles
================================ */
.nav-button-loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: not-allowed;
}

.nav-button-loading::before {
    content: '\f110'; /* fa-spinner */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    animation: fa-spin 1s infinite linear;
    position: absolute;
}

/* 移除成功動畫 */
.nav-button-success {
    /* 僅顯示顏色變化，無動畫 */
    color: #28a745;
}

/* ================================
   印刷樣式
   Print Styles
================================ */
@media print {
    .nav-icon-button {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        color: black !important;
    }
    
    .navbar-logo-wrapper,
    .navbar-user-info {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .navbar-user-info .navbar-text {
        color: black !important;
    }
}