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

:root {
  --primary-forest: #01472E;
  --sage: #CCD5AE;
  --olive: #E9EDC9;
  --cream: #FEFAE0;
  --moss: #A3B18A;
  --accent-blue: #2196F3;
  --success: #4CAF50;
  --warning: #FFB703;
  --danger: #E63946;
  --shadow-color: rgba(1, 71, 46, 0.18);
  --easing: cubic-bezier(.16, 1, .3, 1);
  
  --bg-color: var(--cream);
  --text-color: var(--primary-forest);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  
  --header-height: 80px;
}

[data-theme="dark"] {
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --primary-forest: #022b1c; /* Darker variant */
  --cream: #1e1e1e;
  --glass-bg: rgba(30, 30, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  transition: background-color 0.3s var(--easing), color 0.3s var(--easing);
}

h1, h2, h3, h4, .hero-bg-text, .stat-value, .rfid-icon-large {
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Noise Overlay */
.noise-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Loading Screen */
#loadingScreen {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--primary-forest);
  color: var(--cream);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s var(--easing);
}
.loader-content {
  text-align: center;
}
.rfid-icon-large {
  font-size: 5rem;
  margin-bottom: 1rem;
}
.wave {
  width: 100px; height: 4px;
  background: var(--sage);
  margin: 0 auto 2rem;
  position: relative;
  overflow: hidden;
  border-radius: 2px;
}
.wave::after {
  content: '';
  position: absolute;
  top: 0; left: -50px;
  width: 50px; height: 100%;
  background: var(--accent-blue);
  animation: waveAnim 1s infinite linear;
}
@keyframes waveAnim {
  to { left: 100%; }
}

/* Reveal Animation */
.reveal {
  opacity: 0;
  transform: translateY(80px);
  animation: revealAnim 1.1s var(--easing) forwards;
}
@keyframes revealAnim {
  to { opacity: 1; transform: translateY(0); }
}
/* Stagger */
.reveal:nth-child(1) { animation-delay: 0.1s; }
.reveal:nth-child(2) { animation-delay: 0.2s; }
.reveal:nth-child(3) { animation-delay: 0.3s; }
.reveal:nth-child(4) { animation-delay: 0.4s; }
.reveal:nth-child(5) { animation-delay: 0.5s; }

/* Buttons */
.primary-btn {
  background: var(--primary-forest);
  color: var(--cream);
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.3s var(--easing);
  box-shadow: 0 4px 12px var(--shadow-color);
}
[data-theme="dark"] .primary-btn {
  background: var(--accent-blue);
  color: white;
}
.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-color);
}
.primary-btn.outline {
  background: transparent;
  border: 2px solid var(--primary-forest);
  color: var(--primary-forest);
}
[data-theme="dark"] .primary-btn.outline {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}
.primary-btn.outline:hover {
  background: var(--primary-forest);
  color: var(--cream);
}
[data-theme="dark"] .primary-btn.outline:hover {
  background: var(--accent-blue);
  color: white;
}
.full-width { width: 100%; }

/* Glass Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 2rem;
  padding: 2rem;
  box-shadow: 0 8px 32px var(--shadow-color);
}

/* Header */
.glass-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 3rem;
  background: rgba(254, 250, 224, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.3s;
}
[data-theme="dark"] .glass-header {
  background: rgba(18, 18, 18, 0.7);
}
.logo {
  display: flex;
  flex-direction: column;
}
.logo-title {
  font-family: 'Anton', sans-serif;
  font-size: 1.5rem;
  line-height: 1;
}
.logo-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--moss);
}
.pill-nav {
  display: flex;
  background: var(--glass-bg);
  border-radius: 999px;
  padding: 0.5rem;
  border: 1px solid var(--glass-border);
}
.nav-link {
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s var(--easing);
  color: var(--text-color);
}
.nav-link.active, .nav-link:hover {
  background: var(--primary-forest);
  color: var(--cream);
}
[data-theme="dark"] .nav-link.active, [data-theme="dark"] .nav-link:hover {
  background: var(--accent-blue);
  color: white;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Layout */
main {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
}
.section-container {
  display: none;
  flex: 1;
}
.section-container.active {
  display: flex;
  flex-direction: column;
}
.inner-section {
  display: none;
  padding: 2rem;
}
.inner-section.active {
  display: block;
}

/* Hero Section */
#hero {
  position: relative;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 4rem 2rem;
}
.hero-bg-text {
  font-size: 20vw;
  color: var(--sage);
  opacity: 0.3;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 0;
  white-space: nowrap;
}
[data-theme="dark"] .hero-bg-text { color: var(--primary-forest); }
.hero-floating-elements {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}
.float-card {
  position: absolute;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--primary-forest);
  box-shadow: 0 8px 32px var(--shadow-color);
  animation: floatAnim 6s infinite ease-in-out alternate;
}
[data-theme="dark"] .float-card { color: var(--cream); }
.card-1 { top: 20%; left: 15%; animation-delay: 0s; }
.card-2 { top: 60%; left: 10%; animation-delay: 1s; }
.card-3 { top: 30%; right: 15%; animation-delay: 2s; }
.card-4 { top: 70%; right: 20%; animation-delay: 0.5s; }
.card-5 { top: 85%; left: 40%; animation-delay: 1.5s; }

