/* 賽事結果頁面樣式 */

/* 標籤頁區域樣式 */
.results-tabs {
    margin: 15px 0;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
}

.tab-button {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    flex: 1 1 calc(50% - 5px);
    text-align: center;
}

.tab-button:hover {
    background-color: #e9e9e9;
}

.tab-button.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

/* 篩選控制區樣式 */
.filter-controls {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.common-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-section {
    flex: 1 1 calc(50% - 5px);
    min-width: 140px;
    margin-bottom: 8px;
}

.filter-title {
    font-size: 12px;
    margin-bottom: 4px;
    color: #555;
    font-weight: 600;
}

.select-container select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 13px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
}

.search-container {
    display: flex;
    gap: 5px;
}

.search-container input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.search-container button {
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0 10px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-container button:hover {
    background-color: #0069d9;
}

/* 篩選按鈕區域 */
.filter-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.filter-actions button,
.filter-actions a {
    flex: 1;
    text-align: center;
    padding: 8px 5px;
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-primary {
    background-color: #007bff;
    color: white;
    border: none;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
}

.btn-success {
    background-color: #28a745;
    color: white;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    opacity: 0.9;
}

/* 結果標題區域樣式 */
.results-header {
    background-color: #fff;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.competition-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.competition-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 0;
}

.no-results {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #888;
    display: none;
}

/* 表格容器樣式 */
.table-container {
    background-color: #fff;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.table-container.my-4 {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}

.table-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* 表格樣式 */
.competition-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.competition-table th,
.competition-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.competition-table th {
    background-color: #f8f9fa;
    color: #555;
    font-weight: 600;
    position: sticky;
    top: 0;
    font-size: 12px;
}

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

.table-header-row td {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 10px;
}

/* 參賽者資訊樣式 */
.participant-name {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.participant-name-en,
.participant-team {
    font-size: 13px;
    color: #777;
    margin-top: 2px;
}

.participant-school {
    color: #555;
    font-size: 12px;
}

.participant-district {
    color: #555;
    font-size: 12px;
}

.participant-count {
    font-weight: 700;
    color: #6c757d;
    text-align: left;
}

.participant-rank {
    font-weight: 700;
    color: #007bff;
    text-align: left;
}

.participant-score {
    font-weight: 700;
    color: #28a745;
    text-align: left;
}

/* 表格標題樣式 */
.group-title,
.event-name,
.district-title {
    display: block;
    margin-bottom: 2px;
}

.group-title {
    font-size: 14px;
    font-weight: 600;
}

.event-name {
    font-size: 13px;
    color: #777;
}

.district-title {
    font-size: 14px;
    font-weight: 600;
    color: #28a745;
}

/* 滑動提示樣式 */
.swipe-hint {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 11px;
    display: none;
    z-index: 10;
}

/* 回到頂部按鈕 */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* 響應式樣式 */
@media (max-width: 767px) {
    .filter-section {
        flex: 1 1 100%;
    }

    .competition-table th,
    .competition-table td {
        padding: 6px;
    }

    .group-title,
    .district-title {
        font-size: 13px;
    }

    .event-name {
        font-size: 13px;
    }

    .participant-name {
        font-size: 13px;
    }

    .participant-name-en,
    .participant-team {
        font-size: 13px;
    }
}

@media (min-width: 768px) {
    .tab-button {
        flex: 1;
    }

    .filter-section {
        flex: 1;
    }

    .filter-actions button,
    .filter-actions a {
        flex: initial;
        min-width: 120px;
    }

    .competition-table th,
    .competition-table td {
        padding: 10px 12px;
    }
}