body {
    font-family: 'Microsoft JhengHei', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    line-height: 1.6;
}

header {
    background: #35424a;
    color: #ffffff;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.container {
    width: 80%;
    max-width: 800px;
    margin: 20px auto;
    padding: 0 20px;
}

form {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

input[type="text"] {
    padding: 12px;
    flex: 1;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

input[type="text"]:focus {
    outline: none;
    border-color: #35424a;
}

button[type="submit"] {
    padding: 12px 20px;
    background: #35424a;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button[type="submit"]:hover {
    background: #45a049;
}

.results {
    margin-top: 20px;
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.result-item {
    border-bottom: 1px solid #eee;
    padding: 20px 0;
    margin-bottom: 20px;
    position: relative;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.result-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.result-number {
    background: #35424a;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    margin-right: 15px;
    min-width: 40px;
    text-align: center;
}

.result-item h3 {
    margin: 0;
    color: #35424a;
    font-size: 18px;
    flex: 1;
}

.download-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 5px;
}

.txt-btn {
    background: #28a745;
    color: white;
}

.txt-btn:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.pdf-btn {
    background: #dc3545;
    color: white;
}

.pdf-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.meta-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px 12px;
}

.meta-info p {
    margin: 0;
    font-size: 14px;
}

.case-number {
    color: #007bff;
    font-weight: bold;
}

.year {
    color: #666;
}

.score {
    color: #28a745;
    font-weight: bold;
}

.parties {
    margin: 10px 0;
    color: #666;
}

.content-preview {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #35424a;
}

.content {
    margin: 5px 0;
    color: #333;
    line-height: 1.6;
}

.full-content {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: white;
    border-radius: 4px;
    margin-top: 10px;
}

.toggle-content-btn {
    background: #35424a;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.toggle-content-btn:hover {
    background: #45a049;
}

.decision {
    margin: 10px 0;
    color: #666;
    font-style: italic;
}

/* 高亮樣式 - 支持多種顏色 */
.highlight, span.highlight, em.highlight {
    font-weight: bold !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-style: normal !important;
}

/* 預設高亮顏色 */
em {
    background-color: #ffeb3b !important;
    color: #d84315 !important;
    border: 1px solid #ffc107 !important;
}

/* 強制高亮樣式 */
mark {
    background-color: #ffeb3b !important;
    color: #d84315 !important;
    font-weight: bold !important;
    padding: 3px 6px !important;
    border-radius: 4px !important;
    border: 2px solid #ffc107 !important;
}

/* Elasticsearch 多重高亮類別 */
.es-highlight-0 {
    background-color: #ffeb3b !important;
    color: #d84315 !important;
    border: 1px solid #ffc107 !important;
}

.es-highlight-1 {
    background-color: #e1f5fe !important;
    color: #01579b !important;
    border: 1px solid #0288d1 !important;
}

.es-highlight-2 {
    background-color: #f3e5f5 !important;
    color: #4a148c !important;
    border: 1px solid #7b1fa2 !important;
}

/* JavaScript 高亮類別 - 擴展到10組 */
.highlight-0 {
    background-color: #ffeb3b !important;
    color: #d84315 !important;
    border: 1px solid #ffc107 !important;
}

.highlight-1 {
    background-color: #e1f5fe !important;
    color: #01579b !important;
    border: 1px solid #0288d1 !important;
}

.highlight-2 {
    background-color: #f3e5f5 !important;
    color: #4a148c !important;
    border: 1px solid #7b1fa2 !important;
}

.highlight-3 {
    background-color: #e8f5e8 !important;
    color: #1b5e20 !important;
    border: 1px solid #388e3c !important;
}

.highlight-4 {
    background-color: #fff3e0 !important;
    color: #e65100 !important;
    border: 1px solid #ff9800 !important;
}

.highlight-5 {
    background-color: #fce4ec !important;
    color: #ad1457 !important;
    border: 1px solid #e91e63 !important;
}

.highlight-6 {
    background-color: #e0f2f1 !important;
    color: #00695c !important;
    border: 1px solid #009688 !important;
}

.highlight-7 {
    background-color: #f9fbe7 !important;
    color: #33691e !important;
    border: 1px solid #8bc34a !important;
}

.highlight-8 {
    background-color: #fff8e1 !important;
    color: #ff8f00 !important;
    border: 1px solid #ffc107 !important;
}

.highlight-9 {
    background-color: #efebe9 !important;
    color: #3e2723 !important;
    border: 1px solid #795548 !important;
}

/* 分頁樣式 */
.results-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #35424a;
}

.results-header h2 {
    margin: 0 0 8px 0;
    color: #35424a;
    font-size: 24px;
}

.page-info {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #35424a;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 40px;
}

.page-btn:hover {
    background: #35424a;
    color: white;
    border-color: #35424a;
}

.page-btn.current {
    background: #35424a;
    color: white;
    border-color: #35424a;
    font-weight: bold;
    cursor: default;
}

.page-dots {
    color: #666;
    padding: 0 5px;
    font-weight: bold;
}

.results-list {
    margin: 20px 0;
}

.error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

@media (max-width: 768px) {
    .container {
        width: 95%;
    }
    
    form {
        flex-direction: column;
        align-items: stretch;
    }
    
    input[type="text"], button[type="submit"] {
        width: 100%;
        margin: 5px 0;
    }
    
    .meta-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 5px;
        padding: 10px;
    }
    
    .page-btn {
        min-width: 35px;
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .results-header h2 {
        font-size: 20px;
    }
    
    .page-info {
        font-size: 12px;
    }
}

.download-status {
    animation: slideIn 0.3s ease-out;
}

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