/* =========================================
   GLOBAL RESET
========================================= */

*{
  margin:0;
  padding:0;
  box-sizing:border-box;
  font-family:Inter,system-ui,sans-serif;
}

html,
body{
  width:100%;
  height:100%;
}

body{
  background:#f3f4f6;
  color:#111;
  overflow:hidden;   /* page never scrolls — only the grid does */
}

/* =========================================
   APP LAYOUT
========================================= */

.app{
  display:flex;
  height:100vh;
  height:100dvh;
  overflow:hidden;
}

/* =========================================
   SIDEBAR
========================================= */

.sidebar{
  position:fixed;
  left:0;
  top:0;
  bottom:0;

  width:96px;

  background:#000;

  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:center;

  z-index:100;
}

.sidebar-top{
  padding-top:20px;
}

.sidebar-middle{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
}

.sidebar-bottom{
  padding-bottom:20px;
}

.sidebar-logo{
  width:64px;
  cursor:pointer;
}

#adminToggle{
  width:64px;
  cursor:pointer;
}

/* =========================================
   ADMIN TABS
========================================= */

.admin-tabs{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.admin-tabs.hidden{
  display:none;
}

.tab-button{
  background:none;
  border:none;
  cursor:pointer;
}

.tab-button img{
  width:64px;
  display:block;
}

.tab-button:hover{
  transform:scale(1.05);
}

/* =========================================
   MAIN
========================================= */

.main{
  margin-left: clamp(72px, 8vw, 100px);
  width: calc(100% - clamp(72px, 8vw, 100px));

  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* =========================================
   TOP BAR
========================================= */

.top-bar{
  height:56px;
  flex-shrink:0;
  background:#000;

  display:flex;
  align-items:center;
  justify-content:flex-end;

  padding:0 20px;

  box-shadow:0 2px 8px rgba(0,0,0,.15);
}

.toolbar{
  display:flex;
  gap:10px;
}

.toolbar.hidden{
  display:none;
}

.toolbar input,
.toolbar select{
  height:38px;
  padding:0 12px;

  border:none;
  border-radius:999px;

  background:#fff;

  font-size:.9rem;
}

/* =========================================
   CAMERA GRID
========================================= */

.camera-grid{
  display:grid;

  gap:20px;

  padding:24px;

  justify-content:center;
  align-content:start;     /* rows only as tall as their content */

  /* grid scrolls independently — bars stay fixed */
  overflow-y:auto;
  flex:1;
  min-height:0;
}

@media (orientation:landscape){
  .camera-grid{
    grid-template-columns:
      repeat(3, 1fr);
  }
}

@media (orientation:portrait){
  .camera-grid{
    grid-template-columns:
      repeat(2, minmax(140px, 1fr));
  }
}

/* =========================================
   CAMERA CARD
========================================= */

.camera-card{
  background:#fff;
  border-radius:22px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  box-shadow:0 8px 20px rgba(0,0,0,.08);
  transition:transform .15s ease, box-shadow .15s ease;
}

.camera-card:hover{
  transform:translateY(-3px);
  box-shadow:0 14px 30px rgba(0,0,0,.12);
}

/* =========================================
   CAMERA IMAGE
========================================= */

.camera-image{
  width:100%;
  aspect-ratio:1/1;
  background-size:cover;
  background-position:center;
  background-color:#e9e9e9;
}

/* =========================================
   STATUS PILL
========================================= */

.camera-status{
  margin:14px auto 10px;
  padding:8px 18px;
  border-radius:999px;
  font-size:.9rem;
  font-weight:600;
  text-align:center;
  max-width:90%;
}

.status-in{
  background:#e6f6ec;
  color:#13703a;
}

.status-out{
  background:#fdeaea;
  color:#a31c1c;
}

/* =========================================
   CAMERA FOOTER
========================================= */

.camera-footer{
  background:#d9d9d9;
  padding:16px 10px;
  text-align:center;
  font-weight:700;
  font-size:1rem;
}

/* =========================================
   DISABLED CAMERA
========================================= */

.camera-card.disabled{
  opacity:.45;
}

.camera-card.disabled .camera-footer{
  background:#c2c2c2;
}

/* =========================================
   ADD CAMERA CARD
========================================= */

.add-camera-card{
  border:3px dashed #bfbfbf;
  background:#f8f8f8;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}

.add-camera-card:hover{
  border-color:#000;
  background:#efefef;
}

.add-camera-image{
  width:100%;
  aspect-ratio:1/1;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:64px;
  font-weight:300;
  color:#666;
}

/* =========================================
   BOTTOM BAR
========================================= */

.bottom-bar{
  position: relative;
  flex-shrink: 0;
  height: clamp(40px, 5vh, 52px);
  background:#000;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 18px;
  box-shadow:0 -2px 8px rgba(0,0,0,.15);
  z-index: 999;
}

.bottom-left{
  display:flex;
  gap:10px;
}

.bottom-right{
  display:flex;
  align-items:center;
}

.version{
  font-size:.8rem;
}

.footer-button{
  height:30px;
  padding:0 12px;
  border:none;
  border-radius:999px;
  cursor:pointer;
  font-size:.8rem;
  font-weight:600;
}

.footer-button.hidden{
  display:none;
}

/* =========================================
   ADMIN CAMERA CONTROLS
========================================= */

.admin-camera-controls{
  padding:12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.admin-camera-controls button{
  height:42px;
  border:none;
  border-radius:999px;
  cursor:pointer;
  font-weight:700;
  font-size:.85rem;
  transition:transform .15s ease, box-shadow .15s ease;
}

.admin-camera-controls button:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,.12);
}

/* =========================================
   SPLIT CHECK IN / CHECK OUT
========================================= */

.admin-split-button{
  display:flex;
  gap:8px;
}

.admin-split-button button{
  flex:1;
  height:44px;
  border:none;
  border-radius:999px;
  cursor:pointer;
  font-weight:700;
  font-size:.85rem;
  transition:transform .15s ease, box-shadow .15s ease;
}

.admin-split-button button:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,.12);
}

