/* styles.css - Security Patrol Web & Mobile App Design System */

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

:root {
  /* Colors - Security Premium Palette */
  --primary-dark: #0f172a;      /* slate-900 */
  --primary-slate: #1e293b;     /* slate-800 */
  --primary-light: #334155;     /* slate-700 */
  --accent-gold: #eab308;       /* safety yellow/gold */
  --accent-gold-hover: #ca8a04;
  --success-green: #10b981;     /* emerald-500 */
  --success-bg: #ecfdf5;
  --danger-red: #ef4444;        /* red-500 */
  --danger-bg: #fef2f2;
  --warning-amber: #f97316;     /* orange-500 */
  --warning-bg: #fff7ed;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --bg-main: #f1f5f9;           /* slate-100 */
  --bg-card: #ffffff;
  --border-color: #e2e8f0;      /* slate-200 */
  
  /* Layout & Animations */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-premium: 0 20px 25px -5px rgb(15 23 42 / 0.15), 0 8px 10px -6px rgb(15 23 42 / 0.15);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Sarabun', 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Common Components & Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--primary-dark);
}

.text-muted {
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--primary-dark);
  color: var(--text-light);
}
.btn-primary:hover {
  background-color: var(--primary-light);
}

.btn-accent {
  background-color: var(--accent-gold);
  color: var(--primary-dark);
}
.btn-accent:hover {
  background-color: var(--accent-gold-hover);
}

.btn-danger {
  background-color: var(--danger-red);
  color: white;
}
.btn-danger:hover {
  background-color: #dc2626;
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--primary-light);
}
.btn-outline:hover {
  background-color: var(--bg-main);
  border-color: var(--primary-light);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  gap: 4px;
}
.badge-success {
  background-color: var(--success-bg);
  color: var(--success-green);
}
.badge-danger {
  background-color: var(--danger-bg);
  color: var(--danger-red);
}
.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning-amber);
}

/* Header & Mode Switcher */
.main-header {
  background-color: var(--primary-dark);
  color: white;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  background-color: var(--accent-gold);
  color: var(--primary-dark);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
}

.brand-title h1 {
  color: white;
  font-size: 18px;
  line-height: 1.2;
}
.brand-title span {
  font-size: 11px;
  color: var(--text-muted);
}

.mode-switcher-container {
  display: flex;
  background-color: var(--primary-slate);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-light);
}

.mode-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 14px;
  font-family: var(--font-family);
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mode-btn.active {
  background-color: var(--accent-gold);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.container-body {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

/* -----------------------------------------------------
   PHONE SIMULATOR (GUARD PORTAL VIEW)
   ----------------------------------------------------- */
.mobile-view-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  min-height: calc(100vh - 120px);
}

/* The device frame */
.phone-frame {
  width: 410px;
  height: 840px;
  background-color: #000000;
  border-radius: 48px;
  box-shadow: var(--shadow-premium);
  position: relative;
  padding: 12px;
  border: 4px solid #1e293b;
  display: flex;
  flex-direction: column;
}

/* Simulated Notch */
.phone-notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 25px;
  background-color: #000000;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-notch-camera {
  width: 10px;
  height: 10px;
  background-color: #1e293b;
  border-radius: 50%;
  margin-right: 15px;
}

.phone-notch-speaker {
  width: 40px;
  height: 4px;
  background-color: #2e3e50;
  border-radius: 2px;
}

/* Phone Status Bar */
.phone-status-bar {
  height: 35px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  font-size: 12px;
  font-weight: 500;
  z-index: 5;
  background-color: var(--primary-dark);
  border-top-left-radius: 36px;
  border-top-right-radius: 36px;
}

/* Phone Content Screen */
.phone-screen {
  flex: 1;
  background-color: var(--bg-main);
  border-radius: 36px;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: 25px;
}

/* Phone Home Indicator */
.phone-home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 5px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  z-index: 10;
  pointer-events: none;
}

/* Guard App Screens Container */
.guard-app-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Mobile Portal Header */
.guard-header {
  background-color: var(--primary-dark);
  color: white;
  padding: 20px 15px 15px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: var(--shadow-sm);
}

