@import url("https://fonts.googleapis.com/css2?family=Comfortaa:wght@300..700&family=Questrial&display=swap");
/* CSS Variables for consistent colors */
:root {
  --primary-color: #121212;
  --secondary-color: #32404d;
  --btn-primary: #02519c;
  --accent-primary: #79bff2;
  --game-btn: #1b72b1;
  --game-btn-selected: #1b72b150;
  --error-color: #dc3545;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --white: #ffffff;
  --light-gray: #f8f9fa;
  --dark-gray: #6c757d;
  --red-500: #ef4444;
  --gray-300: #d1d5db;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --slate-50: #f8fafc;
  --slate-900: #0f172a;
}

/* Accessibility - Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Questrial", sans-serif;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  background-color: var(--primary-color);
  color: var(--white);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--btn-primary);
  color: var(--white);
}

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

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--white);
  border: 1px solid var(--gray-600);
}

.btn-secondary:hover {
  background-color: var(--gray-700);
}

.btn-accent {
  background-color: var(--accent-primary);
  color: var(--primary-color);
}

.btn-accent:hover {
  background-color: #5ba3d4;
}

.btn-outline {
  background-color: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.btn-outline:hover {
  background-color: var(--accent-primary);
  color: var(--primary-color);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.text-center {
  text-align: center;
}

.w-full {
  width: 100%;
}

.h-screen {
  height: 100vh;
}

.max-w-sm {
  max-width: 24rem;
}

.max-w-full {
  max-width: 100%;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.p-8 {
  padding: 2rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.gap-4 {
  gap: 1rem;
}

.rounded-xl {
  border-radius: 0.75rem;
}

.font-semibold {
  font-weight: 600;
}

.text-white {
  color: var(--white);
}

.text-red-500 {
  color: var(--red-500);
}

.bg-primary {
  background-color: var(--primary-color);
}

.bg-secondary {
  background-color: var(--secondary-color);
}

.bg-btn-primary {
  background-color: var(--btn-primary);
}

/* Landing Page Styles */
.landing-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  justify-content: center;
  align-items: center;
  background-color: var(--secondary-color);
  width: 100%;
  overflow-x: hidden;
}

.landing-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 1rem 1.5rem;
  background-color: #023c69;
  min-height: 400px;
  margin: 0 auto;
}

.landing-logo {
  width: 100%;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.landing-logo img {
  object-fit: contain;
  width: 100%;
  max-width: 400px;
  height: auto;
  min-height: 60px;
  max-height: 100px;
}

.landing-title {
  color: var(--white);
  text-align: center;
  margin-bottom: 1rem;
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  word-wrap: break-word;
}

.landing-error {
  color: var(--red-500);
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1rem;
  line-height: 1.4;
}

.landing-description {
  color: var(--white);
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.landing-button-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 1rem;
  max-width: 24rem;
}

/* Auth Page Styles */
.auth-container {
  display: flex;
  background-color: var(--primary-color);
  height: 100vh;
  justify-content: center;
  align-items: center;
}

.auth-wrapper {
  display: flex;
  padding: 1.5rem;
  width: 900px;
  display: flex;
  flex-grow: 1;
  justify-content: center;
  align-items: center;
  padding-bottom: 50px;
}

.auth-form {
  max-width: 690px;
  background-color: var(--secondary-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--white);
  border-radius: 0.75rem;
  width: 100%;
  padding: 2rem;
}

.auth-title {
  font-size: 1.875rem;
  padding-bottom: 1rem;
  color: var(--white);
  font-weight: 600;
  text-align: center;
}

/* Form Styles */
.form-group {
  width: 100%;
  margin-bottom: 1rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--gray-300);
  border-radius: 0.375rem;
  font-size: 1rem;
  background-color: var(--slate-50);
  color: var(--primary-color);
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--btn-primary);
  box-shadow: 0 0 0 3px rgba(2, 81, 156, 0.1);
}

.form-input.dark {
  background-color: var(--slate-900);
  color: var(--white);
  border-color: var(--gray-700);
}

.form-input.error {
  border-color: var(--error-color);
}

.error-message {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.form-help-text {
  font-size: 0.75rem;
  color: var(--gray-300);
  margin-top: 0.25rem;
}

.password-container {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--dark-gray);
}