.checkin-btn{
  background:#e6f6ec;
  color:#13703a;
}

.checkout-btn{
  background:#e8f0ff;
  color:#1a52d9;
}

/* =========================================
   BUTTON COLORS
========================================= */

.admin-btn-in      { background:#e6f6ec; color:#13703a; }
.admin-btn-out     { background:#e8f0ff; color:#1a52d9; }
.admin-btn-edit    { background:#fff4d9; color:#8f6700; }
.admin-btn-delete  { background:#fdeaea; color:#a31c1c; }
.admin-btn-disable { background:#ffe6e6; color:#b51616; }
.admin-btn-enable  { background:#ddf8e6; color:#0d7a39; }
.admin-btn-history { background:#f0f0f0; color:#444;    }

/* =========================================
   STAFF CARD
========================================= */

.staff-card{
  background:#fff;
  border-radius:22px;
  overflow:hidden;
  box-shadow:0 8px 20px rgba(0,0,0,.08);
  display:flex;
  flex-direction:column;
}

.staff-name{
  padding:18px;
  text-align:center;
  font-size:1rem;
  font-weight:700;
}

.staff-id{
  text-align:center;
  padding-bottom:14px;
  color:#666;
  font-size:.9rem;
}

.staff-admin-badge{
  margin:0 auto 14px;
  padding:6px 14px;
  border-radius:999px;
  background:#e6f6ec;
  color:#13703a;
  font-weight:700;
  font-size:.8rem;
}

.staff-controls{
  padding:12px;
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:6px;
}

.staff-controls button{
  height:38px;
  border:none;
  border-radius:999px;
  cursor:pointer;
  font-size:.8rem;
  font-weight:700;
  transition:transform .15s ease;
}

.staff-controls button:hover{
  transform:translateY(-2px);
}

.staff-edit   { background:#fff4d9; color:#8f6700; }
.staff-delete { background:#fdeaea; color:#a31c1c; }
.staff-admin  { background:#ddf8e6; color:#0d7a39; }
.staff-history{ background:#ececec; color:#444;    }

/* =========================================
   LOG CARD
========================================= */

.log-card{
  background:#fff;
  border-radius:20px;
  overflow:hidden;
  box-shadow:0 6px 16px rgba(0,0,0,.08);
}

.log-title{
  background:#d9d9d9;
  padding:14px;
  text-align:center;
  font-weight:700;
}

.log-detail{
  padding:16px;
  text-align:center;
}

.log-footer{
  background:#f4f4f4;
  padding:12px;
  text-align:center;
  font-size:.85rem;
  color:#666;
}

/* =========================================
   SEARCH TOOLBARS
========================================= */

#cameraToolbar,
#logFilters,
#staffToolbar{
  display:flex;
  gap:10px;
  align-items:center;
}

#cameraToolbar.hidden,
#logFilters.hidden,
#staffToolbar.hidden{
  display:none;
}

#cameraToolbar input,
#cameraToolbar select,
#logFilters input,
#logFilters select,
#staffToolbar input{
  min-width:180px;
  background:#fff;
  border:none;
  border-radius:999px;
  padding:0 14px;
  height:38px;
}

/* =========================================
   MODALS — BACKDROP + CENTERING
   THIS WAS THE MISSING BLOCK
========================================= */

.modal{
  position:fixed;
  inset:0;                          /* top/right/bottom/left all 0 */
  z-index:200;

  display:flex;
  align-items:center;
  justify-content:center;

  background:rgba(0,0,0,.55);       /* dark backdrop */

  padding:20px;
}

.modal.hidden{
  display:none;
}

.modal-content{
  background:#fff;
  border-radius:24px;

  padding:32px 28px;

  width:100%;
  max-width:460px;

  text-align:center;

  box-shadow:0 24px 60px rgba(0,0,0,.25);

  position:relative;
}

.modal-content h2{
  font-size:1.4rem;
  font-weight:700;
  margin-bottom:10px;
}

.modal-content h1{
  font-size:1.8rem;
  font-weight:700;
  margin-bottom:10px;
}

.modal-content p{
  color:#555;
  margin-bottom:6px;
  font-size:1rem;
}

/* =========================================
   MODAL ACTIONS (button row)
========================================= */

.modal-actions{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
  margin-top:22px;
}

.modal-actions button{
  height:44px;
  padding:0 22px;
  border:none;
  border-radius:999px;
  cursor:pointer;
  font-weight:700;
  font-size:.9rem;
  transition:transform .15s ease, box-shadow .15s ease;
}

.modal-actions button:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,.15);
}

/* button colors inside modals */
#confirmYes,
#confirmDeleteCamera,
#confirmDeleteStaff,
#staffConfirmYes,
#saveStaffBtn,
#saveCameraBtn,
#genericConfirmYes{
  background:#111;
  color:#fff;
}

#confirmNo,
#cancelCameraBtn,
#cancelStaffBtn,
#cancelDeleteCamera,
#cancelDeleteStaff,
#staffConfirmCancel,
#genericConfirmNo{
  background:#f0f0f0;
  color:#333;
}

#takeHomeBtn{
  background:#e8f0ff;
  color:#1a52d9;
}

#staffRegenerate{
  background:#fff4d9;
  color:#8f6700;
}

/* =========================================
   SCAN MODAL INPUT
========================================= */

.scan-modal{
  max-width:360px;
}

#scanInput{
  width:100%;
  height:56px;
  margin-top:18px;
  border:2px solid #ddd;
  border-radius:14px;
  font-size:1.6rem;
  text-align:center;
  letter-spacing:6px;
  outline:none;
  transition:border-color .2s;
}

#scanInput:focus{
  border-color:#000;
}

