/* 
 * Header & Navig#header-container {
    position: relative;
    margin: 0 auto;
    width: 1010px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}les
 * 基於原始 RoR 版本的 header.scss
 */

/* ==========================================================================
   Header Layout
   ========================================================================== */

#header {
    position: fixed;
    width: 100%;
    min-width: 1010px;
    background-color: #ffffff !important;
    z-index: 1000;
    height: 60px;
    top: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-bottom: 1px solid #e5e5e5;
}

#header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
}

/* ==========================================================================
   Logo
   ========================================================================== */

#logo {
    display: flex;
    align-items: center;
    height: 45px;
    text-decoration: none;
    margin-right: 30px;
}

#logo img,
#logo-image {
    height: 35px;
    width: auto;
    /* 移除白色濾鏡，恢復原始 logo 顏色 */
}

#logo-text {
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    line-height: 50px;
    text-indent: 0;
}

#logo:hover {
    opacity: 0.8;
}

/* ==========================================================================
   Main Navigation
   ========================================================================== */

#main-nav {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    margin: 0 20px;
}

#main-nav .main-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 60px;
}

#main-nav .main-nav > li {
    position: relative;
    display: flex;
    align-items: center;
    height: 60px;
}

#main-nav .main-nav > li > a {
    display: flex;
    padding: 0 15px;
    height: 60px;
    color: #333333;
    font-size: 16px;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 0;
    text-decoration: none;
    box-sizing: border-box;
}

#main-nav .main-nav > li > a:hover {
    color: #8336D6;
    background: rgba(131, 54, 214, 0.1);
    text-decoration: none;
}

#main-nav .main-nav > li.active > a {
    color: #8336D6;
    background: rgba(131, 54, 214, 0.1);
}

/* Dropdown Navigation */
#main-nav .main-nav > li .dropdown {
    position: absolute;
    top: 50px;
    left: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

#main-nav .main-nav > li:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#main-nav .dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#main-nav .dropdown li a {
    display: block;
    padding: 10px 15px;
    color: #333333;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

#main-nav .dropdown li:last-child a {
    border-bottom: none;
    border-radius: 0 0 5px 5px;
}

#main-nav .dropdown li a:hover {
    color: #8336D6;
    background: #f8f9fa;
    text-decoration: none;
}

/* ==========================================================================
   User Navigation & Search
   ========================================================================== */

/* Header Search Box - 移到 user-nav 區域 */
.header-search-box {
    margin-right: 15px;
    display: flex;
    align-items: center;
    height: 60px;
}

.header-search-box .search-form {
    margin: 0;
    display: flex;
    align-items: center;
}

.header-search-box .input-group {
    display: flex;
    align-items: center;
    position: relative;
}

.header-search-box input {
    width: 180px;
    height: 28px;
    padding: 0 30px 0 10px;
    border: 1px solid #dddddd;
    border-radius: 14px;
    background: #f8f9fa;
    color: #333333;
    font-size: 13px;
    transition: all 0.3s ease;
}

.header-search-box input:focus {
    outline: none;
    border-color: #8336D6;
    background: #ffffff;
    width: 200px;
}

.header-search-box input::placeholder {
    color: #666666;
}

