/* BIZ24 Attendance System CSS - Premium Visuals & Micro-animations */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --primary-glow: rgba(59, 130, 246, 0.4);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.4);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.4);
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --sidebar-bg: rgba(15, 23, 42, 0.95);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius: 16px;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Glassmorphism utilities */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-hover:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 12px 40px 0 rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Layouts */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Mobile Portal Header & Title */
.header {
  text-align: center;
  margin-bottom: 40px;
  animation: fadeInDown 0.6s ease;
}

.header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(to right, #3b82f6, #8b5cf6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.header p {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 20px;
  position: relative;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.form-input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Search input with icons */
.search-wrapper {
  position: relative;
}
.search-wrapper select {
  padding-left: 40px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: inherit;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(37, 99, 235, 0.6);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.4);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.6);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.4);
}
.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Attendance Card UI */
.mobile-card {
  max-width: 450px;
  margin: 0 auto;
  padding: 30px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
}

.mobile-card * {
  position: relative;
  z-index: 1;
}

/* Scanner Frame Simulation */
.scanner-container {
  width: 100%;
  height: 220px;
  border-radius: 12px;
  background: #020617;
  border: 2px dashed rgba(59, 130, 246, 0.4);
  margin-bottom: 25px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.scanner-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(to right, transparent, var(--primary), transparent);
  box-shadow: 0 0 8px var(--primary);
  animation: scanLine 3s infinite linear;
}

.scanner-frame-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid var(--primary);
}
.corner-tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.corner-tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.corner-bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.corner-br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.scanner-sim-icon {
  font-size: 3rem;
  color: rgba(59, 130, 246, 0.4);
  margin-bottom: 8px;
  animation: pulseGlow 2s infinite ease-in-out;
}

/* GPS Status badge */
.gps-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.gps-badge.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* Success Checkmark Screen */
.success-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-icon-wrapper {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  font-size: 3rem;
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  animation: popSuccess 0.5s forwards;
}

.success-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.success-details {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 25px;
}

/* Simulation widget */
.sim-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  max-width: 300px;
  z-index: 1000;
  display: none; /* Hidden by default - enabled only in debug mode */
}

.sim-header {
  padding: 10px 16px;
  background: rgba(59, 130, 246, 0.2);
  border-radius: 8px 8px 0 0;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sim-body {
  padding: 16px;
  display: none;
}

.sim-body.open {
  display: block;
}

/* Admin Dashboard layout */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}

.sidebar-logo {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(to right, #3b82f6, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 40px;
  text-align: center;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover, .nav-item.active {
  color: #fff;
  background: rgba(59, 130, 246, 0.15);
  border-left: 4px solid var(--primary);
}

.main-content {
  margin-left: 260px;
  flex: 1;
  padding: 40px;
}

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

.stat-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.stat-val {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
}

.stat-icon {
  font-size: 1.5rem;
  color: var(--primary);
}

.stat-card.blue { border-left: 4px solid var(--primary); }
.stat-card.green { border-left: 4px solid var(--success); }
.stat-card.amber { border-left: 4px solid var(--warning); }
.stat-card.red { border-left: 4px solid var(--danger); }

/* Tables styling */
.table-container {
  overflow-x: auto;
  margin-top: 20px;
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(15, 23, 42, 0.8);
  padding: 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.95rem;
  color: var(--text-primary);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-primary { background: rgba(59, 130, 246, 0.15); color: var(--primary); }

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  width: 100%;
  max-width: 500px;
  padding: 30px;
  position: relative;
  transform: translateY(-30px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.open .modal-content {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Tabs rendering */
.tab-content {
  display: none;
  animation: fadeIn 0.4s ease;
}
.tab-content.active {
  display: block;
}

/* Animations */
@keyframes scanLine {
  0% { top: 0; }
  50% { top: calc(100% - 4px); }
  100% { top: 0; }
}

@keyframes pulseGlow {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; filter: drop-shadow(0 0 8px var(--primary-glow)); }
  100% { opacity: 0.4; }
}

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

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

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

@keyframes popSuccess {
  0% { transform: scale(0); box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); box-shadow: 0 0 30px rgba(16, 185, 129, 0.4); }
}

/* Responsive UI adjustments */
@media(max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 15px;
  }
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }
  .nav-item {
    white-space: nowrap;
    padding: 8px 12px;
  }
  .main-content {
    margin-left: 0;
    padding: 20px;
  }
}

/* Mobile Portrait Optimization */
@media(max-width: 480px) {
  .container {
    padding: 10px;
  }
  .header {
    margin-bottom: 20px;
  }
  .header h1 {
    font-size: 1.8rem;
  }
  .mobile-card {
    padding: 20px 15px;
    border-radius: 12px;
  }
  .scanner-container {
    height: 150px;
    margin-bottom: 15px;
  }
  .form-input, select, textarea {
    padding: 10px 12px;
    font-size: 0.95rem;
    border-radius: 8px;
  }
  .btn {
    padding: 11px 20px;
    font-size: 0.95rem;
    border-radius: 8px;
  }
  .gps-badge {
    margin-bottom: 15px;
    font-size: 0.75rem;
    padding: 4px 10px;
  }
  .form-group {
    margin-bottom: 12px;
  }
}
