@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-primary: #FFFFFF;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(181, 2, 70, 0.04);
  --border-glass: rgba(0, 0, 0, 0.08);
  --text-primary: #333333;
  --text-secondary: #555555;
  --text-muted: #888888;

  --accent: #b50246;
  --accent-hover: #9c023d;
  --accent-glow: rgba(181, 2, 70, 0.15);
  --accent-light: #d61c6b;
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.10);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.10);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.10);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.10);

  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
}

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

html {
  scroll-behavior: smooth
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none
}

a:hover {
  color: var(--accent-hover)
}

img {
  max-width: 100%;
  display: block
}

button {
  cursor: pointer;
  font-family: inherit
}

input,
select,
textarea {
  font-family: inherit
}

.flex {
  display: flex
}

.flex-col {
  flex-direction: column
}

.items-center {
  align-items: center
}

.justify-between {
  justify-content: space-between
}

.gap-sm {
  gap: 8px
}

.gap-md {
  gap: 16px
}

.gap-lg {
  gap: 24px
}

.text-center {
  text-align: center
}

.w-full {
  width: 100%
}

.hidden {
  display: none !important
}

/* Login Page */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: #FFFFFF;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 48px 36px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  animation: fadeUp .5s var(--ease);
}

.login-card .logo {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  color: var(--accent);
}

.login-card .subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 32px;
}

/* Forms */
.form-group {
  margin-bottom: 20px
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .3px;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  transition: border .25s var(--ease), box-shadow .25s var(--ease);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
  color: var(--text-muted)
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select.form-control option {
  background: #FFFFFF;
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  transition: all .25s var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
  background: #FFFFFF;
  color: var(--accent);
  border: 1px solid var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-success {
  background: var(--success);
  color: #fff
}

.btn-success:hover {
  background: #16a34a
}

.btn-danger {
  background: var(--danger);
  color: #fff
}

.btn-danger:hover {
  background: #dc2626
}

.btn-warning {
  background: var(--warning);
  color: #000
}

.btn-warning:hover {
  background: #d97706
}

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

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

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 6px
}

.btn-block {
  width: 100%
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important
}

/* App Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh
}

.sidebar {
  width: var(--sidebar-w);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform .3s var(--ease);

  border-right: 1px solid var(--border-glass);
  overflow: hidden;
}

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  background: #FFFFFF;
  /* White background for the Amrita red logo */
  border-bottom: 1px solid var(--border-glass);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  background: #ffffff;
}

.sidebar-nav .nav-section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 16px 12px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s var(--ease);
  margin-bottom: 2px;
  cursor: pointer;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--accent);
  color: #FFFFFF;
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.nav-link .icon {
  font-size: 18px;
  width: 22px;
  text-align: center
}

.sidebar-footer {
  padding: 16px;
  background: var(--accent);
  flex-shrink: 0;
  border-top-right-radius: 16px;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.sidebar-footer .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-footer .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
}

.sidebar-footer .user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: capitalize
}

.sidebar-footer .btn-outline {
  color: rgba(255, 255, 255, 0.75);
  border-color: rgba(255, 255, 255, 0.25);
}

.sidebar-footer .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.4);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.top-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-glass);
  background: #FFFFFF;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.top-bar .page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.top-bar .breadcrumb {
  font-size: 13px;
  color: var(--text-muted)
}

.content-area {
  flex: 1;
  padding: 28px 32px;
  animation: fadeUp .35s var(--ease);
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.purple {
  background: rgba(181, 2, 70, 0.1);
  color: var(--accent)
}

.stat-icon.green {
  background: var(--success-bg);
  color: var(--success)
}

.stat-icon.amber {
  background: var(--warning-bg);
  color: var(--warning)
}

.stat-icon.red {
  background: var(--danger-bg);
  color: var(--danger)
}

.stat-icon.blue {
  background: var(--info-bg);
  color: var(--info)
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-glass)
}

table {
  width: 100%;
  border-collapse: collapse
}

thead {
  background: #F9FAFB
}

th {
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none
}

tr:hover td {
  background: #F9FAFB
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}

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

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

