:root {
  --curion-primary: #2e364b;
  --curion-primary-dark: #262c3d;
  --curion-primary-light: #7e89a8;
  --curion-accent: #d859a1;
  --curion-success: #57c75c;
  --curion-info: #62818f;
  --curion-danger: #ca2e2b;
  --curion-warning: #e0c01c;
  --curion-link: #d859a1;
  --curion-link-hover: #87148b;
  --curion-bg: #f3f5f7;
  --curion-table-bg: #fff;
  --curion-border-radius: 18px;
  --curion-shadow: 0 6px 24px 0 rgb(0 0 0 / 5%), 0 0 0 1px rgb(0 0 0 / 8%);
  --curion-font: 'IBM Plex Sans', Courier, monospace;

  /* Override Bootstrap font variables to use IBM Plex Sans */
  --bs-font-sans-serif: 'IBM Plex Sans', Courier, monospace;
  --bs-body-font-family: 'IBM Plex Sans', Courier, monospace;
}
body {
  background: var(--curion-bg);
  font-family: var(--curion-font);
  color: #262c3d;
}


.curion-container {
  background: #fff;
  border-radius: var(--curion-border-radius);
  box-shadow: var(--curion-shadow);
  padding: 3rem 2.5rem 1rem 2.5rem;
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
}
.dashboard-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--curion-primary);
  margin-bottom: 1.5rem;
  letter-spacing: 0.01em;
}
.header-layout {
  display: flex;
  flex-direction: column;
  margin-bottom: 1.5rem;
  height: 100%;
  flex: 1;
}