.header-search-box .input-group-append {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.header-search-box .btn {
    background: none;
    border: none;
    color: #666666;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 2px 6px;
    font-size: 12px;
}

.header-search-box .btn:hover {
    color: #8336D6;
}

/* Authentication Links */
.auth-link {
    display: block;
    margin-top: 8px;
    padding: 0 20px;
    height: 34px;
    line-height: 34px;
    color: #333333;
    background: none;
    font-weight: 500;
    font-size: 16px;
    border-radius: 0;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-left: 10px;
    border: none;
}

.auth-link:hover {
    color: #8336D6;
    text-decoration: none;
}

.register-btn {
    background: #8336D6 !important;
    color: #ffffff !important;
    border-radius: 20px !important;
    font-weight: 600 !important;
}

.register-btn:hover {
    background: #943ddf !important;
    color: #ffffff !important;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
    margin-left: 15px;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #333333;
    border-radius: 20px;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
}

.user-menu-toggle:hover {
    background: #404040;
    text-decoration: none;
    color: #ffffff;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #666666;
}

.user-dropdown-menu {
    position: absolute;
    top: 45px;
    right: 0;
    width: 220px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 1001;
}

.user-dropdown-menu a {
    display: block;
    padding: 12px 15px;
    color: #333333;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    text-decoration: none;
}

.user-dropdown-menu a:hover {
    color: #8336D6;
    background: #f8f9fa;
    text-decoration: none;
}

.user-dropdown-menu .dropdown-divider {
    height: 1px;
    background: #e9ecef;
    margin: 5px 0;
}

.user-dropdown-menu .dropdown-header {
    padding: 8px 15px 5px 15px;
    color: #6c757d;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.user-dropdown-menu .admin-link {
    color: #dc3545;
}

.user-dropdown-menu .admin-link:hover {
    color: #c82333;
    background: rgba(220, 53, 69, 0.1);
}

/* ==========================================================================
   User Navigation & Search
   ========================================================================== */

#user-nav {
    display: flex;
    align-items: center;
    height: 60px;
}

#user-nav .user-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    height: 60px;
}

#user-nav .user-nav > li {
    display: flex;
    align-items: center;
    height: 60px;
    margin-left: 8px;
}

/* Search Box */
#user-nav .search-box {
    position: relative;
    margin-right: 15px;
}

#user-nav .search-box input {
    width: 200px;
    height: 32px;
    padding: 0 35px 0 12px;
    border: 1px solid #444444;
    border-radius: 16px;
    background: #2a2a2a;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s ease;
}

#user-nav .search-box input:focus {
    outline: none;
    border-color: #8336D6;
    background: #333333;
    width: 250px;
}

#user-nav .search-box input::placeholder {
    color: #aaaaaa;
}

#user-nav .search-box button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #aaaaaa;
    cursor: pointer;
    transition: color 0.3s ease;
}

#user-nav .search-box button:hover {
    color: #ffffff;
}

/* User Profile Dropdown */
#user-nav .user-dropdown {
    position: relative;
}

#user-nav .user-dropdown .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #444444;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#user-nav .user-dropdown .user-avatar:hover {
    border-color: #8336D6;
}

#user-nav .user-dropdown .dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    width: 180px;
    background: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

#user-nav .user-dropdown:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#user-nav .user-dropdown .dropdown ul {
    flex-direction: column;
    align-items: stretch;
}

#user-nav .user-dropdown .dropdown li {
    margin: 0;
}

#user-nav .user-dropdown .dropdown li a {
    display: block;
    padding: 12px 15px;
    color: #333333;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
}

#user-nav .user-dropdown .dropdown li:last-child a {
    border-bottom: none;
    border-radius: 0 0 5px 5px;
}

#user-nav .user-dropdown .dropdown li a:hover {
    color: #8336D6;
    background: #f8f9fa;
    text-decoration: none;
}

/* Authentication Buttons */
#user-nav .signin-button a {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 12px;
    height: 32px;
    color: rgba(255, 255, 255, 1);
    background: #333333;
    font-weight: 500;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

#user-nav .signin-button a:hover {
    background: #404040;
    text-decoration: none;
}

#user-nav .signup-button a {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 12px;
    height: 32px;
    color: #8336D6;
    background: #ffffff;
    border: 1px solid #8336D6;
    font-weight: 500;
    font-size: 13px;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

#user-nav .signup-button a:hover {
    background: #8336D6;
    color: #ffffff;
    text-decoration: none;
}

/* Notification Badge */
#user-nav .notification-badge {
    position: relative;
}

#user-nav .notification-badge .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF6B6B;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
    font-weight: bold;
}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #333333;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    transition: color 0.3s ease;
    z-index: 1002;
}

.mobile-menu-toggle:hover {
    color: #8336D6;
}

.mobile-menu-toggle:focus {
    outline: none;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 60px;
    right: 0;
    width: 250px; /* 固定寬度，避免過度留白 */
    background: #ffffff;
    border-top: 1px solid #e5e5e5;
    border-left: 1px solid #e5e5e5; /* 左側邊框 */
    box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.1); /* 左側陰影 */
    padding: 0;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    z-index: 1001;
    border-radius: 0 0 0 8px; /* 左下角圓角 */
}

