/* TenderSense — Clean Modern Dashboard */

:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --border: #e2e6ea;
    --text: #1a1d23;
    --text-secondary: #5f6b7a;
    --text-muted: #8b95a5;
    --primary: #2563eb;
    --primary-light: #eff4ff;
    --gebiz: #2563eb;
    --gebiz-bg: #eff4ff;
    --austender: #059669;
    --austender-bg: #ecfdf5;
    --ungm: #d97706;
    --ungm-bg: #fffbeb;
    --gets-nz: #7c3aed;
    --gets-nz-bg: #f5f3ff;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.brand .subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meta-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 0.45rem 1rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
}

.btn-sm:hover { background: var(--border); }

/* Main */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-card.gebiz { border-left: 3px solid var(--gebiz); }
.stat-card.austender { border-left: 3px solid var(--austender); }
.stat-card.ungm { border-left: 3px solid var(--ungm); }
.stat-card.gets-nz { border-left: 3px solid var(--gets-nz); }
.stat-card.closing-soon { border-left: 3px solid var(--danger); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.15rem;
}

/* Filters */
.filters {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.filter-row + .filter-row { margin-top: 0.6rem; }

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.search-box input:focus { border-color: var(--primary); }

select, .filter-row input[type="date"] {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: var(--surface);
    outline: none;
    min-width: 140px;
}

select:focus, .filter-row input[type="date"]:focus { border-color: var(--primary); }

.filter-row label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Table */
.table-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead {
    background: var(--bg);
    border-bottom: 2px solid var(--border);
}

th {
    padding: 0.7rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    user-select: none;
}

th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--primary); }
th.sorted-asc::after { content: " ↑"; }
th.sorted-desc::after { content: " ↓"; }

td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tr:hover td { background: var(--bg); }

/* Source badges */
.source-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.source-gebiz { background: var(--gebiz-bg); color: var(--gebiz); }
.source-austender { background: var(--austender-bg); color: var(--austender); }
.source-ungm { background: var(--ungm-bg); color: var(--ungm); }
.source-gets_nz { background: var(--gets-nz-bg); color: var(--gets-nz); }

/* Tab buttons */
.btn-tab {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}
.btn-tab:hover { background: var(--bg); }
.btn-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Closing soon badge */
.badge-closing {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.3rem;
}

.badge-closing.urgent { background: var(--danger-bg); color: var(--danger); }
.badge-closing.soon { background: var(--warning-bg); color: var(--warning); }

.badge-closed {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #f1f3f5;
    color: var(--text-muted);
}

/* Title cell */
.title-cell a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.title-cell a:hover { color: var(--primary); text-decoration: underline; }

.title-cell .description {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.error-msg {
    text-align: center;
    padding: 2rem;
    color: var(--danger);
    background: var(--danger-bg);
    margin: 1rem;
    border-radius: var(--radius);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.pagination button {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.pagination button:hover { background: var(--bg); }
.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    main { padding: 0.75rem; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .filter-row { flex-direction: column; }
    .search-box { min-width: 100%; }
    select, .filter-row input[type="date"] { min-width: 100%; }
    th, td { padding: 0.5rem; font-size: 0.8rem; }
    .header-inner { flex-direction: column; gap: 0.5rem; }
}

@media (max-width: 480px) {
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.4rem; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 0.3rem; }