/* =========================================
   CONFIRM IMAGE (checkout modal)
========================================= */

.confirm-image{
  width:140px;
  height:140px;
  object-fit:cover;
  border-radius:16px;
  margin-bottom:14px;
  background:#eee;
}

/* =========================================
   CAMERA ADD/EDIT MODAL
========================================= */

.large-camera-modal{
  max-width:520px;
}

.camera-preview-wrapper{
  margin-bottom:18px;
}

.camera-preview-large{
  width:100%;
  max-height:260px;
  object-fit:contain;
  border-radius:16px;
  background:#f2f2f2;
}

/* =========================================
   FORM GROUPS (inside modals)
========================================= */

.form-group{
  text-align:left;
  margin-bottom:14px;
}

.form-group label{
  display:block;
  font-weight:600;
  font-size:.85rem;
  margin-bottom:6px;
  color:#444;
}

.form-group input[type="text"]{
  width:100%;
  height:44px;
  border:2px solid #e0e0e0;
  border-radius:12px;
  padding:0 14px;
  font-size:.95rem;
  outline:none;
  transition:border-color .2s;
}

.form-group input[type="text"]:focus{
  border-color:#000;
}

.checkbox-row{
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  font-weight:600;
}

.checkbox-row input[type="checkbox"]{
  width:18px;
  height:18px;
  cursor:pointer;
}

