:root {
  /* Premium Colors */
  --bg-color: #f8fafc;
  /* Crisp light gray body */
  --sidebar-bg: #0f172a;
  /* Deep navy */
  --sidebar-hover: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --navbar-bg: #ffffff;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #0f766e;
  /* Muted Premium Teal */
  --accent-light: #ccfbf1;
  --border: #f1f5f9;
  --border-strong: #e2e8f0;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --success: #10b981;
  --success-bg: #d1fae5;

  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* === LOGIN PAGE PRESERVED + POLISHED === */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #e2e8f0;
  background-image: url('/images/login-bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

.login-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

@keyframes glass-shimmer {
  0% {
    transform: translateX(-150%) skewX(15deg);
  }

  91.66% {
    transform: translateX(250%) skewX(15deg);
  }

  100% {
    transform: translateX(250%) skewX(15deg);
  }
}

.login-card {
  position: relative;
  z-index: 10;
  overflow: hidden;
  /* Shimmering glass gradient background with high transparency */
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.02) 100%);
  /* Reduced blur so the courtyard is very visible */
  backdrop-filter: blur(4px) saturate(110%);
  -webkit-backdrop-filter: blur(4px) saturate(110%);
  padding: 48px 40px;
  border-radius: 24px;

  /* Sharp glass edge lighting */
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  border-left: 1px solid rgba(255, 255, 255, 0.7);

  /* Deep shadow for separation + inner glow for the shine */
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), inset 0 0 30px rgba(255, 255, 255, 0.4);
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.login-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -50%;
  bottom: 0;
  width: 150%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-150%) skewX(-15deg);
  animation: glass-shimmer 2s infinite ease-in-out;
  pointer-events: none;
  mix-blend-mode: overlay;
}

.login-icon {
  width: 56px;
  height: 56px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: #1e293b;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
  color: #0f172a;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 32px;
  font-weight: 500;
  line-height: 1.5;
}

.login-field {
  margin-bottom: 16px;
  position: relative;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(241, 245, 249, 0.8);
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.login-input-wrap:focus-within {
  background: white;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.login-field-icon {
  width: 20px;
  height: 20px;
  color: #94a3b8;
  margin-left: 16px;
  flex-shrink: 0;
}

.login-field input {
  width: 100%;
  padding: 14px 16px 14px 12px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #0f172a;
  font-weight: 500;
  outline: none;
}

.login-field input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.login-field input:-webkit-autofill,
.login-field input:-webkit-autofill:hover,
.login-field input:-webkit-autofill:focus,
.login-field input:-webkit-autofill:active {
  -webkit-transition: color 9999s ease-out, background-color 9999s ease-out;
  -webkit-transition-delay: 9999s;
}

.password-toggle {
  background: none;
  border: none;
  padding: 0 16px;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: #475569;
}

.btn-signin {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #1e1e24;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(30, 30, 36, 0.2);
}

.btn-signin:hover {
  background: #0f0f13;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30, 30, 36, 0.25);
}

.login-error {
  background: #fef2f2;
  color: #ef4444;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
}

.forgot-pw-link {
  display: block;
  text-align: right;
  font-size: 13px;
  color: #64748b;
  font-weight: 500;
  text-decoration: none;
  margin-top: -8px;
  margin-bottom: 24px;
  transition: color 0.2s;
}

.forgot-pw-link:hover {
  color: #0f172a;
}

/* === TOP NAVBAR === */
.navbar {
  height: 64px;
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 50;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--text-main);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--border);
  color: var(--text-main);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 500px;
  justify-content: flex-end;
}

.search-wrap {
  position: relative;
  width: 100%;
  max-width: 280px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: #f8fafc;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  background: white;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--border-strong);
}

.user-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

/* === APP LAYOUT BODY === */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 1px 0 10px rgba(0, 0, 0, 0.05);
  z-index: 40;
}

body.sidebar-collapsed .sidebar {
  width: 68px;
}

.nav-menu {
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-link.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.4);
}

.nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.9;
  flex-shrink: 0;
}

.nav-text {
  margin-left: 14px;
  transition: all 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
}

body.sidebar-collapsed .nav-text {
  opacity: 0;
  width: 0;
  margin-left: 0;
  pointer-events: none;
  margin: 0;
}

