* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1a73e8;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --text-color: #202124;
    --text-light: #5f6368;
    --bg-color: #ffffff;
    --bg-light: #f8f9fa;
    --border-color: #dadce0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-light);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background-color: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 3px 0;
    transition: 0.3s;
}

/* Breadcrumbs */
.breadcrumbs {
    background-color: var(--bg-light);
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumbs span {
    color: var(--text-light);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1557b0 100%);
    color: white;
    padding: 2rem 0;
    box-shadow: var(--shadow);
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Main */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 400px);
}

/* Search Section */
.search-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.search-box {
    margin-bottom: 1.5rem;
}

.search-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.2rem;
    color: var(--text-light);
    pointer-events: none;
    z-index: 1;
}

.search-input {
    flex: 1;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: var(--bg-light);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.search-btn {
    padding: 1rem 2rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.search-btn:hover {
    background-color: #1557b0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

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

.search-feedback {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    min-height: 1.5rem;
}

.search-feedback.success {
    color: var(--secondary-color);
}

.search-feedback.error {
    color: var(--accent-color);
}

.filters {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

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

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 150px;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* Stats Section */
.stats-section {
    margin-bottom: 2rem;
}

.stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat-item {
    color: var(--text-light);
    font-size: 0.95rem;
}

.stat-item strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* List Section */
.list-section {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.contractors-list {
    display: grid;
    gap: 1.5rem;
}

.contractors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.contractor-card-grid,
.contractor-card-list {
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
    background: white;
}

.contractor-card-grid:hover,
.contractor-card-list:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.contractor-card-grid {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.contractor-card-list {
    display: block;
}

.contractor-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.contractor-card-grid .contractor-header {
    margin-bottom: 0.5rem;
}

.contractor-id {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.district-badge {
    background-color: var(--bg-light);
    color: var(--text-color);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.district-badge-large {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.detail-title-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contractor-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.contractor-name {
    flex: 1;
    margin-bottom: 1rem;
}

.contractor-name h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.contractor-card-grid .contractor-name h3 {
    font-size: 1.1rem;
}

.contractor-name .english {
    color: var(--text-light);
    font-size: 0.95rem;
}

.contractor-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.contractor-card-grid .contractor-details {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.detail-item {
    display: flex;
    align-items: start;
    gap: 0.5rem;
}

.detail-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.detail-label {
    font-weight: 600;
    color: var(--text-light);
    min-width: 80px;
    font-size: 0.9rem;
}

.detail-value {
    flex: 1;
    color: var(--text-color);
    word-break: break-word;
    line-height: 1.5;
}

.expiry-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.expiry-valid {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.expiry-expired {
    background-color: #ffebee;
    color: #c62828;
}

.expiry-soon {
    background-color: #fff3e0;
    color: #e65100;
}

.disciplinary-badge {
    display: inline-block;
    background-color: #fff3e0;
    color: #e65100;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 1rem;
    border: 1px solid #ffcc80;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border-color);
    background-color: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.95rem;
    min-width: 40px;
    font-weight: 500;
}

.pagination-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--bg-light);
}

.pagination-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.pagination-ellipsis {
    padding: 0 0.5rem;
    color: var(--text-light);
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.no-results p {
    color: var(--text-light);
    font-size: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-color);
}

/* SEO Description */
.seo-description {
    background-color: white;
    padding: 3rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
}

.seo-description h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.seo-description p {
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* Contextual Intro */
.contextual-intro {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.contextual-intro h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.contextual-intro p {
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.8;
}

/* User Guide */
.user-guide {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.user-guide h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.user-guide h3 {
    font-size: 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.user-guide p {
    margin-bottom: 1rem;
    color: var(--text-light);
    line-height: 1.8;
}

.user-guide a {
    color: var(--primary-color);
    text-decoration: none;
}

.user-guide a:hover {
    text-decoration: underline;
}

/* Latest Articles */
.latest-articles {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin: 2rem 0;
}

.latest-articles h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.article-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.article-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.article-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.article-card h3 a {
    color: var(--text-color);
    text-decoration: none;
}

.article-card h3 a:hover {
    color: var(--primary-color);
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
}

.article-card p {
    color: var(--text-light);
    line-height: 1.6;
}

.articles-link {
    text-align: center;
}

.btn-primary {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #1557b0;
}

/* Contractor Detail Page */
.contractor-detail-page {
    max-width: 900px;
    margin: 0 auto;
}

.contractor-detail-card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.detail-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.back-link:hover {
    color: #1557b0;
    text-decoration: underline;
}

.detail-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.english-name {
    color: var(--text-light);
    font-size: 1.1rem;
}

.detail-content {
    display: grid;
    gap: 2rem;
}

.detail-section {
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
}

.detail-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.detail-row {
    display: flex;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.detail-row .detail-label {
    font-weight: 600;
    color: var(--text-light);
    min-width: 120px;
    margin-bottom: 0.5rem;
}

.detail-row .detail-value {
    flex: 1;
    color: var(--text-color);
    word-break: break-word;
}

.detail-row .detail-value a {
    color: var(--primary-color);
    text-decoration: none;
}

.detail-row .detail-value a:hover {
    text-decoration: underline;
}

.disciplinary-record {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--accent-color);
}

.disciplinary-record h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

/* Footer */
.footer {
    background-color: var(--text-color);
    color: white;
    padding: 3rem 0 1rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

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

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

.footer-section a:hover {
    color: white;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

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

.footer-bottom p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
    .logo {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 60px;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 2rem 0;
        gap: 1rem;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .search-input-wrapper {
        flex-direction: column;
    }
    
    .search-icon {
        display: none;
    }
    
    .search-input {
        padding-left: 1rem;
    }
    
    .search-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .contractor-header {
        flex-direction: column;
    }
    
    .contractor-details {
        grid-template-columns: 1fr;
    }
    
    .contractors-grid {
        grid-template-columns: 1fr;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-row {
        flex-direction: column;
    }
    
    .detail-row .detail-label {
        margin-bottom: 0.25rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

