/**
 * 首页特定样式
 * Index Page Specific Styles
 */

/* 確保容器和側邊欄布局正確 */
.container {
    max-width: 1200px !important;
    margin: 0 auto !important;
    display: grid !important;
    grid-template-columns: 1fr 352px !important;
    gap: 16px !important;
    align-items: start !important;
}

.main-content {
    min-width: 0 !important;
}

.sidebar {
    position: sticky;
    top: 12px;
    width: 100%;
    max-width: 352px;
    min-width: 0;
    box-sizing: border-box;
}

/* 搜索侧边栏 */
.search-sidebar {
    background: #ffffff;
    border-radius: 0;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    position: sticky;
    top: 12px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden;
}

/* 确保 sidebar 内的所有表单元素不会溢出 */
.sidebar *,
.search-sidebar * {
    box-sizing: border-box;
}

.sidebar input,
.sidebar button,
.sidebar select,
.sidebar textarea,
.search-sidebar input,
.search-sidebar button,
.search-sidebar select,
.search-sidebar textarea {
    max-width: 100% !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

/* 确保登录表单也不会溢出 */
.login-form input,
.login-form button {
    max-width: 100% !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

/* 确保所有链接和文本元素也不会溢出 */
.sidebar a,
.search-sidebar a {
    word-break: break-word;
    overflow-wrap: break-word;
}

.search-sidebar h2 {
    color: #1a1a1a;
    margin-bottom: 16px;
    font-size: 1.35em;
    padding-bottom: 10px;
    border-bottom: 2px solid #1a1a1a;
    font-weight: 600;
    letter-spacing: -0.4px;
    position: relative;
}

.search-sidebar h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: #1a1a1a;
}

.search-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #d5d5d5;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: #1a1a1a;
    font-weight: 400;
    box-sizing: border-box;
    max-width: 100%;
}

.search-box input:focus {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 4px rgba(26, 26, 26, 0.06);
    transform: translateY(-1px);
}

.search-box input::placeholder {
    color: #999;
    font-weight: 400;
}

.search-box button {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    max-width: 100%;
}

.search-box button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.search-box button:hover {
    background: #2a2a2a;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

.search-box button:hover::before {
    width: 300px;
    height: 300px;
}

.search-box button:active {
    transform: translateY(0);
}

/* 店家卡片网格 */
.stores-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px;
    width: 100%;
}

.store-card {
    background: #ffffff;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid #e8e8e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    position: relative;
    min-width: 0; /* 防止 grid 溢出 */
    max-width: 100%;
    text-decoration: none;
    color: inherit;
    display: block;
}

.store-card:hover {
    text-decoration: none;
    color: inherit;
}

.store-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    padding: 1px;
    background: linear-gradient(135deg, rgba(26,26,26,0.1) 0%, rgba(26,26,26,0) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.store-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
    border-color: #1a1a1a;
    text-decoration: none;
}

.store-card a,
.store-card a:hover,
.store-card a:visited,
.store-card a:active {
    text-decoration: none;
    color: inherit;
}

.store-card:hover::before {
    opacity: 1;
}

.store-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    border: none;
    outline: none;
}

/* 確保圖片容器正確顯示 */
.store-card > .store-image:first-of-type {
    display: block;
}

.store-card > .store-image:not(:first-of-type) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-card:hover .store-image {
    transform: scale(1.05);
}

.store-info {
    padding: 12px 15px;
    position: relative;
}