body.sidebar-collapsed .nav-link {
  padding: 10px;
  justify-content: center;
}

body.sidebar-collapsed .nav-icon {
  margin: 0;
}

/* Tooltip for collapsed sidebar */
.tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-5px);
  background: #0f172a;
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.sidebar-collapsed .nav-link:hover .tooltip {
  visibility: visible;
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* === MAIN CONTENT (TABS) === */
.main-content {
  flex: 1;
  background: var(--bg-color);
  overflow-y: auto;
  position: relative;
}

.tab-container {
  padding: 40px;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex: 1;
}

.tab-content.active-tab {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tab-header {
  margin-bottom: 32px;
}

.tab-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* === CONTENT PANELS & COMPACT CARDS === */
.stats-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.stat-card,
.admin-card {
  background: var(--card-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.stat-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -1px;
}

/* Filter Tabs */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-strong);
  background: white;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Image Matched Resource Cards */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding-bottom: 24px;
}

.resource-card-classic {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  position: relative;
  padding: 24px;
  min-height: 290px;
}

.resource-card-classic:hover,
.resource-card-classic:focus {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  outline: none;
}

.rc-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.rc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.4;
  text-transform: uppercase;
  text-align: left;
}

.star-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #cbd5e1;
  transition: var(--transition);
  flex-shrink: 0;
  margin-top: -2px;
}

.star-btn:hover,
.star-btn.is-fav {
  color: #f59e0b;
}

.rc-badge-row {
  text-align: left;
  margin-bottom: 24px;
}

.dept-tag-outline {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  padding: 5px 12px;
  border-radius: 6px;
}

.rc-image-center {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 10px;
}

.rc-image-center img {
  max-width: 140px;
  max-height: 140px;
  object-fit: contain;
}

.rc-hover-actions {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: var(--transition);
}

.resource-card-classic:hover .rc-hover-actions,
.resource-card-classic:focus-within .rc-hover-actions {
  opacity: 1;
}

.admin-action-btn {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.admin-action-btn:hover {
  background: var(--bg-color);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.admin-action-btn.del-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger);
}

/* Lists & Forms */
.admin-card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 20px;
  color: var(--text-main);
}

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.user-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-strong);
}

.user-item:last-child {
  border-bottom: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: white;
  outline: none;
  color: var(--text-main);
  transition: var(--transition);
}

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.btn-submit {
  padding: 10px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-submit:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: white;
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Loading State */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-color);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}

.modal-content {
  background: var(--card-bg);
  padding: 32px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong);
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.modal-close-btn:hover {
  background: var(--bg-color);
  color: var(--text-main);
}

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    height: 100%;
    z-index: 60;
    transform: translateX(-100%);
  }

  body.sidebar-mobile-open .sidebar {
    transform: translateX(0);
    width: 260px;
  }

  .navbar {
    padding: 0 16px;
  }

  .tab-container {
    padding: 20px;
  }

  .resource-grid {
    grid-template-columns: 1fr;
  }
}

/* Quick View Button */
.quick-view-btn {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border-strong);
  padding: 8px 16px;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  margin-right: 12px;
}

.quick-view-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

/* Quick View Overlay */
.quick-view-overlay {
  position: fixed;
  inset: 0;
  background: #f8fafc;
  z-index: 9999;
  display: none;
  flex-direction: column;
  animation: qvFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

@keyframes qvFadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.qv-header {
  position: sticky;
  top: 0;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 0;
  z-index: 10;
}

.qv-header-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.qv-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.qv-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.qv-close-btn:hover {
  color: #0f172a;
}

.qv-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 40px 80px;
  width: 100%;
}

.qv-search-wrap {
  margin-bottom: 32px;
}

.qv-search-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 15px;
  background: white;
  outline: none;
  transition: all 0.2s;
}

.qv-search-input:focus {
  border-color: #94a3b8;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.qv-table-container {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

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

.qv-table th {
  padding: 12px 24px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
  background: #fcfdfe;
}

.qv-table td {
  padding: 14px 24px;
  font-size: 14px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

.qv-table tr:last-child td {
  border-bottom: none;
}

.qv-table tr:hover {
  background: #f8fafc;
}

.qv-dept-badge {
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.qv-link {
  color: #0f766e;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.qv-link:hover {
  text-decoration: underline;
  color: #115e59;
}