/* =========================================
   IMAGE DROP ZONE
========================================= */

.square-image-button{
  width:100%;
  height:120px;
  border:3px dashed #bbb;
  border-radius:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  background:#f8f8f8;
  color:#666;
  font-weight:600;
  font-size:.9rem;
  transition:border-color .15s, background .15s;
}

.square-image-button:hover{
  border-color:#000;
  background:#efefef;
}

/* =========================================
   ADMIN MODE GLOW
========================================= */

body.admin-active .sidebar{
  box-shadow:0 0 30px rgba(40,120,255,.35);
}

body.admin-active .top-bar{
  box-shadow:0 0 18px rgba(40,120,255,.25);
}

/* =========================================
   CARD ANIMATIONS
========================================= */

.camera-card,
.staff-card,
.log-card{
  animation:cardPop .22s ease;
}

@keyframes cardPop{
  from{ opacity:0; transform:translateY(10px); }
  to{   opacity:1; transform:translateY(0);    }
}

.fade-in{
  animation:fadeIn .2s ease;
}

@keyframes fadeIn{
  from{ opacity:0; transform:translateY(8px); }
  to{   opacity:1; transform:translateY(0);   }
}

/* =========================================
   TABLET
========================================= */

@media(max-width:900px){
  .camera-grid{
    grid-template-columns: repeat(3, 1fr);
  }
}

/* =========================================
   PHONE
========================================= */

@media(max-width:600px){

  .camera-grid{
    grid-template-columns:repeat(2,1fr);
    gap:14px;
    padding:14px;
  }

  .camera-footer{
    font-size:.9rem;
  }

  .camera-status{
    font-size:.8rem;
  }

  .admin-camera-controls button{
    font-size:.75rem;
  }

  .toolbar{
    flex-wrap:wrap;
  }

  .toolbar input,
  .toolbar select{
    min-width:120px;
  }

  .modal-content{
    padding:24px 18px;
  }
}

/* =========================================
   TAKE-HOME REQUEST BADGE ON CAMERA CARD
========================================= */

.camera-request-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #e63946;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 8px rgba(230,57,70,.4);
  pointer-events: none;
}

/* camera-image needs position relative for the badge */
.camera-image {
  position: relative;
}

/* =========================================
   REQUEST ROW (inside admin camera controls)
========================================= */

.request-row {
  background: #fff4e0;
  border: 2px solid #f4a800;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: .85rem;
  color: #7a5000;
  text-align: center;
  margin-bottom: 4px;
}

/* =========================================
   SCAN INPUT — numeric keypad friendly
========================================= */

#scanInput {
  -moz-appearance: textfield;
}

#scanInput::-webkit-outer-spin-button,
#scanInput::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* =========================================
   LEAD DEVELOPER ROLE BADGE
========================================= */

.staff-role-badge {
  background: #ede9fe;
  color: #5b21b6;
}

/* =========================================
   TEXTAREA (reason inputs)
========================================= */