@keyframes floatAnim {
  from { transform: translateY(0px) rotate(0deg); }
  to { transform: translateY(-30px) rotate(3deg); }
}

.hero-bottom-info {
  position: absolute;
  bottom: 2rem;
  width: 90%;
  display: flex;
  justify-content: space-between;
  z-index: 2;
  font-weight: 600;
  color: var(--text-color);
}
.info-left p, .info-right p {
  margin-bottom: 0.5rem;
}
.info-right { text-align: right; }

/* Login */
#login {
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 2;
}
.login-card h2 { font-size: 2.5rem; text-align: center; }
.login-card input {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.5);
  font-family: 'Inter', sans-serif;
  color: var(--primary-forest);
}
[data-theme="dark"] .login-card input {
  background: rgba(0,0,0,0.5);
  color: var(--cream);
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary-forest);
}
.error-msg { color: var(--danger); text-align: center; font-weight: 600; }
.powered-subtext { text-align: center; font-size: 0.8rem; color: var(--moss); }

/* App Container */
.app-rounded-container {
  background: var(--primary-forest);
  border-radius: 5rem 5rem 0 0;
  min-height: calc(100vh - var(--header-height));
  width: 100%;
  padding: 3rem;
  color: var(--cream);
  transition: background 0.3s var(--easing);
}
[data-theme="dark"] .app-rounded-container {
  background: #022b1c;
}
.section-title {
  font-size: 3rem;
  margin-bottom: 2rem;
  color: var(--cream);
}

/* Dashboard Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}
.stat-card {
  text-align: center;
  color: var(--primary-forest);
}
[data-theme="dark"] .stat-card { color: var(--cream); }
.stat-card h3 {
  font-size: 1.2rem;
  color: var(--moss);
  margin-bottom: 1rem;
}
.stat-value {
  font-size: 3.5rem;
}

/* Dashboard Main */
.dashboard-main-card {
  min-height: 500px;
}
.dashboard-main-card .section-title {
  color: var(--primary-forest);
}
[data-theme="dark"] .dashboard-main-card .section-title { color: var(--cream); }

.toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.search-input, .date-filter, .action-btn {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  font-family: 'Inter', sans-serif;
  background: rgba(255,255,255,0.8);
  color: var(--primary-forest);
}
[data-theme="dark"] .search-input, [data-theme="dark"] .date-filter {
  background: rgba(0,0,0,0.5); color: var(--cream);
}
.search-input { flex: 1; min-width: 200px; }
.action-btn {
  cursor: pointer;
  font-weight: 600;
  background: var(--glass-bg);
  transition: all 0.2s;
}
[data-theme="dark"] .action-btn { color: var(--cream); }
.action-btn:hover { background: var(--sage); color: var(--primary-forest); }
.action-btn.danger { color: var(--danger); }
.action-btn.danger:hover { background: var(--danger); color: white; }