.badge-denied {
  background: var(--danger-bg);
  color: var(--danger)
}

.badge-issued {
  background: var(--info-bg);
  color: var(--info)
}

.badge-returned {
  background: rgba(107, 114, 128, 0.1);
  color: #6B7280
}

/* Toasts */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .35s var(--ease);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
}

.toast-success {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0
}

.toast-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA
}

.toast-info {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #BFDBFE
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s var(--ease);
}

.modal {
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: fadeUp .3s var(--ease);
}

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: .5
}

.empty-state p {
  font-size: 15px
}

/* Search */
.search-bar {
  position: relative;
  margin-bottom: 20px;
  max-width: 400px;
}

.search-bar input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  background: #FFFFFF;
  border: 1px solid #D1D5DB;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border .25s var(--ease), box-shadow .25s var(--ease);
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.search-bar input::placeholder {
  color: var(--text-muted)
}

/* Items Grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.item-card {
  background: #FFFFFF;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  cursor: pointer;
}

.item-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-glow);
}

.item-card .item-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.item-card .item-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5
}

.item-card .item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.item-card .item-qty {
  font-weight: 700;
  font-size: 14px;
}

.item-card .item-qty.in-stock {
  color: var(--success)
}

.item-card .item-qty.low-stock {
  color: var(--warning)
}

.item-card .item-qty.no-stock {
  color: var(--danger)
}

.item-card .item-condition {
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: #F3F4F6;
  color: var(--text-secondary);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

/* Animations */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px)
  }

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

@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px)
  }

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

@keyframes pulse {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .5
  }
}

/* Responsive */
@media(max-width:768px) {
  .sidebar {
    transform: translateX(-100%)
  }

  .sidebar.open {
    transform: translateX(0)
  }

  .main-content {
    margin-left: 0
  }

  .content-area {
    padding: 20px 16px
  }

  .top-bar {
    padding: 0 16px
  }

  .stats-grid {
    grid-template-columns: 1fr
  }

  .mobile-toggle {
    display: flex !important
  }
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
}

.action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px
}

::-webkit-scrollbar-track {
  background: transparent
}

::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF
}

/* Top Bar Actions */
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Notification Bell */
.notif-bell {
  position: relative;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background .2s var(--ease);
}

.notif-bell:hover {
  background: #F3F4F6;
}

.notif-badge {
  position: absolute;
  top: 0;
  right: -2px;
  background: var(--accent-light);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* Notification Items */
.notif-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-glass);
  cursor: pointer;
  transition: background .2s var(--ease);
}

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

.notif-item:hover {
  background: #F9FAFB;
}

.notif-item.unread {
  background: rgba(122, 0, 25, 0.04);
  border-left: 3px solid var(--accent);
}

.notif-msg {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.notif-time {
  font-size: 12px;
  color: var(--text-muted);
}

/* Extra Badges */
.badge-partial {
  background: rgba(122, 0, 25, 0.08);
  color: var(--accent-light);
}

.badge-student {
  background: var(--info-bg);
  color: var(--info);
}

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

.badge-admin {
  background: rgba(122, 0, 25, 0.08);
  color: var(--accent);
}

/* Item Images */
.item-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.item-img-placeholder {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: #F3F4F6;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  color: var(--text-muted);
  opacity: 0.5;
}

hr {
  border: none;
  border-top: 1px solid var(--border-glass);
}

/* ── CUSTOM MODAL STYLES ── */
.custom-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.custom-modal.hidden {
  display: none !important;
}

.custom-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.custom-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  z-index: 10000;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

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

.custom-modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 24px;
}

.custom-modal-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 24px;
  text-align: center;
}

.custom-modal-close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
}

.custom-modal-close:hover {
  color: var(--danger-color);
}

.custom-modal-body {
  color: var(--text-secondary);
  text-align: center;
}

.custom-modal-body img.enlarged-img {
  width: auto;
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin: 0 auto 20px auto;
  display: block;
  background: var(--bg-secondary);
}

.custom-modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  text-align: left;
}

.custom-modal-info-item {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.custom-modal-info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.custom-modal-info-value {
  font-weight: 500;
  color: var(--text-primary);
}