textarea {
  width: 100%;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: .95rem;
  font-family: Inter, system-ui, sans-serif;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
  color: #111;
}

textarea:focus {
  border-color: #000;
}

/* =========================================
   REQUEST REASON (shown on admin card)
========================================= */

.request-reason {
  font-size: .82rem;
  color: #7a5000;
  margin-top: 5px;
  font-style: italic;
}

/* =========================================
   EXPORT BUTTON IN TOOLBAR
========================================= */

.toolbar-btn {
  height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #111;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: #e8e8e8;
}

/* =========================================
   DISABLED SUBMIT BUTTON
========================================= */

button:disabled {
  cursor: not-allowed;
}

/* =========================================
   LIVE CLOCK
========================================= */

.live-clock {
  font-size: .9rem;
  font-weight: 600;
  color: #fff;
  margin-right: 14px;
  letter-spacing: .5px;
}

/* =========================================
   CHOICE MODAL BUTTONS
========================================= */

.choice-btn {
  width: 100%;
  height: 56px;
  border: none;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.choice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}

.choice-out {
  background: #e8f0ff;
  color: #1a52d9;
}

.choice-in {
  background: #e6f6ec;
  color: #13703a;
}

/* =========================================
   SD CARD GRID
========================================= */

.sd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0 10px;
}

.sd-btn {
  height: 52px;
  border: 2px solid #e0e0e0;
  border-radius: 14px;
  background: #f8f8f8;
  font-weight: 700;
  font-size: .9rem;
  cursor: pointer;
  transition: .15s ease;
  color: #111;
}

.sd-btn:hover {
  border-color: #000;
  background: #111;
  color: #fff;
  transform: translateY(-2px);
}

/* =========================================
   DRAG HANDLE
========================================= */

.drag-handle {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  cursor: grab;
  z-index: 10;
}

.drag-handle span {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,.85);
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
}

.drag-handle:active {
  cursor: grabbing;
}

/* =========================================
   DRAGGING STATES
========================================= */

.camera-card.dragging {
  opacity: .4;
  transform: scale(.97);
}

.camera-card.drag-over {
  outline: 3px solid #111;
  outline-offset: 2px;
  transform: scale(1.02);
}

/* =========================================
   RESPONSIVE SCALING SYSTEM
   Uses clamp() so everything scales smoothly
   between small phones and large monitors.
   Nothing ever gets too big or too small.
========================================= */

/* sidebar scales with viewport */
.sidebar {
  width: clamp(72px, 8vw, 100px);
}

.sidebar-logo,
#adminToggle {
  width: clamp(44px, 5.5vw, 68px);
}

.tab-button img {
  width: clamp(44px, 5.5vw, 68px);
}

/* main content offset matches sidebar */
.main {
  margin-left: clamp(72px, 8vw, 100px);
  width: calc(100% - clamp(72px, 8vw, 100px));
}

/* top bar height */
.top-bar {
  height: clamp(48px, 6vh, 64px);
}

/* bottom bar positioning handled in main .bottom-bar rule above */

/* camera grid padding and gap */
.camera-grid {
  gap: clamp(12px, 2vw, 24px);
  padding: clamp(14px, 2.5vw, 28px);
}

/* camera card text */
.camera-footer {
  font-size: clamp(.75rem, 1.4vw, 1rem);
  padding: clamp(10px, 1.5vw, 18px) clamp(8px, 1vw, 14px);
}

.camera-status {
  font-size: clamp(.7rem, 1.2vw, .95rem);
  padding: clamp(5px, .8vw, 10px) clamp(10px, 1.5vw, 20px);
  margin: clamp(8px, 1.2vw, 16px) auto clamp(6px, 1vw, 12px);
}

/* modal content max width scales with viewport */
.modal-content {
  max-width: clamp(300px, 90vw, 480px);
  padding: clamp(20px, 4vw, 36px) clamp(16px, 3.5vw, 30px);
}

.modal-content h1 {
  font-size: clamp(1.2rem, 3vw, 1.9rem);
}