.mobile-nav.show {
    display: block;
}

.mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav li {
    margin: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08); /* 更淡的分隔線 */
}

.mobile-nav li:last-child {
    border-bottom: none;
}

.mobile-nav a {
    display: block;
    padding: 15px 20px;
    color: #333333;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: right; /* 文字靠右對齊 */
    position: relative;
}

.mobile-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: rgba(0, 0, 0, 0.05); /* 非常淡的內部分隔線 */
}

.mobile-nav li:last-child a::after {
    display: none; /* 最後一個項目不顯示分隔線 */
}

.mobile-nav a:hover {
    color: #8336D6;
    background: #f8f9fa;
    text-decoration: none;
}

/* Mobile Search */
.mobile-nav .mobile-search {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08); /* 與其他分隔線一致 */
    text-align: right; /* 搜尋框容器靠右對齊 */
}

.mobile-nav .mobile-search .input-group {
    width: 200px; /* 固定寬度，避免太寬 */
    margin-left: auto; /* 靠右對齊 */
    display: flex;
}

.mobile-nav .mobile-search input {
    height: 40px;
    border-radius: 20px 0 0 20px;
    border: 1px solid #dddddd;
    background: #ffffff;
    color: #333333;
    font-size: 14px;
}

.mobile-nav .mobile-search input:focus {
    outline: none;
    border-color: #8336D6;
}

.mobile-nav .mobile-search .btn {
    height: 40px;
    border-radius: 0 20px 20px 0;
    border: 1px solid #8336D6;
    background: #8336D6;
    color: #ffffff;
}

.mobile-nav .mobile-search .btn:hover {
    background: #943ddf;
    border-color: #943ddf;
}

/* ==========================================================================
   Responsive Header
   ========================================================================== */

@media (max-width: 1024px) {
    #header {
        min-width: 100%;
    }
    
    #header-container {
        width: 100%;
        padding: 0 20px;
    }
    
    .header-search-box input {
        width: 150px;
    }
    
    .header-search-box input:focus {
        width: 180px;
    }
    
    #main-nav .main-nav > li > a {
        padding: 0 12px;
        font-size: 15px;
    }
}

@media (max-width: 768px) {
    #header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }
    
    #header-container {
        justify-content: space-between;
        padding: 0 15px;
    }
    
    /* Hide desktop navigation */
    #main-nav {
        display: none;
    }
    
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
        order: 2;
    }
    
    /* Hide search in header on mobile */
    .header-search-box {
        display: none;
    }
    
    /* Hide auth buttons on mobile */
    .signin-button,
    .signup-button {
        display: none;
    }
    
    /* Adjust user dropdown for mobile */
    .user-dropdown {
        order: 1;
        margin-left: 0;
        margin-right: 10px;
    }
    
    .user-menu-toggle span {
        display: none;
    }
    
    .user-dropdown-menu {
        right: -10px;
        width: 200px;
    }
    
    /* Ensure mobile nav shows when active */
    .mobile-nav.show {
        display: block;
    }
}

@media (max-width: 480px) {
    #header-container {
        padding: 0 10px;
    }
    
    #logo {
        margin-right: 15px;
    }
    
    #logo img,
    #logo-image {
        height: 30px;
    }
    
    .user-dropdown-menu {
        right: -5px;
        width: 180px;
    }
    
    /* 小螢幕上移動端選單調整 */
    .mobile-nav {
        width: 220px; /* 小螢幕上稍微縮小寬度 */
    }
    
    .mobile-nav .mobile-search {
        padding: 10px 15px;
        text-align: right; /* 小螢幕上也靠右 */
    }
    
    .mobile-nav .mobile-search .input-group {
        width: 180px; /* 小螢幕上搜尋框更窄 */
    }
    
    .mobile-nav a {
        padding: 12px 15px;
        font-size: 15px;
        text-align: right; /* 小螢幕上文字也靠右 */
    }
}