.store-name {
    font-size: 0.95em;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    line-height: 1.5;
    letter-spacing: -0.3px;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

.store-card:hover .store-name {
    color: #000000;
    text-decoration: none;
}

.store-address {
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.store-address i {
    color: #999;
    margin-top: 2px;
    flex-shrink: 0;
    font-size: 0.85em;
    align-self: flex-start;
}

.store-address span {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
}

.store-rating-mini {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #666;
}

.store-rating-mini i {
    color: #ffa500;
    font-size: 0.9em;
}

.store-rating-mini .rating-count {
    color: #999;
    font-size: 0.85em;
}

.store-type {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    color: #888;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.store-type i {
    color: #aaa;
    font-size: 0.8em;
}

/* 頁面標題區域（與 store_detail.php 一致） */
.header {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1a1a1a 0%, rgba(26,26,26,0.3) 100%);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
}

.header h1 {
    color: #1a1a1a;
    font-size: 1.5em;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.4px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header h1 i {
    margin-right: 0;
}

/* Section 樣式（與 store_detail.php 一致） */
.section {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid #e8e8e8;
    position: relative;
}

.section-title {
    font-size: 1.2em;
    color: #1a1a1a;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1a1a1a;
    font-weight: 600;
    letter-spacing: -0.4px;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: #1a1a1a;
}

.section-title i {
    color: #1a1a1a;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
    padding: 24px 20px;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    flex-wrap: wrap;
    position: relative;
}

.pagination::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #1a1a1a, transparent);
    border-radius: 0 0 3px 3px;
}

.pagination a, .pagination span {
    padding: 10px 16px;
    background: #ffffff;
    color: #1a1a1a;
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1.5px solid #e5e5e5;
    font-weight: 500;
    font-size: 0.9em;
    min-width: 44px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.pagination a::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(26, 26, 26, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.pagination a:hover {
    background: #1a1a1a;
    color: #ffffff;
    border-color: #1a1a1a;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(26, 26, 26, 0.2), 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1;
}

.pagination a:hover::before {
    width: 200px;
    height: 200px;
}

.pagination a:active {
    transform: translateY(-1px) scale(1.02);
}

.pagination .current {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    color: #ffffff;
    border-color: #1a1a1a;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(26, 26, 26, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    position: relative;
    z-index: 2;
}

.pagination .current::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.pagination a i {
    font-size: 0.85em;
    transition: transform 0.3s ease;
}

.pagination a:hover i {
    transform: scale(1.1);
}

/* 上一頁/下一頁按鈕特殊樣式 */
.pagination-nav {
    padding: 10px 18px !important;
    font-weight: 600;
    background: linear-gradient(135deg, #ffffff 0%, #f8f8f8 100%);
    border: 1.5px solid #d5d5d5;
}

.pagination-nav:hover {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    border-color: #1a1a1a;
}

.pagination-nav .pagination-text {
    margin: 0 4px;
}

.pagination-nav i {
    font-size: 0.85em;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .pagination {
        gap: 4px;
        padding: 16px 12px;
    }
    
    .pagination a, .pagination span {
        padding: 8px 12px;
        min-width: 36px;
        font-size: 0.85em;
    }
    
    .pagination-nav {
        padding: 8px 12px !important;
    }
    
    /* 手機版隱藏上一頁/下一頁文字，只顯示圖標 */
    .pagination-nav .pagination-text {
        display: none;
    }
    
    .pagination-nav i {
        font-size: 1em;
        margin: 0;
    }
}

.page-info {
    color: #666;
    font-size: 0.95em;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-results-icon {
    font-size: 3em;
    margin-bottom: 12px;
    opacity: 0.5;
}

.no-results-icon i {
    color: #999;
}

/* 技師卡片網格 */
.technicians-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    width: 100%;
}

.technician-card {
    background: #ffffff;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid #e8e8e8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    text-align: center;
    text-decoration: none;
}

.technician-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.08);
    border-color: #1a1a1a;
}

.technician-avatar-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.technician-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e8e8e8;
    transition: transform 0.3s ease;
}

.technician-card:hover .technician-avatar {
    transform: scale(1.05);
}

.technician-status-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 4px 8px;
    border-radius: 0;
    font-size: 0.75em;
    font-weight: 600;
    white-space: nowrap;
}

.technician-status-badge.active {
    background: #e8f5e9;
    color: #2e7d32;
}

.technician-status-badge.departed {
    background: #ffebee;
    color: #c62828;
}

.technician-info {
    width: 100%;
}

.technician-name {
    font-size: 1.05em;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.4;
}

.technician-store,
.technician-location {
    font-size: 0.85em;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 4px;
    line-height: 1.4;
}

.technician-store i,
.technician-location i {
    font-size: 0.8em;
    color: #999;
    flex-shrink: 0;
}

.technician-store span,
.technician-location span {
    word-break: break-word;
    overflow-wrap: break-word;
}

.technician-store {
    overflow: hidden;
    min-width: 0;
}

.technician-store span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

/* 响应式 */
@media (max-width: 1200px) {
    .technicians-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .container {
        grid-template-columns: 1fr !important;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .sidebar {
        position: static;
        margin-top: 20px;
    }
    
    .search-sidebar {
        position: static;
    }
    
    .stores-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .technicians-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stores-grid {
        grid-template-columns: 1fr !important;
    }
    
    .technicians-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .technician-avatar {
        width: 80px;
        height: 80px;
    }
    
    .header h1 {
        font-size: 1.3em;
    }
    
    .section-title {
        font-size: 1.1em;
    }
}

@media (max-width: 768px) {
    .stores-grid {
        grid-template-columns: 1fr !important;
    }
    
    .technicians-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .technician-avatar {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .technicians-grid {
        grid-template-columns: 1fr;
    }
}