.header-top {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.curion-logo {
  flex-shrink: 0;
  max-width: 140px;
  height: auto;
}

.header-tabs {
  flex: 1;
  min-width: 0;
}

.header-content {
  width: 100%;
}
.nav-tabs .nav-link.active {
  background: var(--curion-primary-light);
  color: #fff;
  border-color: var(--curion-primary-light) var(--curion-primary-light) #fff;
}
.nav-tabs .nav-link {
  color: var(--curion-primary);
  font-size: 1.125rem;
  font-weight: 500;
  padding: 0.75rem 1.25rem;
}

.nav-tabs {
  margin-bottom: 0;
}

.tab-content {
  margin-top: 1.5rem;
  width: 100%;
}

.tab-pane {
  width: 100%;
}

.table-responsive {
  width: 100%;
}

/* Make tab content flex to fill available space */
.tab-content {
  margin-top: 1.5rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tab-pane {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Make table container flex to fill available space */
.tab-pane .table-responsive {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.table {
  background: var(--curion-table-bg);
  border-radius: 10px;
  overflow: hidden;
}
.btn-primary {
  background: var(--curion-primary);
  border-color: var(--curion-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: #20bfa9; /* teal */
  border-color: #20bfa9;
}
a, .btn-link {
  color: var(--curion-link);
}
a:hover, .btn-link:hover {
  color: var(--curion-link-hover);
}
.alert-info {
  background: var(--curion-primary-light);
  color: #fff;
  border: none;
}
.alert-success {
  background: var(--curion-success);
  color: #fff;
  border: none;
}
.alert-danger {
  background: var(--curion-danger);
  color: #fff;
  border: none;
}
.alert-warning {
  background: var(--curion-warning);
  color: #fff;
  border: none;
}

/* On login/otp, remove the border from the card */
.col-md-5 .card {
  border: none;
  box-shadow: none;
  background: transparent;
}

/* Center logo on login/otp pages when no tabs are present */
.header-tabs:empty {
  display: none;
}

/* Center the logo when tabs container is empty */
.header-top:has(.header-tabs:empty) {
  justify-content: center;
}

/* More specific rule for login/otp pages */
.row.justify-content-center {
  /* This exists on login/otp pages */
}

/* Target pages that have the login/otp structure */
.header-content .row.justify-content-center ~ * .header-top,
.header-content:has(.row.justify-content-center) ~ .header-top {
  justify-content: center;
}

/* Direct approach: if page has login form structure, center logo */
.header-layout:has(.row.justify-content-center .col-md-5 .card) .header-top {
  justify-content: center;
}

/* Fallback for older browsers - add this class via JavaScript or manually */
.center-logo .header-top,
.login-page .header-top {
  justify-content: center;
}

.login-page .header-tabs {
  display: none;
}

/* Fix container height for login/otp pages */
.header-layout:has(.row.justify-content-center .col-md-5 .card) {
  height: auto;
  flex: none;
}

.login-page .curion-container {
  height: auto;
  min-height: auto;
  padding: 2rem 2.5rem;
  max-width: 600px;
  width: 95%;
  box-shadow: none;
}

/* Alternative approach for browsers that don't support :has() */
.curion-container.login-container {
  height: auto;
  min-height: auto;
  padding: 2rem 2.5rem;
  max-width: 600px;
  width: 95%;
  box-shadow: none;
}

/* Adjust Bootstrap column width for login/otp pages */
.login-page .col-md-5,
.curion-container.login-container .col-md-5 {
  flex: 0 0 100%;
  max-width: 100%;
}

/* Reduce card padding on login/otp pages */
.login-page .card,
.curion-container.login-container .card {
  padding: 1.5rem !important;
}

/* Modern form controls for login/otp cards */
.card .form-control {
    border: none;
    border-bottom: 2px solid #eee;
    border-radius: 0;
    box-shadow: none;
    padding-left: 0;
    padding-right: 0;
}
.card .form-control:focus {
    border-bottom-color: var(--curion-primary);
    box-shadow: none;
}

/* Custom scrollbar styling for tables - macOS compatible */
div.table-responsive::-webkit-scrollbar {
    width: 28px !important;
    height: 28px !important;
    -webkit-appearance: none !important;
}

div.table-responsive::-webkit-scrollbar-track {
    background: #f0f0f0 !important;
    border-radius: 10px !important;
    -webkit-appearance: none !important;
}

div.table-responsive::-webkit-scrollbar-thumb {
    background: #ff6600 !important;
    border-radius: 10px !important;
    border: 3px solid #f0f0f0 !important;
    -webkit-appearance: none !important;
    min-height: 30px !important;
}

div.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #ff4400 !important;
}

div.table-responsive::-webkit-scrollbar-thumb:active {
    background: #ff2200 !important;
}

div.table-responsive::-webkit-scrollbar-corner {
    background: #f0f0f0 !important;
}

/* Firefox scrollbar styling - thicker */
div.table-responsive {
    scrollbar-width: thick !important;
    scrollbar-color: #ff6600 #f0f0f0 !important;
}

/* Force scrollbar to always show and override macOS auto-hide */
div.table-responsive {
    overflow-y: scroll !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Additional macOS override attempts */
div.table-responsive::-webkit-scrollbar-track:horizontal {
    background: #f0f0f0 !important;
}

div.table-responsive::-webkit-scrollbar-thumb:horizontal {
    background: #ff6600 !important;
    border-radius: 10px !important;
    border: 3px solid #f0f0f0 !important;
}

/* Target specific table containers for extra specificity */
#todays-studies-table::-webkit-scrollbar,
#transfers-table::-webkit-scrollbar {
    width: 28px !important;
    height: 28px !important;
    -webkit-appearance: none !important;
}

/* Force custom scrollbar on parent containers */
div[style*="overflow-y: auto"]::-webkit-scrollbar {
    width: 28px !important;
    height: 28px !important;
    -webkit-appearance: none !important;
}

div[style*="overflow-y: auto"]::-webkit-scrollbar-track {
    background: #f0f0f0 !important;
    border-radius: 10px !important;
    -webkit-appearance: none !important;
}

div[style*="overflow-y: auto"]::-webkit-scrollbar-thumb {
    background: #ff6600 !important;
    border-radius: 10px !important;
    border: 3px solid #f0f0f0 !important;
    -webkit-appearance: none !important;
    min-height: 30px !important;
}

/* Table styling moved from inline styles */
.table th, .table td {
    padding: 0.75rem;
    vertical-align: top;
    border: none; /* Remove all default borders */
}

/* IMPORTANT: Override Bootstrap's table-responsive overflow behavior */
.table-responsive {
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Remove any transforms that might interfere with sticky positioning */
    contain: layout;
}

/* Ensure table-responsive containers work properly with sticky headers */
.table-responsive {
    /* Remove any properties that might interfere with sticky positioning */
    transform: none !important;
    contain: none !important;
    /* Additional fixes for Chromium sticky positioning */
    position: relative !important;
    will-change: scroll-position !important;
}

/* Fix for Chromium-based browsers (Chrome, Brave, Edge) - sticky doesn't work with border-collapse */
.table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    /* Ensure table positioning doesn't interfere with sticky headers */
    position: static !important;
}

/* Force sticky positioning on table headers - override any conflicting styles */
.table thead th {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    background-color: #f8f9fa !important;
    z-index: 1020 !important; /* Higher than Bootstrap modals */
    border-bottom: 2px solid #dee2e6 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    /* Ensure background is completely opaque */
    background-clip: padding-box !important;
    /* Fix for Chromium sticky positioning - must have explicit borders */
    border-left: 1px solid transparent !important;
    border-right: 1px solid transparent !important;
    border-top: 1px solid transparent !important;
    /* Additional Chromium fixes */
    will-change: transform !important;
    transform: translateZ(0) !important;
    /* Ensure proper stacking context for Chromium */
    isolation: isolate !important;
}

/* Specific overrides for both tables with maximum specificity */
#todays-studies-table thead th,
#transfers-table thead th {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    background-color: #f8f9fa !important;
    z-index: 1020 !important;
    border-bottom: 2px solid #dee2e6 !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    background-clip: padding-box !important;
    /* Fix for Chromium sticky positioning - must have explicit borders */
    border-left: 1px solid transparent !important;
    border-right: 1px solid transparent !important;
    border-top: 1px solid transparent !important;
    /* Additional Chromium fixes */
    will-change: transform !important;
    transform: translateZ(0) !important;
    /* Ensure proper stacking context for Chromium */
    isolation: isolate !important;
}

/* Thin border between rows */
.table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.15s ease-in-out;
}

/* Remove border from last row */
.table tbody tr:last-child {
    border-bottom: none;
}

/* Hover effect for clickable rows */
.table tbody tr.study-row:hover {
    background-color: #e9ecef !important;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Hover effect for transfer rows */
.table tbody tr.transfer-row:hover {
    background-color: #e9ecef !important;
    cursor: default;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* General hover effect for all table rows */
.table tbody tr:hover {
    background-color: #e9ecef !important;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Ensure proper spacing and alignment */
.table th {
    color: #495057;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Ensure table takes full width of its container */
.table-responsive {
    width: 100% !important;
}

.table {
    width: 100% !important;
    /* Use auto layout for better sticky header compatibility */
    table-layout: auto;
    /* border-collapse is set above for sticky header compatibility */
}

/* Ensure table columns have proper width distribution */
.table th, .table td {
    width: auto;
    min-width: 0;
    word-wrap: break-word;
}

/* Enhanced search field styling to match tab text */
#study-search, #transfer-search {
    font-size: 1.125rem !important;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#study-search:focus, #transfer-search:focus {
    border-color: var(--curion-primary-light);
    box-shadow: 0 0 0 0.2rem rgba(126, 137, 168, 0.25);
    outline: 0;
}

#study-search::placeholder, #transfer-search::placeholder {
    color: #6c757d;
    font-weight: 400;
}

/* Custom table structure for reliable sticky headers across all browsers */
.custom-table-container {
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    background: var(--curion-table-bg);
}

.custom-table-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
    position: sticky;
    top: 0;
}

.custom-table-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.custom-table-row {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr 1fr 1fr 1fr;
    min-height: 48px;
    align-items: center;
}

/* Transfers table has different column structure */
#transfers-header .custom-table-row,
#transfers-table .custom-table-row {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.custom-table-cell {
    padding: 0.75rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Header cells styling */
.custom-table-header .custom-table-cell {
    color: #495057;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Body row styling */
.custom-table-body .custom-table-row {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.15s ease-in-out;
}

.custom-table-body .custom-table-row:last-child {
    border-bottom: none;
}

/* Hover effects for custom table rows */
.custom-table-body .custom-table-row.study-row:hover {
    background-color: #e9ecef !important;
    cursor: pointer;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.custom-table-body .custom-table-row.transfer-row:hover {
    background-color: #e9ecef !important;
    cursor: default;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Custom scrollbar for table body */
.custom-table-body::-webkit-scrollbar {
    width: 28px !important;
    height: 28px !important;
    -webkit-appearance: none !important;
}

.custom-table-body::-webkit-scrollbar-track {
    background: #f0f0f0 !important;
    border-radius: 10px !important;
    -webkit-appearance: none !important;
}

.custom-table-body::-webkit-scrollbar-thumb {
    background: #ff6600 !important;
    border-radius: 10px !important;
    border: 3px solid #f0f0f0 !important;
    -webkit-appearance: none !important;
    min-height: 30px !important;
}

.custom-table-body::-webkit-scrollbar-thumb:hover {
    background: #ff4400 !important;
}

.custom-table-body::-webkit-scrollbar-thumb:active {
    background: #ff2200 !important;
}

/* Firefox scrollbar styling for custom table */
.custom-table-body {
    scrollbar-width: thick !important;
    scrollbar-color: #ff6600 #f0f0f0 !important;
}

/* Transfer status styling */
.transfer-row .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
}

.transfer-row.error-row {
    background-color: #fff5f5 !important;
    border-left: 3px solid var(--curion-danger) !important;
}

.transfer-row.success-row {
    background-color: #f8fff8 !important;
    border-left: 3px solid var(--curion-success) !important;
}

.transfer-row.error-row:hover {
    background-color: #fef2f2 !important;
}

.transfer-row.success-row:hover {
    background-color: #f0fdf4 !important;
}

/* Expandable row styling */
.expand-icon {
    transition: color 0.2s ease;
    font-size: 1rem;
}

.expand-icon:hover {
    color: var(--curion-primary) !important;
    transform: scale(1.1);
}

.expanded-details {
    background-color: #f8f9fa !important;
    border-left: 3px solid var(--curion-primary-light) !important;
}

.expanded-details .expanded-content {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 300px;
        padding-top: 15px;
        padding-bottom: 15px;
    }
}

/* Ensure expanded rows don't interfere with hover effects */
.expanded-details:hover {
    background-color: #f8f9fa !important;
    transform: none !important;
    box-shadow: none !important;
}
