@import url('https://fonts.bunny.net/css?family=inter:400,500,600,700&display=swap');

:root {
    --primary: #4993ea;
    --primary-hover: #377ed4;
    --primary-light: #e6f0fd;
    --bg-color: #f4f7f9;
    --surface: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --success-bg: #d1fae5;
    --success-text: #065f46;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Layout */
.min-h-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-content {
    padding: 3rem 0;
    flex: 1;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 4rem;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: var(--text-main);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Header */
.page-header {
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 0;
}

.page-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Cards */
.card {
    background-color: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background-color: #fafbfc;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.card-body {
    padding: 1.5rem;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

/*
 * Wide result tables. A plain overflow-x wrapper is not enough on its own: a table at
 * width:100% shrinks its columns to fit instead of scrolling, so the content is squeezed
 * rather than scrollable. Letting the table size to its content is what makes it scroll.
 */
.scroll-table {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.scroll-table > table {
    width: auto;
    min-width: 100%;
}

.scroll-table th,
.scroll-table td {
    white-space: nowrap;
}

/* Keep the headings visible while scrolling down a long accession. */
.scroll-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffffff;
}


table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    white-space: nowrap;
}

th {
    background-color: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

td {
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tbody tr {
    transition: background-color 0.15s ease;
}

tbody tr:hover {
    background-color: var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background-color: #f1f5f9;
}

.btn-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
}

.btn-danger:hover {
    background-color: #fecaca;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.badge-warning {
    background-color: var(--warning-bg);
    color: var(--warning-text);
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Dual Listbox Component (Custom) */
.dual-listbox {
    display: flex;
    gap: 1.5rem;
    height: 400px;
}

@media (max-width: 768px) {
    .dual-listbox {
        height: auto;
        flex-direction: column;
    }
    .listbox-pane {
        height: 300px;
        flex: none;
    }
}

.listbox-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    overflow: hidden;
    min-height: 0;
}

.listbox-pane.highlight {
    border-color: var(--primary);
    background: var(--primary-light);
}

.listbox-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    font-size: 0.875rem;
    font-weight: 600;
}

.listbox-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.listbox-search input {
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.listbox-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 0;
}

.listbox-item {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: grab;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}

.listbox-item:active {
    cursor: grabbing;
}

.listbox-item:hover {
    border-color: var(--primary);
}

.listbox-item.selected-item {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.remove-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.remove-btn:hover {
    color: #fff;
}

.empty-state {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-style: italic;
}

/* Pagination Styling (Bootstrap 5 compatible) */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    margin: 1rem 0 0 0;
    gap: 0.25rem;
    align-items: center;
}

.page-item {
    display: block;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-main);
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
    min-width: 32px;
}

.page-link:hover {
    z-index: 2;
    color: var(--primary);
    background-color: #f1f5f9;
    border-color: var(--border);
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: var(--primary);
    border-color: var(--primary);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    pointer-events: none;
    background-color: #f8fafc;
    border-color: var(--border);
}

/* Utility */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.rotate-180 { transform: rotate(180deg); }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger-text); }
.text-primary { color: var(--primary); font-weight: 600; }
.w-5 { width: 1.25rem; height: 1.25rem; }
.alert {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fecaca; }