.guard-header h2 {
  color: white;
  font-size: 16px;
}

.guard-header .logout-btn {
  background: none;
  border: none;
  color: var(--accent-gold);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}

/* Login Screen inside App */
.guard-login-screen {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-slate) 100%);
  color: white;
  border-radius: 36px;
  text-align: center;
}

.login-shield {
  font-size: 64px;
  color: var(--accent-gold);
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px rgba(234, 179, 8, 0.3));
}

.guard-login-screen h3 {
  color: white;
  margin-bottom: 8px;
  font-size: 20px;
}

.guard-login-screen p {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 30px;
}

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

.form-group-mobile label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 500;
}

.mobile-select, .mobile-input {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-light);
  background-color: rgba(255,255,255,0.05);
  color: white;
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  transition: var(--transition-smooth);
}

.mobile-select:focus, .mobile-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.2);
}

.mobile-select option {
  background-color: var(--primary-slate);
  color: white;
}

.officer-preview-card {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  text-align: left;
}

.officer-preview-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent-gold);
  background-color: var(--primary-light);
}

/* Guard Main View */
.guard-main-view {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.welcome-widget {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 15px;
  border-left: 4px solid var(--primary-dark);
}

.welcome-info {
  flex: 1;
}
.welcome-info h4 {
  font-size: 14px;
  color: var(--primary-dark);
}
.welcome-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* QR Code & Manual Section */
.guard-scan-box {
  background-color: var(--primary-dark);
  color: white;
  padding: 20px 15px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.guard-scan-box h3 {
  color: white;
  font-size: 14px;
  margin-bottom: 5px;
}

.scan-buttons {
  display: flex;
  width: 100%;
  gap: 10px;
}

.btn-scan {
  flex: 1;
  background-color: var(--accent-gold);
  color: var(--primary-dark);
  font-weight: 600;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-family);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition-smooth);
}
.btn-scan:hover {
  background-color: var(--accent-gold-hover);
}

/* Search bar on mobile */
.mobile-search-bar {
  display: flex;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  align-items: center;
  gap: 8px;
}

.mobile-search-input {
  border: none;
  outline: none;
  font-family: var(--font-family);
  font-size: 13px;
  flex: 1;
}

/* Checkpoint List (Guard View) */
.checkpoint-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
  margin-top: 5px;
}

.mobile-checkpoint-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.mobile-checkpoint-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-gold);
}

.mobile-checkpoint-card.inspected {
  border-left: 4px solid var(--success-green);
}

.mobile-checkpoint-card.pending {
  border-left: 4px solid var(--warning-amber);
}

.checkpoint-img-thumbnail {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: #cbd5e1;
}

.checkpoint-details-mobile {
  flex: 1;
  min-width: 0;
}

.checkpoint-details-mobile h4 {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkpoint-details-mobile p {
  font-size: 11px;
  color: var(--text-muted);
}

/* Inspection Form View */
.guard-form-view {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.form-view-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-back-mobile {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary-light);
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
}

.checkpoint-ref-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkpoint-ref-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background-color: #e2e8f0;
}

.checkpoint-ref-info h3 {
  font-size: 14px;
}
.checkpoint-ref-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* GPS Verification Widget */
.gps-verification-widget {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gps-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
}

.gps-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.gps-indicator-dot.success { background-color: var(--success-green); }
.gps-indicator-dot.danger { background-color: var(--danger-red); }

.gps-mock-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.gps-mock-btn {
  flex: 1;
  padding: 6px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  cursor: pointer;
  font-family: var(--font-family);
  transition: var(--transition-smooth);
}
.gps-mock-btn:hover {
  background-color: #cbd5e1;
}
.gps-mock-btn.active {
  background-color: var(--primary-dark);
  color: white;
  border-color: var(--primary-dark);
}

/* Form Sections */
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 4px;
  margin-top: 5px;
}

.inspection-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 15px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inspection-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inspection-title-row label {
  font-size: 13px;
  font-weight: 600;
}

