/**
 * ADExploit Companion - Mobile App Styles
 */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #0f172a;
  --bg-card: #131c31;
  --bg-accent: #0284c7;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: #1e293b;
  --header-height: 56px;
  --tab-height: 42px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body.theme-light {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-accent: #0284c7;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border-color: #cbd5e1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

/* HEADER */
.app-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 100;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-day {
  font-size: 10.5px;
  color: #38bdf8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* VUE TOGGLES (GRILLE / CHECKLIST) */
.view-switch {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2px;
  flex-shrink: 0;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-btn.active {
  background: var(--bg-accent);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:active {
  transform: scale(0.94);
}

/* MULTI-SHEET TABS BAR */
.sheet-tabs-bar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 6px 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.sheet-tabs-bar::-webkit-scrollbar {
  display: none;
}

.sheet-tab {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.sheet-tab.active {
  background: rgba(2, 132, 199, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.tab-del-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
}

.sheet-tab.tab-add {
  border-style: dashed;
  color: #38bdf8;
}

/* MAIN CONTENT VIEWPORTS */
.view-viewport {
  flex: 1;
  position: relative;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

#checklist-scroll-container {
  padding: 12px;
}

/* FLOATING CONTROLS */
.fab-btn {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  right: 16px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-accent);
  color: #ffffff;
  border: 2px solid #38bdf8;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  transition: transform 0.15s ease;
}

.fab-btn:active {
  transform: scale(0.9);
}

.zoom-controls {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 90;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

/* OPTIONS DRAWER */
.options-drawer {
  position: fixed;
  top: calc(var(--header-height) + var(--safe-top));
  right: -100%;
  width: 290px;
  max-width: 85%;
  height: calc(100% - var(--header-height) - var(--safe-top));
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.6);
  z-index: 200;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: right 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.options-drawer.open {
  right: 0;
}

.drawer-title {
  font-size: 14px;
  font-weight: 800;
  color: #38bdf8;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.option-row input[type="checkbox"] {
  accent-color: var(--bg-accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* DETAILS BOTTOM SHEET */
.details-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.details-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.details-bottom-sheet {
  position: fixed;
  bottom: -100%;
  left: 0;
  width: 100%;
  max-height: 80vh;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.7);
  z-index: 310;
  padding: 12px 18px 24px;
  display: flex;
  flex-direction: column;
  transition: bottom 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.details-bottom-sheet.open {
  bottom: 0;
}

.sheet-drag-handle {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-color);
  margin: 0 auto 12px;
}

.sheet-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.details-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
}

.details-prof {
  font-size: 12.5px;
  color: #38bdf8;
  margin-top: 2px;
}

.details-meta-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.details-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.details-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}
.badge-mc { background: #dc2626; color: #ffffff; }
.badge-mb { background: #ea580c; color: #ffffff; }
.badge-retrans { background: #7c3aed; color: #ffffff; }
.badge-morning { background: #0284c7; color: #ffffff; }
.badge-afternoon { background: #d97706; color: #ffffff; }
.badge-info { background: #334155; color: #f8fafc; }

.details-notes-box {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-primary);
}

.details-notes-box p {
  margin-bottom: 6px;
}
.details-notes-box p:last-child {
  margin-bottom: 0;
}

.btn-toggle-mc {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}
.btn-toggle-mc.checked {
  background: #059669;
  border-color: #10b981;
  color: #ffffff;
}

/* SCANNER MODAL */
.scanner-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000000;
  z-index: 400;
  display: flex;
  flex-direction: column;
}

.scanner-header {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 410;
}

.scanner-video-box {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-reticle {
  position: absolute;
  width: 250px;
  height: 250px;
  border: 3px solid #38bdf8;
  border-radius: 16px;
  box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.55);
  animation: pulseScanner 2s infinite ease-in-out;
}
@keyframes pulseScanner {
  0%, 100% { border-color: #38bdf8; }
  50% { border-color: #0284c7; }
}

.scanner-footer {
  position: absolute;
  bottom: calc(20px + var(--safe-bottom));
  left: 0;
  right: 0;
  text-align: center;
  z-index: 410;
}

/* TOAST */
.toast-pill {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0284c7;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-pill.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* EMPTY STATE */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  text-align: center;
}
.empty-icon {
  font-size: 54px;
  margin-bottom: 12px;
}
.empty-state h3 {
  font-size: 18px;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.empty-state p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  max-width: 320px;
}

/* CHECKLIST VIEW STYLES */
.checklist-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.checklist-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}
.checklist-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #10b981);
  transition: width 0.25s ease;
}
.checklist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.checklist-card-title {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-color);
  font-size: 11.5px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checklist-card-title .badge {
  background: #0284c7;
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
}
.checklist-list {
  display: flex;
  flex-direction: column;
}
.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  gap: 8px;
}
.checklist-item:last-child {
  border-bottom: none;
}
.checklist-item.item-completed {
  opacity: 0.55;
  background: rgba(16, 185, 129, 0.04);
}
.checklist-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.item-room {
  font-size: 12.5px;
  color: var(--text-primary);
}
.item-time {
  font-size: 11px;
  color: #38bdf8;
  font-weight: 700;
}
.item-title {
  font-size: 10.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.checklist-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.check-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-secondary);
}
.check-btn.checked {
  background: #059669;
  border-color: #10b981;
  color: #ffffff;
}
.check-btn input {
  display: none;
}
.pill-mini-mc {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  background: #dc2626;
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: 2px;
}