.password-toggle:hover {
  color: var(--primary-color);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 51px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--btn-primary);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background-color: #034a8a;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--gray-700);
  color: var(--white);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--btn-primary);
  color: var(--btn-primary);
}

.btn-danger {
  background-color: var(--error-color);
  color: var(--white);
}

.btn-full {
  width: 100%;
}

.btn-loading {
  position: relative;
}

.btn-loading::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Enhanced Button States for Sign-In */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.btn-success {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: white !important;
  transition: all 0.3s ease;
}

.btn-error {
  background-color: #ef4444 !important;
  border-color: #ef4444 !important;
  color: white !important;
  animation: shake 0.5s ease-in-out;
}

.success-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 18px;
  animation: checkmark 0.3s ease-in-out;
}

@keyframes checkmark {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

/* Form Loading States */
.form-loading {
  opacity: 0.8;
  pointer-events: none;
}

.form-success {
  border: 2px solid #10b981;
  background-color: #f0fdf4;
  transition: all 0.3s ease;
}

/* Input Error Animation */
.input-error-shake {
  animation: inputShake 0.5s ease-in-out;
  border-color: #ef4444 !important;
}

@keyframes inputShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

/* Android API 19-28 Compatibility Improvements */
.btn-loading,
.btn-success,
.btn-error {
  -webkit-transition: all 0.3s ease;
  -moz-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

.loading-spinner {
  -webkit-animation: spin 1s linear infinite;
  -moz-animation: spin 1s linear infinite;
  -o-animation: spin 1s linear infinite;
  animation: spin 1s linear infinite;
}

/* Ensure button remains visible during all states */
.btn:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.btn-loading:disabled {
  opacity: 1;
  background-color: #3b82f6;
  border-color: #3b82f6;
}

/* Overview/Dashboard Styles */
.overview-container {
  background-color: var(--primary-color);
  min-height: 100vh;
  color: var(--white);
}

.nav-bar {
  background-color: var(--secondary-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gray-700);
}

.nav-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--white);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.nav-username {
  font-weight: 500;
  color: var(--white);
}

.nav-role {
  font-size: 0.875rem;
  color: var(--gray-300);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--error-color);
  cursor: pointer;
  padding: 0.5rem;
  font-size: 0.875rem;
}

.logout-btn:hover {
  text-decoration: underline;
}

.main-content {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--white);
}

.dashboard-subtitle {
  color: var(--gray-300);
  font-size: 1.125rem;
}

.tabs-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--gray-700);
}

.tab {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  color: var(--gray-300);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab:hover {
  color: var(--white);
}

.tab.active {
  color: var(--white);
  border-bottom-color: var(--btn-primary);
}

.data-table {
  background-color: var(--secondary-color);
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 2rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-700);
}

.table th {
  background-color: var(--gray-800);
  font-weight: 600;
  color: var(--white);
}

.table td {
  color: var(--gray-300);
}

.table tr:hover {
  background-color: var(--gray-800);
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-700);
  border-top: 4px solid var(--btn-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

/* Toast/Alert Styles */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  color: var(--white);
  font-weight: 500;
  z-index: 1000;
  animation: slideIn 0.3s ease;
  max-width: 400px;
}

.toast.success {
  background-color: var(--success-color);
}

.toast.error {
  background-color: var(--error-color);
}

.toast.warning {
  background-color: var(--warning-color);
  color: var(--primary-color);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Game Buttons */
.game-btn {
  background-color: var(--game-btn);
  color: var(--white);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.game-btn:hover {
  background-color: var(--game-btn-selected);
}

.game-btn.selected {
  background-color: var(--accent-primary);
  color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .landing-content {
    padding: 1rem;
  }

  .landing-title {
    font-size: 1.125rem;
  }

  .auth-wrapper {
    width: 100%;
    padding: 1rem;
  }

  .auth-form {
    padding: 1.5rem;
  }

  .auth-title {
    font-size: 1.5rem;
  }

  .nav-bar {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .dashboard-title {
    font-size: 1.5rem;
  }

  .tabs-container {
    flex-wrap: wrap;
  }

  .table {
    font-size: 0.875rem;
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }
}
