/* 樓上那間共享工作室 - 元件樣式檔案 - 已重構為使用 V2 設計系統 */

/* ===== 現代化導航欄 ===== */
.modern-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    transition: all 0.3s;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-logo {
    flex-shrink: 0;
}

.logo-modern {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.logo-modern:hover {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.logo-img {
    height: 40px;
    width: auto;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
    justify-content: center;
}

.header-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg, 16px);
    transition: all 0.2s;
    text-decoration: none;
    position: relative;
}

.header-nav a:hover {
    color: var(--color-primary);
    background-color: var(--bg-body);
    text-decoration: none;
}

.header-nav a.active {
    background-color: var(--color-primary);
    color: var(--text-on-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--color-primary);
    color: var(--text-on-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.btn-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-danger);
    color: var(--text-on-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-modern {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary-modern {
    background: var(--color-primary);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary-modern:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-on-primary);
    text-decoration: none;
}

.mobile-menu-btn {
    display: none;
}

/* ===== 用戶選單樣式 ===== */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--text-on-primary);
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.user-avatar:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: var(--text-on-primary);
}

.user-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.user-avatar i {
    font-size: 1.2rem;
}

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

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 1000;
    margin-top: 8px;
}

.user-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-right: none;
    transform: rotate(45deg);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--bg-body);
    color: var(--color-primary);
    text-decoration: none;
}

.dropdown-item i {
    width: 16px;
    font-size: 14px;
}

