/* 
 * Stylesheet Premium: Aplikasi Absensi Guru (SMK Panjatek)
 * Design Concept: Glassmorphism, Dark/Modern Harmonious Palette, Smooth Micro-animations
 */

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

:root {
  --primary-color: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --success-color: #10b981; /* Emerald */
  --warning-color: #f59e0b; /* Amber */
  --danger-color: #ef4444;  /* Rose */
  --dark-color: #0f172a;    /* Slate 900 */
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-text: #f8fafc;
  --glass-muted: #94a3b8;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-image: url('https://images.unsplash.com/photo-1541339907198-e08756dedf3f?q=80&w=1920&auto=format&fit=crop');
}

/* Base resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

body {
  background-color: var(--dark-color);
  background-image: linear-gradient(rgba(15, 23, 42, 0.75), rgba(15, 23, 42, 0.85)), var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--glass-text);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Background adjustment utility */
.app-bg-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15), transparent 60%);
  z-index: -1;
  pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Glassmorphism card utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Typography styles */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--primary-hover);
}

/* Login Portal Layout */
.portal-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.school-header {
  text-align: center;
  margin-bottom: 30px;
  animation: fadeIn 0.6s ease-out;
}

.school-logo-mock {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--primary-color), var(--success-color));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 800;
  margin: 0 auto 15px auto;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.school-name {
  font-size: 1.8rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.school-subtitle {
  font-size: 0.95rem;
  color: var(--glass-muted);
  margin-top: 5px;
}

.login-selector-card {
  width: 100%;
  max-width: 480px;
}

.login-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 25px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.login-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--glass-muted);
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-tab-btn.active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--glass-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 12px 16px;
  color: #fff;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  background: rgba(15, 23, 42, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), #4f46e5);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color), #059669);
  color: #fff;
}

.btn-success:hover {
  box-shadow: 0 6px 15px rgba(16, 185, 129, 0.25);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  color: #fff;
}

.btn-danger:hover {
  box-shadow: 0 6px 15px rgba(239, 68, 68, 0.25);
  transform: translateY(-1px);
}

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

/* Sidebar Navigation */
.app-sidebar {
  width: 280px;
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 30px;
}

.sidebar-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary-color), var(--success-color));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.sidebar-title-box {
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--glass-muted);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  margin-bottom: 25px;
}

.sidebar-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  object-fit: cover;
  background: #1e293b;
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--success-color);
  font-weight: 500;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.sidebar-menu-item-btn {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--glass-muted);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
}

.sidebar-menu-item-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.sidebar-menu-item-btn.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-color);
  font-weight: 600;
  border-left: 3px solid var(--primary-color);
  border-radius: 0 10px 10px 0;
}

.sidebar-menu-item-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.2s;
}

.sidebar-menu-item-btn:hover svg {
  transform: translateX(2px);
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Main Content Area */
.app-main {
  flex-grow: 1;
  margin-left: 280px;
  padding: 40px;
  min-height: 100vh;
}

/* Pages Section */
.app-page {
  display: none;
}

.app-page.active {
  display: block;
}

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

.page-title {
  font-size: 2rem;
  color: #fff;
}

.page-description {
  font-size: 0.95rem;
  color: var(--glass-muted);
  margin-top: 4px;
}

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

.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--glass-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.stat-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  margin-top: 5px;
  line-height: 1;
}

.stat-icon-wrapper {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper.primary { background: rgba(99, 102, 241, 0.15); color: var(--primary-color); }
.stat-icon-wrapper.success { background: rgba(16, 185, 129, 0.15); color: var(--success-color); }
.stat-icon-wrapper.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning-color); }
.stat-icon-wrapper.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger-color); }

/* Announcement Box */
.dashboard-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.announcement-box-container {
  display: flex;
  flex-direction: column;
}

