/* ============================================================================
   2013 MATERIAL DESIGN SYSTEM (LIGHT MODE)
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=Roboto+Slab:wght@300;400;500;700&display=swap');

:root {
  /* Classic Bold Material Colors */
  --primary: #3f51b5;         /* Indigo 500 */
  --primary-dark: #303f9f;    /* Indigo 700 */
  --primary-light: #c5cae9;   /* Indigo 100 */
  --accent: #ff4081;          /* Pink A200 (Classic Material Accent) */
  --accent-dark: #f50057;     /* Pink A400 */
  
  --bg-base: #eeeeee;         /* Grey 200 (Classic paper background) */
  --bg-card: #ffffff;         /* Pure white paper */
  --bg-hover: #f5f5f5;        /* Grey 100 */
  
  /* Text Contrast Hierarchy */
  --text-primary: rgba(0, 0, 0, 0.87);   /* 87% Opacity black */
  --text-secondary: rgba(0, 0, 0, 0.54); /* 54% Opacity black */
  --text-disabled: rgba(0, 0, 0, 0.38);  /* 38% Opacity black */
  --divider: rgba(0, 0, 0, 0.12);        /* 12% Opacity black */
  
  /* Semantic Colors */
  --success: #4caf50;         /* Green 500 */
  --danger: #f44336;          /* Red 500 */
  --warning: #ff9800;         /* Orange 500 */
  --info: #2196f3;            /* Blue 500 */

  /* Realistic Elevation Physics (DP Shadows) */
  --shadow-1dp: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
  --shadow-2dp: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
  --shadow-4dp: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
  --shadow-6dp: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
  --shadow-8dp: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
  
  /* Classic 2013 Material Curves */
  --transition-speed: 0.28s;
  --transition-material: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-card: 2px; /* Classic flat-cut sharp corners */
  --border-radius-btn: 2px;
}

/* ============================================================================
   GLOBAL STYLES & RESET
   ============================================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* ============================================================================
   TYPOGRAPHY
   ============================================================================ */
h1, h2, h3, h4, h5, h6, .logo, .dash-brand, .points-display, .panel-title {
  font-family: 'Roboto Slab', serif;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

h1 { font-size: 2.125rem; font-weight: 400; letter-spacing: -0.01em; } /* Headline */
h2 { font-size: 1.5rem; font-weight: 500; }                          /* Title */
h3 { font-size: 1.25rem; font-weight: 500; }                        /* Subhead */

p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ============================================================================
   MATERIAL CARDS (PAPER SPEC)
   ============================================================================ */
.glass-panel, .panel-card, .auth-card, .modal-card {
  background: var(--bg-card);
  border-radius: var(--border-radius-card);
  box-shadow: var(--shadow-1dp);
  border: none;
  padding: 24px;
  transition: var(--transition-material);
  position: relative;
  overflow: hidden;
}

.glass-panel:hover, .panel-card:hover {
  box-shadow: var(--shadow-2dp);
}

/* ============================================================================
   BUTTONS (RAISED, FLAT, FAB)
   ============================================================================ */
.btn {
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  border-radius: var(--border-radius-btn);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-material);
  outline: none;
}

/* Raised Button */
.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-1dp);
}
.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: var(--shadow-2dp);
}
.btn-primary:active {
  box-shadow: var(--shadow-1dp);
}

/* Flat Button */
.btn-secondary {
  background-color: transparent;
  color: var(--primary);
}
.btn-secondary:hover {
  background-color: rgba(63, 81, 181, 0.08);
}
.btn-secondary:active {
  background-color: rgba(63, 81, 181, 0.16);
}

/* Raised Danger Button */
.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
  box-shadow: var(--shadow-1dp);
}
.btn-danger:hover {
  background-color: #d32f2f;
  box-shadow: var(--shadow-2dp);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* Floating Action Button (FAB) */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--accent);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-2dp);
  border: none;
  cursor: pointer;
  z-index: 999;
  transition: var(--transition-material);
}
.fab:hover {
  background-color: var(--accent-dark);
  box-shadow: var(--shadow-4dp);
  transform: translateY(-2px);
}
.fab:active {
  box-shadow: var(--shadow-2dp);
  transform: translateY(0);
}

/* ============================================================================
   MATERIAL INPUT FIELDS
   ============================================================================ */
.form-group {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 6px;
  transition: var(--transition-material);
}

.input-field {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--divider);
  color: var(--text-primary);
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  transition: var(--transition-material);
}

.input-field:focus {
  outline: none;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 7px; /* Avoid jump due to border width increase */
}

/* Text fields focus animation */
.form-group:focus-within label {
  color: var(--primary);
}

/* ============================================================================
   AUTHENTICATION VIEW (index.html)
   ============================================================================ */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  gap: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px 24px;
}