.modal-content h2 {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
}

.modal-content p {
  font-size: clamp(.8rem, 1.8vw, 1rem);
}

/* modal action buttons */
.modal-actions button {
  height: clamp(38px, 5vh, 50px);
  font-size: clamp(.8rem, 1.5vw, .95rem);
  padding: 0 clamp(14px, 2vw, 26px);
}

/* scan input */
#scanInput {
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  height: clamp(44px, 7vh, 62px);
  letter-spacing: clamp(3px, 1vw, 8px);
}

/* admin camera control buttons */
.admin-camera-controls button {
  height: clamp(34px, 4.5vh, 46px);
  font-size: clamp(.72rem, 1.2vw, .9rem);
}

.admin-split-button button {
  height: clamp(34px, 4.5vh, 46px);
  font-size: clamp(.72rem, 1.2vw, .9rem);
}

/* staff card text */
.staff-name {
  font-size: clamp(.85rem, 1.5vw, 1.05rem);
  padding: clamp(12px, 1.8vw, 20px);
}

.staff-id {
  font-size: clamp(.75rem, 1.2vw, .92rem);
}

.staff-controls button {
  height: clamp(32px, 4vh, 42px);
  font-size: clamp(.7rem, 1.1vw, .85rem);
}

/* log card text */
.log-title {
  font-size: clamp(.8rem, 1.4vw, 1rem);
  padding: clamp(10px, 1.5vw, 16px);
}

.log-detail {
  font-size: clamp(.78rem, 1.3vw, .95rem);
  padding: clamp(10px, 1.5vw, 18px);
}

.log-footer {
  font-size: clamp(.72rem, 1.1vw, .88rem);
  padding: clamp(8px, 1.2vw, 14px);
}

/* toolbar inputs */
.toolbar input,
.toolbar select,
#cameraToolbar input,
#cameraToolbar select,
#logFilters input,
#logFilters select,
#staffToolbar input {
  height: clamp(32px, 4.5vh, 42px);
  font-size: clamp(.78rem, 1.2vw, .92rem);
  min-width: clamp(100px, 14vw, 200px);
}

/* version and clock text */
.live-clock {
  font-size: clamp(.75rem, 1.2vw, .95rem);
}

.version {
  font-size: clamp(.68rem, 1vw, .85rem);
}

/* footer buttons */
.footer-button {
  height: clamp(26px, 3.5vh, 34px);
  font-size: clamp(.72rem, 1.1vw, .85rem);
}

/* choice modal buttons */
.choice-btn {
  height: clamp(48px, 7vh, 62px);
  font-size: clamp(.9rem, 1.8vw, 1.15rem);
}

/* SD card grid */
.sd-btn {
  height: clamp(44px, 6.5vh, 58px);
  font-size: clamp(.78rem, 1.3vw, .95rem);
}

/* confirm image in checkout modal */
.confirm-image {
  width: clamp(90px, 15vw, 150px);
  height: clamp(90px, 15vw, 150px);
}

/* camera preview in edit modal */
.camera-preview-large {
  max-height: clamp(160px, 25vh, 280px);
}

/* drag handle scales with card */
.drag-handle span {
  width: clamp(14px, 2vw, 20px);
}

/* =========================================
   OPENING SPLASH SCREEN
========================================= */

#splashScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
  pointer-events: none;
}

#splashLogo {
  width: clamp(80px, 18vw, 160px);
  opacity: 0;
  animation: splashLogoIn 0.7s cubic-bezier(.22,1,.36,1) 0.2s forwards;
}

#splashTitle {
  color: #fff;
  font-size: clamp(1rem, 3vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0;
  animation: splashLogoIn 0.6s cubic-bezier(.22,1,.36,1) 0.55s forwards;
}

#splashDots {
  display: flex;
  gap: 8px;
  opacity: 0;
  animation: splashLogoIn 0.4s ease 0.9s forwards;
}

#splashDots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: dotPulse 0.8s ease-in-out infinite;
}

