html, body, div, h1, h2, h3, p, img, ul, li, input {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #1a1a1a;
    color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    padding: 24px;
}

.page-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 32px;
    letter-spacing: 0.5px;
}

.card {
    background-color: #333333;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 60px 24px;
    min-height: 500px;
    max-width: 1200px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 760px;
    margin: 0 auto 40px auto;
    background-color: #ffffff;
    border-radius: 999px;
    padding: 4px;
}

.search-bar input[type='text'] {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 20px;
    font-size: 14px;
    color: #333333;
    border-radius: 999px 0 0 999px;
    min-width: 0;
}

.search-bar input[type='text']::placeholder {
    color: #999999;
}

.query-btn {
    background-color: #ee6500;
    color: #ffffff;
    border: none;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.query-btn:hover {
    background-color: #ff7700;
}

.query-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.result-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.warning-icon {
    width: 48px;
    height: 48px;
    background-color: #ee6500;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.warning-icon::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
}

.warning-icon .exclamation {
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.empty-state .message {
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

/* Loading state */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #555555;
    border-top: 4px solid #ee6500;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-state .message {
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
}

/* Error state */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.error-state .warning-icon {
    background-color: #EC5E04;
}

.error-state .warning-icon::before {
    border-color: #EC5E04;
}

.error-state .message {
    color: #EC5E04;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
}

.error-state .sub-message {
    color: #999999;
    font-size: 13px;
    text-align: center;
}

/* Table state */
.certificate-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 36px;
    width: 100%;
}

/* 表格容器 - 用于移动端滚动 */
.table-container {
    width: 100%;
    max-width: 760px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.certificate-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
    border-radius: 8px;
    overflow: hidden;
}

.certificate-table th {
    padding: 12px 16px;
    background-color: #ee6500;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
}

.certificate-table th:last-child {
    border-right: none;
}

.certificate-table tbody tr {
    background-color: #ffffff;
}

.certificate-table td {
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    color: #333333;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    word-break: break-word;
    white-space: nowrap;
}

.certificate-table td:last-child {
    border-right: none;
}

.download-btn {
    background-color: #ee6500;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.download-btn:hover {
    background-color: #ff7700;
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

/* ==================== 移动端样式 ==================== */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .page-title {
        font-size: 22px;
        margin-bottom: 20px;
    }

    .card {
        padding: 30px 16px;
        min-height: 400px;
        border-radius: 12px;
    }

    .search-bar {
        flex-direction: column;
        background: transparent;
        border-radius: 0;
        padding: 0;
        gap: 12px;
        margin-bottom: 30px;
    }

    .search-bar input[type='text'] {
        width: 100%;
        background-color: #ffffff;
        border-radius: 999px;
        padding: 14px 20px;
        font-size: 15px;
    }

    .query-btn {
        width: 100%;
        border-radius: 999px;
        padding: 14px 28px;
        font-size: 15px;
        justify-content: center;
    }

    .result-area {
        min-height: 250px;
    }

    /* 表格容器移动端优化 */
    .table-container {
        border-radius: 8px;
        padding-bottom: 4px;
    }

    /* 确保表格完整显示 */
    .certificate-table {
        min-width: 550px;
        font-size: 12px;
    }

    .certificate-table th,
    .certificate-table td {
        padding: 10px 14px;
        font-size: 12px;
    }

    /* 下载按钮移动端优化 */
    .download-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
        border-radius: 8px;
    }

    /* 空状态移动端优化 */
    .empty-state .message {
        font-size: 14px;
    }

    .warning-icon {
        width: 44px;
        height: 44px;
    }

    .warning-icon .exclamation {
        font-size: 20px;
    }

    /* 加载状态移动端优化 */
    .spinner {
        width: 36px;
        height: 36px;
    }

    .loading-state .message {
        font-size: 14px;
    }

    /* 错误状态移动端优化 */
    .error-state .message {
        font-size: 14px;
    }

    .error-state .sub-message {
        font-size: 12px;
    }
}

/* 小屏手机优化 (宽度 ≤ 480px) */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .page-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .card {
        padding: 24px 12px;
        min-height: 350px;
        border-radius: 10px;
    }

    .search-bar {
        gap: 10px;
        margin-bottom: 24px;
    }

    .search-bar input[type='text'] {
        padding: 12px 16px;
        font-size: 14px;
    }

    .query-btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    .certificate-table {
        min-width: 450px;
        font-size: 11px;
    }

    .certificate-table th,
    .certificate-table td {
        padding: 8px 10px;
        font-size: 11px;
    }

    .download-btn {
        font-size: 14px;
        padding: 10px 16px;
    }

    .warning-icon {
        width: 40px;
        height: 40px;
    }

    .warning-icon .exclamation {
        font-size: 18px;
    }

    .empty-state .message {
        font-size: 13px;
    }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .card {
        padding: 20px 16px;
        min-height: 300px;
    }

    .search-bar {
        margin-bottom: 20px;
    }

    .result-area {
        min-height: 180px;
    }

    .certificate-wrapper {
        gap: 16px;
    }

    .certificate-table th,
    .certificate-table td {
        padding: 6px 10px;
        font-size: 11px;
    }

    .page-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
}

/* 平板设备优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .card {
        padding: 40px 24px;
    }

    .certificate-table {
        font-size: 13px;
    }

    .certificate-table th,
    .certificate-table td {
        padding: 10px 14px;
    }
}

/* 触摸设备优化 - 增大点击区域 */
@media (hover: none) and (pointer: coarse) {

    .query-btn,
    .download-btn {
        min-height: 44px;
    }

    .search-bar input[type='text'] {
        min-height: 44px;
    }
}