.auth-header {
  margin-bottom: 28px;
  text-align: center;
}
.auth-header .logo {
  font-size: 1.8rem;
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.auth-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: 'Roboto', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition-material);
  position: relative;
  text-align: center;
}
.auth-tab:hover {
  background-color: rgba(0, 0, 0, 0.04);
}
.auth-tab.active {
  color: var(--primary);
}
.auth-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary);
  animation: tabExpand 0.28s ease;
}

.auth-form {
  display: none;
  flex-direction: column;
}
.auth-form.active {
  display: flex;
}

/* ============================================================================
   MAIN DASHBOARD LAYOUT (dashboard.html)
   ============================================================================ */
.dashboard-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0 40px 0;
}

/* Header / App Bar */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--primary);
  color: #ffffff;
  padding: 0 24px;
  height: 64px;
  box-shadow: var(--shadow-1dp);
  margin-bottom: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.dash-brand {
  font-size: 1.25rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-brand svg path {
  fill: #ffffff !important;
  stroke: #ffffff !important;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-profile-info {
  text-align: right;
}
.profile-name {
  font-weight: 500;
  font-size: 0.875rem;
  color: #ffffff;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-admin {
  background-color: #fce4ec;
  color: #c2185b;
}
.badge-user {
  background-color: #e8eaf6;
  color: #3f51b5;
}
.badge-earn {
  background-color: #e8f5e9;
  color: #2e7d32;
}
.badge-spend {
  background-color: #ffebee;
  color: #c62828;
}
.badge-adjust {
  background-color: #fff3e0;
  color: #ef6c00;
}

.profile-role-badge {
  margin-top: 2px;
}

#btnLogout {
  color: #ffffff;
}
#btnLogout:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

/* Dashboard Body Structure */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 0 24px;
}
@media (min-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 320px 1fr;
  }
}

/* Balance Card */
.balance-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}
.balance-card h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.points-display {
  font-size: 3.5rem;
  font-weight: 300;
  line-height: 1;
  color: var(--primary);
  margin-bottom: 12px;
}
.points-display .pts-suffix {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 4px;
}

/* Panel Containers */
.panel-card {
  padding: 24px;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 16px;
}
.panel-title {
  font-size: 1.15rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}
.panel-title svg {
  stroke: var(--primary) !important;
}

/* Admin Specific Panel */
.admin-container {
  margin-top: 24px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Search Bar (Material Standard) */
.search-container {
  position: relative;
  width: 100%;
  max-width: 260px;
}
.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background-color: var(--bg-hover);
  border: none;
  border-bottom: 1px solid var(--divider);
  border-radius: var(--border-radius-card);
  color: var(--text-primary);
  font-family: 'Roboto', sans-serif;
  font-size: 0.875rem;
  transition: var(--transition-material);
}
.search-input:focus {
  outline: none;
  background-color: #ffffff;
  border-bottom: 2px solid var(--primary);
  box-shadow: var(--shadow-1dp);
}
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 18px;
  height: 18px;
}

/* ============================================================================
   TABLE STYLING (MATERIAL DATA TABLES)
   ============================================================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.custom-table th {
  padding: 12px 16px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.custom-table td {
  padding: 16px;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  color: var(--text-primary);
}

.custom-table tr:hover td {
  background-color: var(--bg-hover);
}

.custom-table .actions {
  display: flex;
  gap: 8px;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ============================================================================
   MODAL SPECIFICATION (elevation 16dp / 24dp)
   ============================================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4); /* Dark overlay */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 460px;
  padding: 24px;
  box-shadow: var(--shadow-8dp);
  transform: scale(0.9);
  transition: transform var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  margin: 16px;
}
.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition-material);
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* ============================================================================
   TOAST SYSTEM (SNACKBAR SPEC)
   ============================================================================ */
.toast-container {
  position: fixed;
  bottom: 0;
  left: 24px; /* Bottom-left alignment standard for classic Material */
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  max-width: 480px;
  width: auto;
  padding-bottom: 24px;
}

.toast {
  padding: 14px 24px;
  border-radius: var(--border-radius-btn);
  background-color: #323232; /* Classic charcoal snackbar */
  box-shadow: var(--shadow-2dp);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  animation: snackbarSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  min-width: 288px;
}

.toast svg {
  display: none; /* Hide icons to match minimalistic snackbar design */
}

.toast-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.toast-title {
  font-weight: 500;
  color: #ffffff;
}
.toast-message {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
}

/* Color indicators using soft line on top */
.toast-success { border-bottom: 3px solid var(--success); }
.toast-error { border-bottom: 3px solid var(--danger); }
.toast-info { border-bottom: 3px solid var(--info); }

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
@keyframes tabExpand {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes snackbarSlideIn {
  from { transform: translateY(48px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

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