#splashDots span:nth-child(2) { animation-delay: 0.15s; }
#splashDots span:nth-child(3) { animation-delay: 0.30s; }

@keyframes splashLogoIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}

@keyframes dotPulse {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50%       { opacity: 1;  transform: scale(1.2); }
}

/* splash exit */
#splashScreen.splash-out {
  animation: splashExit 0.6s cubic-bezier(.4,0,1,1) forwards;
}

@keyframes splashExit {
  0%   { opacity: 1; transform: scale(1);    }
  100% { opacity: 0; transform: scale(1.06); }
}

/* app content hidden until splash exits */
.app-hidden {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(.22,1,.36,1);
}

.app-visible {
  opacity: 1;
  transform: none;   /* any transform here breaks position:fixed for the sidebar */
}

/* =========================================
   MODAL ANIMATIONS
   Spring pop in, quick shrink out
========================================= */

.modal:not(.hidden) .modal-content {
  animation: modalSpringIn 0.35s cubic-bezier(.22,1,.36,1) forwards;
}

@keyframes modalSpringIn {
  0%   { opacity: 0; transform: scale(.88) translateY(12px); }
  100% { opacity: 1; transform: scale(1)   translateY(0);    }
}

.modal-content.modal-closing {
  animation: modalShrinkOut 0.18s ease-in forwards;
}

@keyframes modalShrinkOut {
  0%   { opacity: 1; transform: scale(1);   }
  100% { opacity: 0; transform: scale(.92); }
}

/* modal backdrop fade */
.modal:not(.hidden) {
  animation: backdropIn 0.25s ease forwards;
}

@keyframes backdropIn {
  from { background: rgba(0,0,0,0);   }
  to   { background: rgba(0,0,0,.55); }
}

/* =========================================
   BUTTON PRESS ANIMATION
========================================= */

