* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background: #fff;
    line-height: 1.5;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.page {
    min-height: 100vh;
    background: #fff;
}

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    width: 100%;
    max-width: 400px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card-title {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    color: #111;
    text-align: center;
}

.card-subtitle {
    margin: 0 0 24px;
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #374151;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

.btn-secondary:hover {
    background: #f9fafb;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 10px 12px;
    margin-bottom: 16px;
    border-radius: 6px;
    font-size: 13px;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px clamp(16px, 2.5vw, 48px);
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.header-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 24px clamp(16px, 2.5vw, 48px);
}

.panel-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-result-header .panel-title {
    margin: 0;
}

.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.panel-title {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: #111;
}

.panel-compact {
    padding: 12px 16px;
}

.panel-compact .panel-title {
    margin-bottom: 8px;
}

.search-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px 10px;
}

.form-group-compact {
    margin-bottom: 0;
}

.form-group-compact input,
.form-group-compact select {
    padding: 5px 10px;
    font-size: 13px;
}

.form-group-labeled label {
    display: block;
    margin-bottom: 2px;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.search-actions-compact {
    margin-top: 8px;
}

.search-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px 16px;
}

.search-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: top;
}

tbody tr:hover {
    background: #fafafa;
}

.text-muted {
    color: #9ca3af;
}

.text-ellipsis {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: top;
}

.col-index {
    min-width: 52px;
    text-align: center;
    white-space: nowrap;
}

thead th.col-index {
    text-align: center;
}

.col-platform {
    min-width: 180px;
}

td.col-platform .text-ellipsis {
    max-width: 220px;
}

.col-bidder {
    min-width: 140px;
}

.col-project-name {
    min-width: 200px;
}

td.col-project-name .text-ellipsis {
    max-width: 280px;
}

.col-owner {
    min-width: 160px;
}

.col-publish-date {
    min-width: 110px;
    white-space: nowrap;
}

.col-crawl-time {
    min-width: 170px;
    white-space: nowrap;
}

.col-source-url {
    position: sticky;
    right: 0;
    min-width: 80px;
    white-space: nowrap;
    background: #fff;
    z-index: 1;
    box-shadow: -4px 0 6px rgba(0, 0, 0, 0.04);
}

thead th.col-source-url {
    background: #f9fafb;
    z-index: 2;
}

tbody tr:hover td.col-source-url {
    background: #fafafa;
}

td.col-bidder .text-ellipsis,
td.col-owner .text-ellipsis {
    max-width: 240px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    font-size: 13px;
    color: #6b7280;
}

.pagination-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.page-size-selector {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 13px;
}

.page-size-select,
.page-size-selector select {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    cursor: pointer;
}

.page-size-selector select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.pagination-links {
    display: flex;
    gap: 4px;
}

.pagination-links a,
.pagination-links span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    text-decoration: none;
}

.pagination-links a:hover {
    background: #f9fafb;
    text-decoration: none;
}

.pagination-links .active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.pagination-links .disabled {
    color: #d1d5db;
    pointer-events: none;
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: #9ca3af;
}

@media (min-width: 1600px) {
    .search-grid-compact {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }

    .text-ellipsis {
        max-width: 280px;
    }

    td.col-platform .text-ellipsis {
        max-width: 320px;
    }

    td.col-bidder .text-ellipsis,
    td.col-owner .text-ellipsis,
    td.col-project-name .text-ellipsis {
        max-width: 320px;
    }
}

@media (min-width: 1920px) {
    .text-ellipsis {
        max-width: 360px;
    }

    td.col-platform .text-ellipsis {
        max-width: 400px;
    }

    td.col-bidder .text-ellipsis,
    td.col-owner .text-ellipsis,
    td.col-project-name .text-ellipsis {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .header {
        padding: 12px;
    }

    .search-grid-compact {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .pagination {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
