/* 企業需求名單 Modal 樣式 */
.company-list-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    box-sizing: border-box;
}

.company-list-modal .modal-content {
    background: white;
    border-radius: 16px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.company-list-modal .modal-header {
    background: linear-gradient(135deg, #00f5d4, #00c4a3);
    color: white;
    padding: 1.5rem 2rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.company-list-modal .modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.company-list-modal .modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.company-list-modal .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 篩選區域 */
.filter-section {
    padding: 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    position: sticky;
    top: 0;
    z-index: 5;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.filter-select,
.filter-input {
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #00f5d4;
    box-shadow: 0 0 0 3px rgba(0, 245, 212, 0.1);
}

/* 篩選器載入和錯誤狀態 */
.filter-select.loading {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

.filter-select.error {
    border-color: #dc3545;
    background-color: #fff5f5;
}

.filter-select.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* 重新載入按鈕 */
.reload-filter-btn {
    position: absolute;
    right: -40px;
    top: 50%;
    transform: translateY(-50%);
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    z-index: 10;
}

.reload-filter-btn:hover {
    background: #c82333;
    transform: translateY(-50%) scale(1.1);
}

.reload-filter-btn i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 篩選器組相對定位，支援重新載入按鈕 */
.filter-group {
    position: relative;
}

/* 篩選載入狀態 */
.filter-section.filtering {
    position: relative;
}

.filter-section.filtering::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.filter-section.filtering::before {
    content: '篩選中...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #00f5d4;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 11;
    box-shadow: 0 2px 10px rgba(0, 245, 212, 0.3);
}

/* 篩選狀態指示器 */
.filter-status {
    position: absolute;
    top: 10px;
    right: 20px;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 12;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.filter-status.loading {
    background: #00f5d4;
    color: white;
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 245, 212, 0.3);
}

.filter-status.success {
    background: #28a745;
    color: white;
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.filter-status.error {
    background: #dc3545;
    color: white;
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
}

/* 無資料選項樣式 */
.filter-select option[value="no-data"] {
    color: #6c757d;
    font-style: italic;
}

.filter-select option[value="loading"] {
    color: #6c757d;
    font-style: italic;
}

.filter-select option[value="error"] {
    color: #dc3545;
    font-style: italic;
}

/* 產業類型篩選器特殊樣式 */
.filter-select[data-dependent="true"] {
    border-left: 3px solid #00f5d4;
}

.filter-select[data-dependent="true"]:focus {
    border-left-color: #00c4a3;
}

/* 篩選器聯動提示 */
.filter-group[data-has-dependency]::after {
    content: '↔ 聯動篩選';
    position: absolute;
    top: -20px;
    right: 0;
    font-size: 0.75rem;
    color: #00f5d4;
    font-weight: 500;
    opacity: 0.8;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    white-space: nowrap;
}

.filter-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* 統計資訊已移除 */

/* 表格容器 */
.table-container {
    padding: 0 2rem;
    background: white;
    flex: 1;
    min-height: 300px;
    max-height: 60vh;
    overflow: auto;
    position: relative;
}

.company-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.company-table thead {
    position: sticky;
    top: 0;
    z-index: 20;
    background: white;
}

.company-table th {
    background: #00f5d4;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 20;
}

.company-table tbody {
    display: table-row-group;
}

.company-table td {
    padding: 1rem;
    border-bottom: 1px solid #e1e5e9;
    vertical-align: top;
}

.company-table tbody tr:hover {
    background: rgba(0, 245, 212, 0.05);
}

.company-table tbody tr:last-child td {
    border-bottom: none;
}

/* 表格內容樣式 */
.company-table .industry-cell {
    font-weight: 600;
    color: #00f5d4;
}

.company-table .company-name-cell {
    font-weight: 700;
    color: #333;
}

.company-table .services-cell,
.company-table .collaboration-cell {
    max-width: 300px;
    line-height: 1.5;
}

/* 分頁控制 */
.pagination-section {
    padding: 1.5rem 2rem;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    bottom: 0;
    z-index: 5;
}

.pagination-info {
    color: #6c757d;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pagination-controls span {
    font-weight: 600;
    color: #333;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: #00f5d4;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
}

.pagination-btn:hover:not(:disabled) {
    background: #00c4a3;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    background: #e1e5e9;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* 載入指示器 */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 2rem;
    color: #6c757d;
    background: white;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e5e9;
    border-top: 4px solid #00f5d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 無資料訊息 */
.no-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem 2rem;
    color: #6c757d;
    text-align: center;
    background: white;
}

.no-data-message i {
    font-size: 3rem;
    color: #e1e5e9;
}

/* 響應式設計 */
@media (max-width: 1200px) {
    .company-list-modal .modal-content {
        max-width: 95%;
        margin: 0 10px;
    }
}

@media (max-width: 768px) {
    .company-list-modal {
        padding: 10px;
    }
    
    .company-list-modal .modal-content {
        max-height: 95vh;
        width: 98%;
        margin: 0 5px;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    

    
    .pagination-section {
        flex-direction: column;
        text-align: center;
    }
    
    .company-table {
        font-size: 0.85rem;
    }
    
    .company-table th,
    .company-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .modal-header,
    .filter-section,
    .table-container,
    .pagination-section {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 480px) {
    .company-list-modal .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .filter-section,
    .table-container,
    .pagination-section {
        padding: 1rem 1.5rem;
    }
    
    .company-table th,
    .company-table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
    
    .filter-grid {
        gap: 1rem;
    }
    

}

/* 確保 Modal 在最上層 */
.company-list-modal {
    z-index: 9999 !important;
}

.company-list-modal .modal-content {
    z-index: 10000 !important;
}

/* 防止背景滾動 */
body.modal-open {
    overflow: hidden;
}

/* 表格響應式處理 */
@media (max-width: 768px) {
    .table-container {
        max-height: 50vh;
        overflow: auto;
    }
    
    .company-table {
        display: table;
        width: 100%;
        position: relative;
    }
    
    .company-table thead {
        position: sticky;
        top: 0;
        z-index: 20;
    }
    
    .company-table th {
        position: sticky;
        top: 0;
        z-index: 20;
        min-width: 120px;
    }
    
    .company-table td {
        min-width: 120px;
    }
    
    .company-table .services-cell,
    .company-table .collaboration-cell {
        min-width: 200px;
    }
}
