@import url("./coin-table.css");
@import url("./spinner.css");
@import url("./suggestions.css");
@import url("./transactions.css");

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-repeat: no-repeat; /* Prevent repeating */
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0; /* Add horizontal padding */
}

.container {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.main-flex {
  display: flex;
  align-items: flex-start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  gap: 1rem;
  height: calc(100vh - 4rem); /* fill almost full viewport minus body padding */
}

.card-container {
  width: 40%;
}

.table-container {
  width: 60%;
}

.card-container,
.table-container {
  height: 100%; /* inherit from main-flex */
}

/* On mobile: center card/table and constrain height */
@media (max-width: 768px) {
  .main-flex {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    height: auto;
  }

  .card-container .container {
    width: 100%;
    max-width: 100%;
  }

  .card-container,
  .table-container {
    width: 100%;
    min-width: 300px;
    flex: unset;
    height: auto;
    box-sizing: border-box;
  }

  /* Add consistent internal padding without breaking sticky table */
  .table-container::before {
    content: "";
    display: block;
    height: 1rem; /* top padding */
  }

  .table-scroll-wrapper {
    height: 400px; /* show only as many rows as fit card height */
    overflow-y: auto; /* vertical scroll for overflow */
    overflow-x: auto; /* horizontal scroll */
  }

  /* Instead of padding on scroll-wrapper, add margin to table */
  .coin-table {
    margin: 0 0.75rem; /* left/right spacing matching card */
  }
}

/* Table wrapper for horizontal scrolling */
.table-scroll-wrapper {
  width: 100%;
  max-height: 100%;
  overflow-y: auto; /* vertical scroll */
  overflow-x: auto; /* horizontal scroll */
  border-radius: 16px;
}

.container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  height: 100%; /* Fill card container */
  display: flex;
  flex-direction: column;
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo h1 {
  color: #667eea;
  font-size: 1.2rem;
  font-weight: 700;
}

/* Page Management */
.page {
  display: none;
}

.page.active {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.page h2 {
  margin-bottom: 1.5rem;
  font-size: 14px;
  color: #667eea;
}

/* Menu Items */
.menu-page {
  overflow-y: auto;
  -ms-overflow-style: none; /* IE and Edge */
  scrollbar-width: none; /* Firefox */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.menu-page::-webkit-scrollbar {
  display: none;
}

.menu-item {
  background: #f8f9ff;
  border: 2px solid #e0e7ff;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-item:hover {
  background: #e0e7ff;
  border-color: #667eea;
  transform: translateY(-2px);
}

.menu-item span {
  font-weight: 600;
  color: #374151;
}

.menu-item .icon {
  width: 24px;
  height: 24px;
  background: #667eea;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #374151;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5a67d8;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* Balance Card */
.balance-card {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  text-align: center;
}

.balance-amount {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.balance-label {
  font-size: 0.875rem;
  opacity: 0.8;
}

.card-footer {
  margin-top: auto; /* ⬅️ pushes footer to bottom */
  text-align: center;
  font-size: 0.95rem;
  color: #667eea;
  background: #f8f9ff;
  border-radius: 8px;
  padding: 0.75rem 0.5rem;
  border: 1px solid #e0e7ff;
}

.card-footer a {
  text-decoration: none;
  color: #667eea;
  transition: color 0.2s;
}

.card-footer a:hover {
  color: #5a67d8;
}

/* Password field with toggle icon */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  flex: 1;
  width: 100%;
  padding-right: 2.5rem; /* space for the eye icon */
  box-sizing: border-box;
}

/* Eye toggle button */
.toggle-password {
  position: absolute;
  right: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  user-select: none;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  display: flex;
  flex-direction: column;
  justify-content: center;

  background: white;
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  text-align: center;
}

.modal-content h3 {
  margin-bottom: 1rem;
  color: #374151;
}

.modal-content p {
  margin-bottom: 1.5rem;
  color: #6b7280;
}

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

/* Error Messages */
.error-message {
  background: #fee2e2;
  color: #dc2626;
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: none;
}

.error-message.active {
  display: block;
}

.login-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#auth-tabs {
  display: flex;
  flex-direction: row;
  background: #f8f9ff;
  border-bottom: 2px solid #e0e7ff;
  border-radius: 16px 16px 0 0;
}

.auth-tab {
  flex: 1;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #6b7280;
  border-bottom: 3px solid transparent;
  background: #f8f9ff;
}

.auth-tab:first-child {
  border-radius: 16px 0 0 0;
}

.auth-tab:last-child {
  border-radius: 0 16px 0 0;
}

.auth-tab:hover {
  background: #e0e7ff;
}

.auth-tab.active {
  color: #667eea;
  background: white;
  border-bottom-color: #667eea;
}

.auth-tab-content {
  display: none;
}

.auth-tab-content.active {
  display: block;
  animation: fadeInTab 0.3s ease;
}

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

.auth-divider {
  text-align: center;
  margin: 1.5rem 0;
  color: #9ca3af;
  font-size: 0.875rem;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #e5e7eb;
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

.input-hint {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

#recaptcha-container {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
}
