:root {
  --tcams-primary: #103c5e;
  --tcams-accent: #1c7c54;
  --tcams-bg: #f4f6f9;
}

body { background: var(--tcams-bg); font-family: 'Segoe UI', Roboto, Arial, sans-serif; }

.tcams-navbar { background: var(--tcams-primary); }

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--tcams-primary), var(--tcams-accent));
}

.login-card {
  max-width: 420px;
  width: 100%;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

.stat-card {
  border: none;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.stat-card .stat-value { font-size: 2rem; font-weight: 700; }

.status-badge-Present { background:#1c7c54; }
.status-badge-Absent { background:#c0392b; }
.status-badge-Late { background:#e67e22; }
.status-badge-Excused { background:#7f8c8d; }
.status-badge-Official-Duty { background:#2980b9; }
.status-badge-Examination-Duty { background:#8e44ad; }
.status-badge-Lesson-Not-Held { background:#34495e; }

.table-sticky thead th { position: sticky; top: 0; background: #fff; z-index: 2; }

/* ------------------------------------------------------------------
   Loading feedback
   ------------------------------------------------------------------ */
#tcams-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  z-index: 2000; opacity: 0; transition: opacity .2s; pointer-events: none;
}
#tcams-progress.active { opacity: 1; }
#tcams-progress span {
  display: block; height: 100%; width: 0%;
  background: var(--tcams-accent, #1c7c54);
  box-shadow: 0 0 8px rgba(28,124,84,.6);
  transition: width .2s ease-out;
}

#tcams-loader {
  position: fixed; inset: 0; z-index: 1990;
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity .18s;
}
#tcams-loader.active { opacity: 1; visibility: visible; }

.tcams-loader-box {
  background: #fff; border-radius: 14px; padding: 26px 34px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.16); min-width: 210px; max-width: 88vw;
}
.tcams-loader-text { font-weight: 600; margin-top: 14px; color: #1f2a35; }
.tcams-loader-sub { font-size: .82rem; color: #6b7a88; margin-top: 4px; }

.tcams-spinner {
  width: 40px; height: 40px; margin: 0 auto;
  border: 3px solid rgba(16,60,94,.15);
  border-top-color: var(--tcams-primary, #103c5e);
  border-radius: 50%;
  animation: tcams-spin .8s linear infinite;
}
@keyframes tcams-spin { to { transform: rotate(360deg); } }

/* First paint, before the stylesheet-driven app is ready */
#tcams-boot {
  position: fixed; inset: 0; z-index: 3000;
  background: var(--tcams-primary, #103c5e);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  color: #fff; transition: opacity .35s ease;
}
#tcams-boot.done { opacity: 0; pointer-events: none; }
#tcams-boot .boot-mark { font-size: 2rem; font-weight: 700; letter-spacing: .04em; }
#tcams-boot .boot-sub { font-size: .85rem; opacity: .75; margin-top: 6px; }
#tcams-boot .boot-bar {
  width: 160px; height: 3px; background: rgba(255,255,255,.25);
  border-radius: 2px; margin-top: 18px; overflow: hidden;
}
#tcams-boot .boot-bar span {
  display: block; height: 100%; width: 40%;
  background: #fff; border-radius: 2px;
  animation: tcams-boot-slide 1.1s ease-in-out infinite;
}
@keyframes tcams-boot-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(320%); }
}

@media print {
  #tcams-loader, #tcams-progress, #tcams-boot { display: none !important; }
}

/* Attachment capture */
.capture-field [data-capture-preview] { margin-top: .25rem; }

/* ==================================================================
   Navigation
   ================================================================== */
.tcams-navbar {
  background: linear-gradient(100deg,
              var(--tcams-primary, #103c5e) 0%,
              color-mix(in srgb, var(--tcams-primary, #103c5e) 82%, black) 100%);
  box-shadow: 0 2px 14px rgba(0,0,0,.16);
  padding-top: .45rem;
  padding-bottom: .45rem;
  z-index: 1030;
}

/* Brand ---------------------------------------------------------- */
.tcams-navbar .navbar-brand { padding: 0; margin-right: .25rem; }
.brand-badge {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 11px;
  color: #fff; font-size: 1.15rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  color: #fff; font-weight: 700; font-size: 1.12rem; letter-spacing: .035em;
}
.brand-sub {
  color: rgba(255,255,255,.62); font-size: .68rem; font-weight: 500;
  letter-spacing: .02em; max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Links ---------------------------------------------------------- */
.tcams-navbar .navbar-nav .nav-link {
  color: rgba(255,255,255,.82) !important;
  font-size: .875rem;
  font-weight: 500;
  padding: .5rem .8rem;
  border-radius: 9px;
  white-space: nowrap;
  display: flex; align-items: center; gap: .42rem;
  transition: background .15s, color .15s;
}
.tcams-navbar .navbar-nav .nav-link i { font-size: .95rem; opacity: .85; }
.tcams-navbar .navbar-nav .nav-link:hover,
.tcams-navbar .navbar-nav .nav-link:focus {
  color: #fff !important;
  background: rgba(255,255,255,.12);
}
.tcams-navbar .navbar-nav .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 -2px 0 var(--tcams-accent, #1c7c54);
}
.tcams-navbar .dropdown-toggle::after { margin-left: .3rem; opacity: .6; }

/* Dropdowns ------------------------------------------------------ */
.tcams-navbar .dropdown-menu {
  border: 0;
  border-radius: 12px;
  padding: .4rem;
  min-width: 240px;
  box-shadow: 0 10px 34px rgba(16,32,50,.18) !important;
  animation: tcams-drop .16s ease-out;
}
@keyframes tcams-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tcams-navbar .dropdown-item {
  border-radius: 8px;
  padding: .5rem .7rem;
  font-size: .875rem;
  display: flex; align-items: center; gap: .6rem;
}
.tcams-navbar .dropdown-item i { width: 18px; text-align: center; opacity: .62; }
.tcams-navbar .dropdown-item:hover {
  background: color-mix(in srgb, var(--tcams-primary, #103c5e) 8%, white);
  color: var(--tcams-primary, #103c5e);
}
.tcams-navbar .dropdown-item:hover i { opacity: 1; }
.tcams-navbar .dropdown-header {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: #97a4b1; font-weight: 700; padding: .5rem .7rem .25rem;
}
.tcams-navbar .dropdown-divider { margin: .3rem .4rem; opacity: .5; }

/* Icon buttons --------------------------------------------------- */
.btn-nav-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9); font-size: 1.02rem;
}
.btn-nav-icon:hover { background: rgba(255,255,255,.18); color: #fff; }
.notif-dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px;
  background: #e03131; color: #fff;
  font-size: .64rem; font-weight: 700;
  display: grid; place-items: center;
  border: 2px solid var(--tcams-primary, #103c5e);
}

/* User menu ------------------------------------------------------ */
.btn-user {
  border-radius: 10px; padding: .25rem .55rem .25rem .3rem;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  color: #fff;
}
.btn-user:hover { background: rgba(255,255,255,.18); color: #fff; }
.avatar {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--tcams-accent, #1c7c54);
  color: #fff; font-size: .74rem; font-weight: 700; letter-spacing: .03em;
}
.user-name { font-size: .8rem; font-weight: 600; }
.user-role { font-size: .66rem; opacity: .68; margin-top: 2px; }

/* Notifications panel -------------------------------------------- */
.notif-menu { width: 330px; padding: 0 !important; overflow: hidden; }
.notif-head { padding: .7rem .85rem; border-bottom: 1px solid #eef1f4; }
.notif-body { max-height: 330px; overflow-y: auto; }
.notif-item {
  display: block; padding: .65rem .85rem;
  border-bottom: 1px solid #f2f5f7;
  color: #33414f; text-decoration: none;
}
.notif-item:hover { background: #f6f9fb; color: #103c5e; }
.notif-item.unread { background: #f0f7fd; border-left: 3px solid var(--tcams-accent, #1c7c54); }
.notif-time { font-size: .7rem; color: #93a1ad; margin-top: 3px; }
.notif-foot {
  display: block; text-align: center; padding: .6rem;
  font-size: .8rem; font-weight: 600; text-decoration: none;
  color: var(--tcams-primary, #103c5e); background: #f8fafb;
}
.notif-foot:hover { background: #eef3f7; }

/* Collapsed / mobile --------------------------------------------- */
@media (max-width: 1199.98px) {
  .tcams-navbar .navbar-collapse {
    background: rgba(0,0,0,.16);
    border-radius: 12px;
    margin-top: .6rem;
    padding: .5rem;
    max-height: 72vh; overflow-y: auto;
  }
  .tcams-navbar .dropdown-menu {
    background: rgba(255,255,255,.06);
    box-shadow: none !important;
    margin: .15rem 0 .35rem .9rem;
  }
  .tcams-navbar .dropdown-item { color: rgba(255,255,255,.86); }
  .tcams-navbar .dropdown-item:hover { background: rgba(255,255,255,.14); color: #fff; }
  .tcams-navbar .dropdown-header { color: rgba(255,255,255,.5); }
  .tcams-navbar .dropdown-divider { border-color: rgba(255,255,255,.16); }
  .notif-menu { width: 300px; background: #fff; }
  .notif-menu .notif-item { color: #33414f; }
}

.navbar-toggler {
  border-color: rgba(255,255,255,.25);
  padding: .35rem .55rem;
}
.navbar-toggler:focus { box-shadow: 0 0 0 .18rem rgba(255,255,255,.18); }

/* Alerts get a little more shape */
main > .alert { border: 0; border-radius: 11px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }

@media print {
  .tcams-navbar { display: none !important; }
}

/* ------------------------------------------------------------------
   Reminder banner, shown when notifications are refused
   ------------------------------------------------------------------ */
.tcams-reminder {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 2100; display: flex; align-items: flex-start; gap: 12px;
  background: #fff; border-radius: 12px; padding: 13px 15px;
  box-shadow: 0 10px 34px rgba(16,32,50,.24);
  border-left: 5px solid var(--tcams-accent, #1c7c54);
  max-width: min(440px, 92vw);
  animation: tr-rise .25s ease-out;
}
.tcams-reminder.tr-high { border-left-color: #c0392b; }
.tcams-reminder .tr-title { font-weight: 700; font-size: .93rem; color: #22303d; }
.tcams-reminder .tr-text { font-size: .82rem; color: #6b7a88; margin-top: 2px; }
.tcams-reminder .tr-close {
  border: 0; background: transparent; font-size: 1.3rem; line-height: 1;
  color: #9aa5b0; cursor: pointer; padding: 0 2px;
}
@keyframes tr-rise {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@media print { .tcams-reminder { display: none !important; } }

/* Camera input kept reachable by script without display:none, which many
   mobile browsers refuse to open programmatically. */
.capture-offscreen {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
