:root {
  --primary: #28338C;
  --accent: #ffd420;
  --light-bg: #f8f9fa;
  --dark-text: #212529;
  --light-text: #f8f9fa;
  --card-bg: rgba(255, 255, 255, 0.97);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #1a2269 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 1rem;
  color: var(--dark-text);
  line-height: 1.6;
}

.container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.card {
  width: 100%;
  max-width: 440px;
  border: none;
  border-radius: 1rem;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 2rem;
  animation: fadeIn 0.5s ease-out;
  position: relative;
  overflow: hidden;
  margin: auto;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--accent);
}

@keyframes fadeIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pill-btn {
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  padding: 0.75rem 1.5rem;
}

.btn-primary {
  background-color: var(--primary);
  border: none;
}

.btn-primary:hover {
  background-color: #1a2269;
  transform: translateY(-2px);
}

.btn-success {
  background-color: var(--primary);
  border: none;
}

.btn-success:hover {
  background-color: #1a2269;
  transform: translateY(-2px);
}

.btn-outline-dark {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-dark:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.hidden {
  display: none !important;
}

.muted {
  color: #6c757d;
  font-size: 0.9rem;
}

img.logo {
  max-height: 70px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
}

.form-control, .form-select {
  border-radius: 0.75rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid #dee2e6;
  transition: all 0.3s ease;
  background-color: var(--light-bg);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(40, 51, 140, 0.2);
  background-color: #fff;
}

.header-icon {
  font-size: 1.5rem;
  margin-right: 0.5rem;
  color: var(--primary);
}

.timestamp {
  background-color: var(--light-bg);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--primary);
}

.success-message {
  animation: pulse 0.5s;
}

.duplicate-message {
  animation: shake 0.5s;
}

.queue-indicator {
  background-color: var(--light-bg);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-top: 1rem;
  border-left: 4px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.queue-count {
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.scanner-mode {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: var(--primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
}

.data-protection {
  background-color: rgba(40, 51, 140, 0.1);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  margin-top: 1rem;
  border-left: 4px solid #28a745;
}

.backup-status {
  background-color: rgba(108, 117, 125, 0.1);
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: var(--primary);
  border-radius: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: bold;
}

/* Enhanced mobile responsiveness */
@media (max-width: 576px) {
  body {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    min-height: 100vh;
  }
  
  .container {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    min-height: 100vh;
  }
  
  .card {
    padding: 1.5rem;
    margin: 0 auto;
    border-radius: 1rem;
    width: 95%;
  }
  
  .pill-btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
  }
  
  .header-icon {
    font-size: 1.25rem;
  }
  
  .timestamp {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 350px) {
  .card {
    padding: 1.25rem;
  }
  
  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .d-flex.justify-content-between .btn {
    width: 100%;
  }
}

/* Loading animation */
.spinner-border {
  width: 1.2rem;
  height: 1.2rem;
}

/* Custom focus states for accessibility */
.btn:focus, .form-control:focus, .form-select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Status messages */
.text-success, .text-danger, .text-warning {
  font-weight: 500;
  padding: 0.5rem;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

.text-success {
  background-color: rgba(40, 51, 140, 0.1);
  color: var(--primary) !important;
}

.text-danger {
  background-color: rgba(220, 53, 69, 0.1);
}

.text-warning {
  background-color: rgba(255, 193, 7, 0.1);
}

/* Form labels */
.form-label {
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Login page enhancements */
#loginCard {
  text-align: center;
}

#loginCard h4 {
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* Settings page enhancements */
#setupCard h5 {
  color: var(--primary);
  font-weight: 700;
}

/* Form page enhancements */
#formCard h5 {
  color: var(--primary);
  font-weight: 700;
}

/* Duplicate alert styling */
.duplicate-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  animation: slideInDown 0.5s ease-out;
  min-width: 300px;
  max-width: 90%;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  border: none;
  border-radius: 0.75rem;
}

/* Backup success alert styling */
.backup-success-alert {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1050;
  animation: slideInDown 0.5s ease-out;
  min-width: 300px;
  max-width: 90%;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  border: none;
  border-radius: 0.75rem;
}

@keyframes slideInDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

@keyframes slideOutUp {
  from {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
}

/* Scanning animation */
.scanning-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent);
  margin-left: 8px;
  animation: pulse 1s infinite;
}

.recent-item {
  border-left: 4px solid var(--accent);
  animation: fadeIn 0.3s ease-out;
}

.duplicate-item {
  border-left: 4px solid #dc3545;
  animation: shake 0.5s;
}