/* Table */
.table-container {
  overflow-x: auto;
}
.glass-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.5rem;
  color: var(--primary-forest);
}
[data-theme="dark"] .glass-table { color: var(--cream); }
.glass-table th {
  text-align: left;
  padding: 1rem 1.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--moss);
  background: rgba(163, 177, 138, 0.15); /* Soft background to form the box */
}
[data-theme="dark"] .glass-table th {
  background: rgba(163, 177, 138, 0.1);
}
.glass-table th:first-child {
  border-radius: 2rem 0 0 2rem;
}
.glass-table th:last-child {
  border-radius: 0 2rem 2rem 0;
}
.glass-table td {
  padding: 1rem;
  background: rgba(255,255,255,0.4);
  transition: all 0.3s;
}
[data-theme="dark"] .glass-table td { background: rgba(0,0,0,0.3); }
.glass-table tr td:first-child { border-radius: 1rem 0 0 1rem; }
.glass-table tr td:last-child { border-radius: 0 1rem 1rem 0; }
.glass-table tbody tr { cursor: pointer; }
.glass-table tbody tr:hover td {
  background: rgba(255,255,255,0.8);
  box-shadow: 0 4px 12px var(--shadow-color);
  transform: scale(1.01);
}
[data-theme="dark"] .glass-table tbody tr:hover td { background: rgba(255,255,255,0.1); }
.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}
.status-badge.present { background: var(--success); color: white; }
.status-badge.absent { background: var(--danger); color: white; }

/* Admin Grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}
.admin-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
  color: var(--primary-forest);
}
[data-theme="dark"] .admin-card { color: var(--cream); }

/* About Card */
.about-card { color: var(--primary-forest); }
[data-theme="dark"] .about-card { color: var(--cream); }
.about-card .section-title { color: var(--primary-forest); }
[data-theme="dark"] .about-card .section-title { color: var(--cream); }
.about-content {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
}
.about-main, .about-tech { flex: 1; min-width: 250px; }
.about-main h3 { font-size: 2rem; margin-bottom: 0.5rem; }
.social-links { display: flex; gap: 1rem; margin-top: 1.5rem; }
.social-icon {
  color: var(--primary-forest); transition: all 0.3s var(--easing);
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; background: rgba(255,255,255,0.5);
  border-radius: 50%; border: 1px solid var(--glass-border);
}
.social-icon:hover {
  transform: translateY(-3px); background: var(--primary-forest); color: var(--cream); box-shadow: 0 4px 12px var(--shadow-color);
}
[data-theme="dark"] .social-icon { background: rgba(0,0,0,0.3); color: var(--cream); }
[data-theme="dark"] .social-icon:hover { background: var(--accent-blue); }
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.tech-tags span {
  padding: 0.5rem 1rem;
  background: var(--primary-forest);
  color: var(--cream);
  border-radius: 999px;
  font-size: 0.9rem;
}
[data-theme="dark"] .tech-tags span { background: var(--accent-blue); }

/* Footer */
.main-footer {
  background: var(--primary-forest);
  color: var(--cream);
  padding: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 2rem;
}
[data-theme="dark"] .main-footer { background: #011c12; }
.footer-center { display: flex; gap: 1.5rem; }
.footer-center a { cursor: pointer; transition: color 0.3s; }
.footer-center a:hover { color: var(--sage); }

/* Floating Elements */
.status-bubble {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 100;
  font-weight: 600;
  color: var(--primary-forest);
}
[data-theme="dark"] .status-bubble { color: var(--cream); }
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}
.floating-popup {
  position: fixed;
  bottom: 5rem;
  right: 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 32px var(--shadow-color);
  z-index: 101;
  transform: translateX(120%);
  transition: transform 0.5s var(--easing);
  color: var(--primary-forest);
}
[data-theme="dark"] .floating-popup { color: var(--cream); }
.floating-popup.show { transform: translateX(0); }
.popup-icon { font-size: 2rem; }
.popup-info { display: flex; flex-direction: column; }
.popup-title { font-weight: 700; color: var(--success); }
.popup-name { font-weight: 600; font-size: 1.1rem; }
.popup-time { font-size: 0.8rem; color: var(--moss); }