/* ===== 響應式設計 ===== */
@media (max-width: 991.98px) {
    .header-nav {
        display: none;
    }
    
    .desktop-login-btn {
        display: none;
    }
    
    .user-menu {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .header-content {
        gap: 1rem;
    }
}

@media (max-width: 767.98px) {
    .modern-header {
        padding: 0.75rem 0;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
}

/* ===== 頁尾 ===== */
.footer-modern {
    background: var(--text-primary);
    color: var(--text-on-primary);
    padding: 60px 0 30px;
    margin-top: 0;
}

.footer-section {
    margin-bottom: 2rem;
}

.footer-title {
    color: var(--text-on-primary);
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.footer-links a:hover {
    color: var(--text-on-primary);
    text-decoration: none;
}

.social-links {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    text-decoration: none;
    transition: all 0.3s;
}

.social-link:hover {
    background: var(--color-primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.copyright {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
}

@media (max-width: 767.98px) {
    .copyright {
        font-size: 0.7rem;
        text-align: center;
    }
}

.footer-bottom-links {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.footer-bottom-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-bottom-links a:hover {
    color: var(--text-on-primary);
    text-decoration: none;
}

/* ===== 回到頂部按鈕 ===== */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    background: var(--color-primary);
    color: var(--text-on-primary);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

/* ===== 載入指示器 ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== 通知訊息 ===== */
.notification-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1001;
    max-width: 400px;
}

.notification {
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 4px solid var(--color-primary);
    animation: slideInRight 0.3s ease-out;
}

.notification.success {
    border-left-color: var(--color-success);
}

.notification.warning {
    border-left-color: var(--color-warning);
}

.notification.error {
    border-left-color: var(--color-danger);
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.notification-message {
    color: var(--text-secondary);
    margin: 0;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== 導覽列通知徽章（通知鈴鐺右上角紅點） ===== */
.notification-icon {
    position: relative;
    display: inline-block;
}

.notification-icon .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 8px;
    background: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid white;
}

/* ===== 導覽列通知下拉選單（notificationMenu） ===== */
.notification-dropdown {
    min-width: 320px;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(170, 145, 119, 0.1);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.notification-dropdown .dropdown-header {
    padding: 12px 16px;
    background: #fff;
    margin: 0;
    border-bottom: 1px solid rgba(170, 145, 119, 0.1);
}

.notification-dropdown .dropdown-header .fw-bold {
    font-size: 0.875rem;
    color: var(--text-primary, #333);
}

.notification-dropdown .dropdown-header a {
    font-size: 0.75rem;
    color: var(--color-primary, var(--color-primary));
}

.notification-dropdown .notification-list {
    padding: 0;
    max-height: 360px;
    overflow-y: auto;
}

/* 簡化的通知項目（供 notificationMenu 使用） */
.notification-item-simple {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary, #333);
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(170, 145, 119, 0.1);
    position: relative;
}

.notification-item-simple:last-child {
    border-bottom: none;
}

.notification-item-simple:hover {
    background: var(--bg-body, #f8f9fa);
    text-decoration: none;
}

.notification-item-simple.unread {
    background: rgba(170, 145, 119, 0.05);
}

.notification-item-simple.unread:hover {
    background: rgba(170, 145, 119, 0.1);
}

/* 通知圖示（小圖示） */
.notification-icon-small {
    width: 16px;
    font-size: 14px;
    color: var(--color-primary, var(--color-primary));
    flex-shrink: 0;
}

/* 通知內容區塊 */
.notification-content-simple {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.notification-title-simple {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary, #333);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.notification-time-simple {
    font-size: 0.75rem;
    color: var(--text-secondary, #999);
    margin-top: 2px;
}

/* 未讀藍點 */
.notification-dot {
    width: 8px;
    height: 8px;
    background: var(--color-primary, var(--color-primary));
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 576px) {
    .notification-dropdown {
        min-width: 280px;
        max-width: 90vw;
    }
}

/* ===== 服務/職人/文章卡片 (通用) ===== */
.service-card, .technician-card, .article-card {
    background: var(--bg-surface, #fff);
    border-radius: 16px;
    box-shadow: var(--shadow-sm, 0 2px 4px rgba(0,0,0,0.05));
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, rgba(0,0,0,0.05));
    position: relative;
    text-decoration: none !important;
    color: inherit;
}

.service-card:hover, .technician-card:hover, .article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg, 0 10px 25px rgba(0,0,0,0.1));
}

/* 圖片區域 */
.service-image-wrapper, .tech-img-box, .article-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: #f8f9fa;
}

.service-image-wrapper img, .tech-img-box img, .article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.service-card:hover .service-image-wrapper img, 
.technician-card:hover .tech-img-box img, 
.article-card:hover .article-image img {
    transform: scale(1.1);
}

/* 徽章樣式 */
.service-badge, .verified-badge, .new-badge-corner, .tech-rank {
    position: absolute;
    z-index: 2;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.service-badge {
    top: 12px;
    left: 12px;
    background: var(--color-primary, var(--color-primary));
    color: #fff;
}

.verified-badge {
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    color: var(--color-success);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.tech-rank {
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-family: 'Playfair Display', serif;
}

.tech-rank.rank-1 { background: linear-gradient(135deg, #ffd700, #ffb347); }
.tech-rank.rank-2 { background: linear-gradient(135deg, #c0c0c0, #a0a0a0); }
.tech-rank.rank-3 { background: linear-gradient(135deg, #cd7f32, #b87333); }

/* 內容區域 */
.service-body, .tech-info, .article-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.service-category, .tech-role, .article-category {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-primary, var(--color-primary));
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.service-title, .tech-name, .article-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    color: var(--text-primary, #333);
}

.service-desc, .tech-tags, .article-excerpt {
    font-size: 0.875rem;
    color: var(--text-secondary, #666);
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 標籤 */
.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    height: auto;
}

.tech-tag {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: #555;
}

/* 底部數據 */
.service-meta, .tech-stats-row {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
}

.service-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary, var(--color-primary));
}

.service-price small {
    font-size: 0.75rem;
    font-weight: 400;
    color: #999;
}

.stat-item {
    font-size: 0.8125rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-item i {
    color: var(--color-warning);
}

/* 懸浮動作按鈕 (職人卡片專用) */
.tech-hover-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    transform: translateY(100%);
    transition: transform 0.3s;
    z-index: 3;
}

.technician-card:hover .tech-hover-actions {
    transform: translateY(0);
}

.tech-btn {
    flex: 1;
    border: none;
    padding: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: 0.2s;
}

.btn-view { background: #f8f9fa; color: #333; }
.btn-view:hover { background: #e9ecef; }
.btn-book { background: var(--color-primary, var(--color-primary)); color: #fff; }
.btn-book:hover { background: var(--color-primary-dark, #8e7963); }

/* 職人資訊 (服務卡片底部) */
.technician-info {
    padding: 0.75rem 1.25rem;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8125rem;
}

.technician-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.technician-name {
    font-weight: 600;
    color: #333;
}

.technician-link {
    margin-left: auto;
    color: var(--color-primary, var(--color-primary));
    text-decoration: none;
    font-weight: 600;
}

.technician-link:hover {
    text-decoration: underline;
}

/* ... 更多通用卡片樣式 ... */

/* 改善 Select 元素在行動裝置上的樣式 */
select,
.form-select,
select.form-control,
select.form-control-modern,
.sort-dropdown,
.sort-dropdown.w-100 {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px 12px;
    padding-right: 40px;
    cursor: pointer;
}

/* ===== 收藏與分享按鈕 (V2) ===== */
.btn-favorite,
.btn-favorite-sm {
    background: var(--bg-surface, #fff);
    border: 1.5px solid var(--border-color, #e0e0e0);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary, #666);
    font-size: 1.2rem;
    padding: 0;
}

.btn-favorite-sm {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

.btn-favorite:hover,
.btn-favorite-sm:hover {
    background: var(--bg-body, rgba(170, 145, 119, 0.05));
    border-color: var(--color-primary, var(--color-primary));
    color: var(--color-primary, var(--color-primary));
    transform: scale(1.05);
}

.btn-favorite.active,
.btn-favorite-sm.active {
    background: var(--color-primary, var(--color-primary));
    border-color: var(--color-primary, var(--color-primary));
    color: var(--text-on-primary, #fff) !important;
}

.btn-favorite.active:hover,
.btn-favorite-sm.active:hover {
    background: var(--color-primary-dark, var(--color-primary-dark));
}

/* 文字版收藏/分享按鈕 */
.btn-favorite-text {
    background: var(--bg-surface, #fff);
    border: 1.5px solid var(--border-color, #e0e0e0);
    border-radius: 50px;
    padding: 10px 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary, #333);
    font-weight: 500;
    font-size: 0.95rem;
}

.btn-favorite-text:hover {
    background: var(--bg-body, #f8f9fa);
    border-color: var(--color-primary, var(--color-primary));
    color: var(--color-primary, var(--color-primary));
    transform: translateY(-2px);
}

.btn-favorite-text.active {
    background: var(--color-primary, var(--color-primary));
    border-color: var(--color-primary, var(--color-primary));
    color: var(--text-on-primary, #fff) !important;
}

.btn-favorite-text.active i {
    color: var(--text-on-primary, #fff) !important;
}

/* 收藏 Toast 樣式 */
.favorites-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: slideInRightFav 0.3s ease-out forwards;
}

.favorites-toast-success {
    background: var(--color-success);
    color: white;
}

.favorites-toast-error {
    background: var(--color-danger);
    color: white;
}

@keyframes slideInRightFav {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