/* Status toggler switch */
.status-toggle-group {
  display: flex;
  background-color: var(--bg-main);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.status-toggle-btn {
  border: none;
  background: none;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.status-toggle-btn.normal.active {
  background-color: var(--success-green);
  color: white;
}

.status-toggle-btn.abnormal.active {
  background-color: var(--danger-red);
  color: white;
}

.status-toggle-btn:not(.active) {
  color: var(--text-muted);
}

/* Abnormal Details Section */
.abnormal-input-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: slideDown 0.2s ease-out forwards;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.textarea-mobile {
  width: 100%;
  height: 60px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  resize: none;
}

/* Camera button & container */
.camera-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-camera {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-main);
  border: 1px dashed var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-camera:hover {
  background-color: #cbd5e1;
}

/* Photo grid inside inspection card */
.mobile-photo-grid {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.photo-preview-wrapper {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.photo-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-delete-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  background-color: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-submit-btn-container {
  margin-top: 15px;
}

.btn-submit-mobile {
  width: 100%;
  padding: 14px;
  background-color: var(--primary-dark);
  color: white;
  border: none;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
  transition: var(--transition-smooth);
}

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

.btn-submit-mobile:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* Mock Camera Modal for testing on non-mobile */
.mock-camera-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.mock-camera-content {
  background-color: white;
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.mock-camera-viewfinder {
  height: 280px;
  background-color: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.mock-camera-overlay {
  position: absolute;
  border: 2px dashed rgba(255,255,255,0.4);
  width: 80%;
  height: 80%;
  border-radius: 8px;
  pointer-events: none;
}

.mock-camera-options {
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: var(--bg-main);
}

.mock-camera-presets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.camera-preset-btn {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: white;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-family);
  transition: var(--transition-smooth);
}
.camera-preset-btn:hover {
  background-color: var(--accent-gold);
  color: var(--primary-dark);
}

/* -----------------------------------------------------
   SUPERVISOR DASHBOARD VIEW (DESKTOP)
   ----------------------------------------------------- */
.dashboard-container {
  display: flex;
  gap: 24px;
  min-height: calc(100vh - 120px);
  margin-top: 10px;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: white;
  border-radius: var(--radius-md);
  padding: 20px 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: flex-start;
  border: 1px solid var(--border-color);
}

.sidebar-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.sidebar-menu-item:hover {
  background-color: var(--bg-main);
  color: var(--primary-dark);
}

.sidebar-menu-item.active {
  background-color: var(--primary-dark);
  color: white;
}

/* Content Area */
.dashboard-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content-title-area {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* KPI Cards Layout */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 5px solid var(--primary-slate);
  transition: var(--transition-smooth);
}

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

.kpi-card.urgent { border-left-color: var(--danger-red); }
.kpi-card.success { border-left-color: var(--success-green); }
.kpi-card.warning { border-left-color: var(--warning-amber); }

.kpi-card-info h4 {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card-info .kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-top: 4px;
}

.kpi-card-icon {
  width: 48px;
  height: 48px;
  background-color: var(--bg-main);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--primary-light);
}

/* Analytics section (Charts) */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.chart-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.chart-card h3 {
  font-size: 15px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-container-inner {
  height: 250px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 10px 0 10px;
}

/* Custom SVG / HTML charts styling */
.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar-wrapper {
  width: 32px;
  background-color: #cbd5e1;
  border-radius: 4px 4px 0 0;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chart-bar-inner-normal {
  background-color: var(--success-green);
  border-radius: 4px 4px 0 0;
}

.chart-bar-inner-abnormal {
  background-color: var(--danger-red);
}

.chart-bar-wrapper:hover {
  filter: brightness(0.9);
}

.chart-bar-tooltip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary-dark);
  color: white;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  transition: var(--transition-smooth);
  pointer-events: none;
}

.chart-bar-wrapper:hover .chart-bar-tooltip {
  opacity: 1;
}

.chart-axis-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Donut chart SVG styling */
.donut-chart-svg {
  transform: rotate(-90deg);
}

.donut-segment {
  transition: stroke-dasharray 0.3s ease;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 15px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.legend-label-color {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* Interactive Table Area */
.data-table-card {
  background-color: white;
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.table-filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.table-search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
}

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

.filter-select {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  background-color: white;
  min-width: 150px;
}

/* Beautiful Responsive Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.patrol-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.patrol-table th {
  background-color: var(--bg-main);
  padding: 12px 16px;
  font-weight: 600;
  color: var(--primary-light);
  border-bottom: 2px solid var(--border-color);
}

.patrol-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.patrol-table tbody tr {
  transition: var(--transition-smooth);
}
.patrol-table tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.5);
}

/* Thumbnail preview for table */
.avatar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #cbd5e1;
}

.checkpoint-tbl-img {
  width: 45px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
  background-color: #cbd5e1;
}

.btn-actions-group {
  display: flex;
  gap: 6px;
}

.btn-icon-only {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background-color: transparent;
  cursor: pointer;
  color: var(--primary-light);
  transition: var(--transition-smooth);
}
.btn-icon-only:hover {
  background-color: var(--bg-main);
  border-color: var(--primary-light);
}
.btn-icon-only.delete:hover {
  background-color: var(--danger-bg);
  border-color: var(--danger-red);
  color: var(--danger-red);
}

/* Modal Popup Window */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleUp {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 10;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-muted);
  line-height: 1;
  transition: var(--transition-smooth);
}
.modal-close-btn:hover {
  color: var(--primary-dark);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-main);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

/* Form Styles for CRUD */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid-full {
  grid-column: span 2;
}

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

.form-group-crud label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-light);
}

.input-crud {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  background-color: white;
}
.input-crud:focus {
  border-color: var(--primary-slate);
}

.image-upload-preview-container {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.crud-preview-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
}

/* Detail Inspection Modal Content */
.detail-modal-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-header-card {
  background-color: var(--bg-main);
  padding: 15px;
  border-radius: var(--radius-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--primary-dark);
}

.detail-header-card.abnormal {
  border-left-color: var(--danger-red);
}

.detail-header-card.normal {
  border-left-color: var(--success-green);
}

.inspection-detail-items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.detail-item-row {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-item-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.detail-item-title {
  font-weight: 600;
  font-size: 13px;
}

.detail-item-note {
  font-size: 12px;
  background-color: var(--bg-main);
  padding: 8px 12px;
  border-radius: 4px;
  color: var(--text-dark);
  border-left: 3px solid var(--accent-gold);
}

.detail-photo-gallery {
  display: flex;
  gap: 10px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.detail-gallery-img {
  width: 90px;
  height: 90px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}
.detail-gallery-img:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

/* Lightbox popup for image click */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background-color: var(--primary-dark);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease-out forwards;
}

.toast.success {
  border-left: 4px solid var(--success-green);
}
.toast.danger {
  border-left: 4px solid var(--danger-red);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* -----------------------------------------------------
   RESPONSIVE DESIGN (MEDIA QUERIES)
   ----------------------------------------------------- */

/* Mobile view toggling & frame removal on actual mobiles */
@media (max-width: 768px) {
  .main-header {
    padding: 10px 15px;
  }
  
  .brand-title h1 {
    font-size: 15px;
  }
  
  .container-body {
    padding: 10px;
  }
  
  /* In mobile screen, strip the phone mockup for Guard view and display it native full screen */
  .mobile-view-wrapper {
    padding: 0;
  }
  
  .phone-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border: none;
    padding: 0;
  }
  
  .phone-notch, .phone-status-bar, .phone-home-indicator {
    display: none; /* Hide hardware mocks on real mobile */
  }
  
  .phone-screen {
    border-radius: 0;
    height: 100%;
  }
  
  /* Responsive Dashboard for Supervisor */
  .dashboard-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    align-self: stretch;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  
  .sidebar-menu-item {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .kpi-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid-full {
    grid-column: span 1;
  }
}

@media (max-width: 480px) {
  .kpi-cards-grid {
    grid-template-columns: 1fr;
  }
}