/* Drawer */
.side-drawer {
  position: fixed;
  top: 0; right: 0;
  width: 400px;
  height: 100vh;
  background: var(--glass-bg);
  border-radius: 2rem 0 0 2rem;
  padding: 3rem 2rem;
  transform: translateX(100%);
  transition: transform 0.6s var(--easing);
  z-index: 1001;
  color: var(--primary-forest);
  box-shadow: -8px 0 32px var(--shadow-color);
}
[data-theme="dark"] .side-drawer { color: var(--cream); }
.side-drawer.open { transform: translateX(0); }
.close-drawer {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--primary-forest);
}
[data-theme="dark"] .close-drawer { color: var(--cream); }
.drawer-header { text-align: center; margin-bottom: 2rem; }
.drawer-avatar {
  width: 100px; height: 100px;
  background: var(--sage);
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.drawer-stats {
  display: flex; justify-content: space-around; margin-bottom: 2rem;
}
.d-stat { display: flex; flex-direction: column; align-items: center; }
.mock-chart {
  display: flex; align-items: flex-end; gap: 0.5rem; height: 150px;
  margin-top: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--glass-border);
}
.mock-chart .bar {
  flex: 1;
  background: var(--primary-forest);
  border-radius: 4px 4px 0 0;
  transition: height 1s var(--easing);
}
[data-theme="dark"] .mock-chart .bar { background: var(--accent-blue); }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 90%; max-width: 400px;
  text-align: center;
  color: var(--primary-forest);
}
[data-theme="dark"] .modal-card { color: var(--cream); }
.modal-options, .modal-dates {
  display: flex; flex-direction: column; gap: 0.5rem; margin: 1.5rem 0;
}
.export-opt {
  padding: 0.75rem; border-radius: 0.5rem; border: 1px solid var(--glass-border); background: rgba(255,255,255,0.5); cursor: pointer; font-weight: 600;
}
[data-theme="dark"] .export-opt { background: rgba(0,0,0,0.5); color: var(--cream); }
.export-opt.active, .export-opt:hover { background: var(--primary-forest); color: white; }
[data-theme="dark"] .export-opt.active, [data-theme="dark"] .export-opt:hover { background: var(--accent-blue); }
.modal-dates button {
  padding: 0.75rem; border-radius: 0.5rem; border: none; background: var(--sage); color: var(--primary-forest); font-weight: 600; cursor: pointer;
}
.custom-date-wrap { display: flex; gap: 0.5rem; }
.custom-date-wrap input { flex: 1; padding: 0.5rem; border-radius: 0.5rem; border: 1px solid var(--glass-border); }

/* Responsive */
@media (max-width: 768px) {
  .hero-bg-text { font-size: 25vw; }
  .app-rounded-container { border-radius: 2rem 2rem 0 0; padding: 1rem; }
  
  .pill-nav { 
    display: flex;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    width: 90%;
    justify-content: space-around;
    padding: 0.5rem;
  }
  .nav-link { padding: 0.5rem 1rem; font-size: 0.8rem; }
  
  .status-bubble { bottom: 5rem; right: 1rem; padding: 0.5rem 1rem; font-size: 0.8rem; }
  .floating-popup { bottom: 8rem; right: 1rem; padding: 0.75rem 1rem; }
  
  .stats-grid { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.5rem; }
  .side-drawer { width: 100%; border-radius: 0; padding: 2rem 1rem; }
  
  .glass-header { padding: 1rem; flex-direction: row; justify-content: space-between; align-items: center; }
  .logo-title { font-size: 1.2rem; }
  .logo-subtitle { font-size: 0.6rem; }
  .primary-btn { padding: 0.5rem 1rem; font-size: 0.8rem; letter-spacing: 0.1em; }
  
  .main-footer { flex-direction: column; text-align: center; margin-bottom: 4rem; padding: 2rem 1rem; }
  
  .toolbar { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; }
  .search-input, .date-filter, .action-btn { flex: 1; min-width: 45%; padding: 0.5rem; font-size: 0.8rem; }
  .action-btn { min-width: 30%; }
  
  .section-title { font-size: 2rem; margin-bottom: 1rem; text-align: center; }
  .inner-section { padding: 1rem 0; }
  .dashboard-main-card { padding: 1rem; }
  .stat-value { font-size: 2.5rem; }
  
  .glass-table th, .glass-table td { padding: 0.75rem; font-size: 0.85rem; }
  .glass-table th:first-child, .glass-table td:first-child { border-radius: 1rem 0 0 1rem; }
  .glass-table th:last-child, .glass-table td:last-child { border-radius: 0 1rem 1rem 0; }
}