.camera-card button,
.modal-actions button,
.choice-btn,
.sd-btn,
.tab-button,
.add-staff-btn,
.footer-button,
.toolbar-btn {
  transition:
    transform 0.12s cubic-bezier(.22,1,.36,1),
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

.camera-card button:active,
.modal-actions button:active,
.choice-btn:active,
.sd-btn:active,
.toolbar-btn:active {
  transform: scale(.94) translateY(1px) !important;
  box-shadow: none !important;
}

/* =========================================
   CAMERA CARD CASCADE
   Cards stagger in one by one
========================================= */

.camera-card {
  opacity: 0;
  animation: cardCascade 0.4s cubic-bezier(.22,1,.36,1) forwards;
}

/* stagger delays for up to 12 cards */
.camera-card:nth-child(1)  { animation-delay: 0.04s; }
.camera-card:nth-child(2)  { animation-delay: 0.08s; }
.camera-card:nth-child(3)  { animation-delay: 0.12s; }
.camera-card:nth-child(4)  { animation-delay: 0.16s; }
.camera-card:nth-child(5)  { animation-delay: 0.20s; }
.camera-card:nth-child(6)  { animation-delay: 0.24s; }
.camera-card:nth-child(7)  { animation-delay: 0.28s; }
.camera-card:nth-child(8)  { animation-delay: 0.32s; }
.camera-card:nth-child(9)  { animation-delay: 0.36s; }
.camera-card:nth-child(10) { animation-delay: 0.40s; }
.camera-card:nth-child(11) { animation-delay: 0.44s; }
.camera-card:nth-child(12) { animation-delay: 0.48s; }

@keyframes cardCascade {
  0%   { opacity: 0; transform: translateY(18px) scale(.97); }
  100% { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* staff and log cards get same treatment */
.staff-card {
  opacity: 0;
  animation: cardCascade 0.4s cubic-bezier(.22,1,.36,1) forwards;
}

.staff-card:nth-child(1)  { animation-delay: 0.04s; }
.staff-card:nth-child(2)  { animation-delay: 0.08s; }
.staff-card:nth-child(3)  { animation-delay: 0.12s; }
.staff-card:nth-child(4)  { animation-delay: 0.16s; }
.staff-card:nth-child(5)  { animation-delay: 0.20s; }
.staff-card:nth-child(6)  { animation-delay: 0.24s; }
.staff-card:nth-child(7)  { animation-delay: 0.28s; }
.staff-card:nth-child(8)  { animation-delay: 0.32s; }

.log-card {
  opacity: 0;
  animation: cardCascade 0.35s cubic-bezier(.22,1,.36,1) forwards;
}

.log-card:nth-child(1)  { animation-delay: 0.02s; }
.log-card:nth-child(2)  { animation-delay: 0.05s; }
.log-card:nth-child(3)  { animation-delay: 0.08s; }
.log-card:nth-child(4)  { animation-delay: 0.11s; }
.log-card:nth-child(5)  { animation-delay: 0.14s; }
.log-card:nth-child(6)  { animation-delay: 0.17s; }
.log-card:nth-child(7)  { animation-delay: 0.20s; }
.log-card:nth-child(8)  { animation-delay: 0.23s; }
.log-card:nth-child(9)  { animation-delay: 0.26s; }
.log-card:nth-child(10) { animation-delay: 0.29s; }

/* =========================================
   TAB SWITCH SLIDE
========================================= */

.grid-slide-left {
  animation: slideOutLeft 0.18s ease-in forwards;
}

.grid-slide-right {
  animation: slideOutRight 0.18s ease-in forwards;
}

@keyframes slideOutLeft {
  to { opacity: 0; transform: translateX(-24px); }
}

@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(24px); }
}

/* =========================================
   ADMIN GLOW PULSE ON LOGIN
========================================= */

@keyframes adminLoginPulse {
  0%   { box-shadow: 0 0 0   rgba(40,120,255,0);   }
  50%  { box-shadow: 0 0 60px rgba(40,120,255,.6);  }
  100% { box-shadow: 0 0 30px rgba(40,120,255,.35); }
}

.sidebar.admin-pulse {
  animation: adminLoginPulse 0.7s ease forwards;
}

/* =========================================
   SIDEBAR ICON BOUNCE ON TAB SWITCH
========================================= */

@keyframes iconBounce {
  0%   { transform: scale(1);    }
  40%  { transform: scale(1.18); }
  70%  { transform: scale(.94);  }
  100% { transform: scale(1);    }
}

.tab-icon-bounce {
  animation: iconBounce 0.35s cubic-bezier(.22,1,.36,1) forwards;
}

/* =========================================
   ADMIN TOGGLE SPIN ON LOGOUT
========================================= */

@keyframes adminIconSpin {
  0%   { transform: rotate(0deg)   scale(1);    }
  50%  { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1);    }
}

.admin-spin {
  animation: adminIconSpin 0.45s cubic-bezier(.22,1,.36,1) forwards;
}

/* =========================================
   STATUS PILL TRANSITION
========================================= */

.camera-status {
  transition: background 0.3s ease, color 0.3s ease;
}

/* =========================================
   TOAST SLIDE UP
========================================= */

#toastNotif {
  transition: opacity 0.4s ease, transform 0.35s cubic-bezier(.22,1,.36,1);
  transform: translateX(-50%) translateY(0);
}

#toastNotif.toast-hidden {
  opacity: 0 !important;
  transform: translateX(-50%) translateY(12px);
}

/* =========================================
   SD CARD CHECKOUT (v2.8.0)
========================================= */

/* admin-only sidebar tabs hide themselves for students */
.tab-button.hidden {
  display: none;
}

/* four icons fit on short screens */
.admin-tabs {
  gap: clamp(8px, 2vh, 16px);
}

/* SD card tile: dark square with the sd card icon centered */
.sd-card-image {
  background-color: #111;
  background-image: url('images/ui/sdcard_icon_on.png');
  background-size: 48%;
  background-repeat: no-repeat;
  background-position: center;
}

/* sd icon in the confirm popup (icon is made for dark backgrounds) */
.confirm-image-sd {
  background: #111;
  padding: 18px;
  object-fit: contain;
}