.announcement-header-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.announcement-content-area {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.announcement-body {
  font-size: 1.05rem;
  line-height: 1.6;
  color: #fff;
  border-left: 4px solid var(--primary-color);
  padding-left: 16px;
  margin-bottom: 15px;
}

.announcement-meta {
  font-size: 0.85rem;
  color: var(--glass-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Beautiful Admin panel for writing Announcement */
.admin-broadcast-editor {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Table Design */
.data-table-container {
  overflow-x: auto;
  margin-top: 20px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.data-table th {
  background: rgba(15, 23, 42, 0.6);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--glass-muted);
  border-bottom: 1px solid var(--glass-border);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  color: #f8fafc;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Photo Thumbnail inside table */
.table-avatar-img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.table-teacher-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-teacher-meta {
  display: flex;
  flex-direction: column;
}

.table-teacher-name {
  font-weight: 600;
}

.table-teacher-nuptk {
  font-size: 0.75rem;
  color: var(--glass-muted);
}

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.hadir { background: rgba(16, 185, 129, 0.15); color: var(--success-color); }
.status-badge.terlambat { background: rgba(245, 158, 11, 0.15); color: var(--warning-color); }
.status-badge.absen { background: rgba(239, 68, 68, 0.15); color: var(--danger-color); }
.status-badge.pulang { background: rgba(99, 102, 241, 0.15); color: var(--primary-color); }

/* Table Action Buttons */
.table-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-icon.delete:hover {
  background: var(--danger-color);
  border-color: var(--danger-color);
}

/* Form Modals / Slide overs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-title {
  font-size: 1.3rem;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--glass-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Custom Grid for Modal forms */
.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

@media (max-width: 576px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Card Teacher printing template style */
.cards-print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.teacher-login-card {
  width: 100%;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95));
  border: 2px solid var(--primary-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.teacher-login-card::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.card-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 15px;
}

.card-logo {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary-color), var(--success-color));
  border-radius: 6px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
}

.card-body {
  display: flex;
  gap: 15px;
  align-items: center;
}

.card-avatar {
  width: 75px;
  height: 75px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #0f172a;
}

.card-details {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-teacher-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.card-teacher-info {
  font-size: 0.75rem;
  color: var(--glass-muted);
}

.card-footer {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-qr-box {
  width: 50px;
  height: 50px;
  background: #fff;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-qr-box img {
  width: 100%;
  height: 100%;
}

.card-instructions {
  font-size: 0.7rem;
  color: var(--success-color);
  font-weight: 500;
}

/* Print Specific Rules */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .app-sidebar, .page-header, .btn, .sidebar-footer, .app-bg-overlay {
    display: none !important;
  }
  .app-main {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .app-page {
    display: none !important;
  }
  #page-daftar-guru {
    display: block !important;
  }
  .cards-print-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
  }
  .teacher-login-card {
    border: 2px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
  .card-teacher-name, .card-title {
    color: #000 !important;
  }
  .card-teacher-info {
    color: #333 !important;
  }
  .card-qr-box {
    border: 1px solid #000 !important;
  }
}

/* Jam Masuk/Pulang schedule configuration items */
.schedule-item-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  margin-bottom: 12px;
}

/* Teacher - Profile tab specific */
.profile-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-avatar-container {
  position: relative;
  width: 150px;
  height: 150px;
  margin-bottom: 20px;
}

.profile-avatar-large {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
  background: #1e293b;
}

.profile-avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  border: 2px solid var(--dark-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.profile-avatar-upload-btn:hover {
  background: var(--primary-hover);
}

/* Attendance Layout - Camera + Map */
.attendance-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 992px) {
  .attendance-layout {
    grid-template-columns: 1fr;
  }
}

.attendance-camera-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.camera-feed-box {
  width: 100%;
  aspect-ratio: 4/3;
  background: #0b0f19;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror effect */
}

.camera-preview-captured {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  z-index: 5;
}

.camera-controls-overlay {
  position: absolute;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 10;
}

.camera-select-dropdown {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  z-index: 10;
  outline: none;
}

.camera-fallback-msg {
  text-align: center;
  padding: 20px;
  color: var(--glass-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.camera-fallback-msg svg {
  width: 48px;
  height: 48px;
  color: var(--warning-color);
}

/* Map Styling using Leaflet.js */
.attendance-map-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.map-viewport {
  width: 100%;
  height: 320px;
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  position: relative;
  z-index: 1; /* Keep leaflet maps correctly layered */
}

.map-coordinate-badge {
  background: rgba(15, 23, 42, 0.7);
  padding: 10px 15px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--glass-border);
}

.geofence-status {
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.geofence-status.inside { color: var(--success-color); }
.geofence-status.outside { color: var(--danger-color); }

/* Mock Location Helper Panel (For Testing) */
.mock-testing-panel {
  margin-top: 10px;
  padding: 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px dashed rgba(245, 158, 11, 0.3);
  border-radius: 8px;
}

.mock-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--warning-color);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.mock-buttons {
  display: flex;
  gap: 8px;
}

.mock-btn {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--warning-color);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.mock-btn:hover {
  background: var(--warning-color);
  color: #fff;
}

/* Topology Diagram Styling */
.topology-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.topology-svg-container {
  width: 100%;
  max-width: 800px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  padding: 20px;
  margin-top: 15px;
}

/* Theme configuration background picker */
.background-settings-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bg-presets-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.bg-preset-thumb {
  aspect-ratio: 16/9;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.bg-preset-thumb:hover {
  transform: scale(1.05);
}

.bg-preset-thumb.active {
  border-color: var(--primary-color);
  box-shadow: 0 0 8px var(--primary-color);
}

/* Info Box / Alert Banner style */
.info-alert {
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.9rem;
  line-height: 1.4;
}

.info-alert.info {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #fff;
}

.info-alert.info svg { color: var(--primary-color); }

/* Responsive adjustments */
@media (max-width: 992px) {
  .app-sidebar {
    width: 70px;
    padding: 20px 10px;
    align-items: center;
  }
  .sidebar-header, .sidebar-user, .sidebar-title-box, .sidebar-user-info, .sidebar-menu-item-btn span {
    display: none;
  }
  .sidebar-logo {
    margin-bottom: 30px;
  }
  .app-main {
    margin-left: 70px;
    padding: 20px;
  }
  .sidebar-menu-item-btn {
    justify-content: center;
    padding: 12px;
  }
}

/* ==================== KBM MULTI-PHOTO SLOTS STYLING ==================== */
.kbm-slots-container {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

.kbm-slot-card {
  flex: 1;
  height: 95px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 10px;
  user-select: none;
}

.kbm-slot-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.kbm-slot-card.active {
  border: 2px solid var(--primary-color);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.kbm-slot-badge {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--glass-muted);
  background: rgba(15, 23, 42, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.kbm-slot-card.active .kbm-slot-badge {
  color: #fff;
  background: var(--primary-color);
}

.kbm-slot-card.has-photo .kbm-slot-badge {
  color: #fff;
  background: var(--success-color);
}

.kbm-slot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  transition: opacity 0.2s;
}

.kbm-slot-icon {
  font-size: 1.25rem;
  color: var(--glass-muted);
}

.kbm-slot-card.active .kbm-slot-icon {
  color: var(--primary-color);
}

.kbm-slot-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--glass-muted);
}

.kbm-slot-preview-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  border-radius: 10px;
}

.kbm-slot-delete-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.kbm-slot-delete-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.kbm-slot-card.has-photo:hover .kbm-slot-delete-btn {
  display: flex;
}

.kbm-slot-card.has-photo .kbm-slot-content {
  opacity: 0;
  pointer-events: none;
}

.kbm-photos-cell {
  display: flex;
  gap: 6px;
  align-items: center;
}

.kbm-photos-cell img {
  width: 42px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all 0.2s;
}

.kbm-photos-cell img:hover {
  transform: scale(1.1);
  border-color: var(--primary-color);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

