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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f8fafc;
}

.container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  justify-content: center;
}

/* Login */
.login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-container h2 {
  margin-bottom: 2rem;
  color: #2563eb;
  font-size: 2rem;
}

/* Forms */
.form {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.form input,
.form select {
  width: 100%;
  padding: 12px;
  margin-bottom: 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.2s;
}

.form input:focus,
.form select:focus {
  outline: none;
  border-color: #2563eb;
}

.form button {
  width: 100%;
  padding: 12px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.form button:hover {
  background: #1d4ed8;
}

.form button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Dashboard */
.dashboard {
  max-width: 800px;
  margin: 0 auto;
  padding: 15px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
}

.header h1 {
  color: #2563eb;
  font-size: 1.25rem;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.dropdown-menu {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 140px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  border-radius: 8px;
  z-index: 1000;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0;
}

.dropdown-content.show {
  display: block;
}

.dropdown-item {
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #374151;
  transition: background-color 0.2s;
}

.dropdown-item:hover {
  background-color: #f3f4f6;
}

.dropdown-icon {
  font-size: 1rem;
}

.menu-toggle-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
  line-height: 1;
}

.menu-toggle-btn:hover {
  background-color: #f3f4f6;
  color: #374151;
}

.btn-secondary {
  padding: 4px 8px;
  background: #6b7280;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-secondary:hover {
  background: #4b5563;
}

/* Balance Cards */
.balance-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.balance-card {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: left;
  position: relative;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.balance-card h3 {
  color: #6b7280;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
  position: absolute;
  top: 0.5rem;
  left: 0.75rem;
}

.balance-amount {
  font-size: 4.5rem;
  font-weight: 600;
  color: #059669;
  margin: 0;
  line-height: 1;
}

.balance-card small {
  display: none;
}

/* Admin Controls */
.admin-controls {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.admin-controls h3 {
  margin-bottom: 1rem;
  color: #374151;
  font-size: 1.125rem;
}

#withdrawalInfo {
  background: #eff6ff;
  padding: 0.75rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border-left: 4px solid #2563eb;
}

#withdrawalInfo small {
  color: #1d4ed8;
  font-weight: 500;
}

/* Transactions */
.transactions-section {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.transactions-section h3 {
  margin-bottom: 1rem;
  color: #374151;
  font-size: 1rem;
}

.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.transaction-item {
  padding: 0.5rem;
  border-radius: 4px;
  border-left: 3px solid;
}

.transaction-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.transaction-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transaction-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.transaction-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}


.transaction-reason {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  line-height: 1.2;
}

.transaction-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.125rem 0.375rem;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
  flex-shrink: 0;
}

.transaction-badge.earn {
  background: #dcfce7;
  color: #166534;
}

.transaction-badge.spend {
  background: #fefce8;
  color: #ca8a04;
}

.transaction-badge.penalty {
  background: #fee2e2;
  color: #dc2626;
}

.transaction-badge.withdraw {
  background: #ede9fe;
  color: #7c3aed;
}

.transaction-badge.transfer {
  background: #dbeafe;
  color: #1d4ed8;
}


.transaction-amount {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.transaction-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.transaction-actions {
  display: flex;
  gap: 0.25rem;
}

.account-info {
  font-weight: 500;
  text-transform: capitalize;
}

.date-info {
  opacity: 0.8;
}

.transaction-item.earn {
  background: #f0fdf4;
  border-left-color: #059669;
}

.transaction-item.spend {
  background: #fefbeb;
  border-left-color: #f59e0b;
}

.transaction-item.penalty {
  background: #fef2f2;
  border-left-color: #dc2626;
}

.transaction-item.withdraw {
  background: #fefbeb;
  border-left-color: #d97706;
}

.transaction-item.transfer {
  background: #f0f9ff;
  border-left-color: #0ea5e9;
}

.transaction-reason {
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.transaction-details {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.125rem;
}

.transaction-amount.earn {
  color: #059669;
}

.transaction-amount.spend {
  color: #f59e0b;
}

.transaction-amount.penalty {
  color: #dc2626;
}

.transaction-amount.withdraw {
  color: #d97706;
}

.transaction-amount.transfer {
  color: #0ea5e9;
}

/* Error Messages */
.error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #fef2f2;
  border-radius: 4px;
  border: 1px solid #fecaca;
}

.error:empty {
  display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .header {
    flex-direction: row;
    gap: 0.5rem;
    text-align: left;
  }
  
  .header-title {
    justify-content: flex-start;
  }
  
  .balance-cards {
    grid-template-columns: 1fr 1fr; /* Keep side by side on mobile */
    gap: 0.75rem; /* Reduce gap */
  }
  
  .balance-card {
    padding: 1rem; /* Reduce from 2rem to 1rem */
  }
  
  .balance-card h3 {
    font-size: 0.75rem; /* Smaller title */
    margin-bottom: 0.25rem; /* Less margin */
  }
  
  .balance-amount {
    font-size: 3.5rem; /* Increase for better visibility */
    margin-bottom: 0.125rem; /* Less margin */
  }
  
  .balance-card small {
    font-size: 0.625rem; /* Smaller "points" text */
  }
  
  /* Keep transaction layout as row on mobile - only adjust very small screens */
}

/* PWA Styles */
@media (display-mode: standalone) {
  body {
    user-select: none;
    -webkit-user-select: none;
  }
  
  .header {
    padding-top: calc(env(safe-area-inset-top) + 1.5rem);
  }
}

/* Point Entry Interface */
.unified-entry {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
  width: 100%;
}

.reason-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  box-sizing: border-box;
  margin-bottom: 12px;
}

.reason-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.reason-input::placeholder {
  color: #9ca3af;
}

.entry-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  align-items: flex-start;
}

.point-input-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  min-height: 188px;
}

.unified-point-input {
  padding: 12px 16px !important;
  border: 2px solid #d1d5db !important;
  border-radius: 8px !important;
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  width: 140px !important;
  background: white !important;
  text-align: center !important;
  height: 60px !important;
  box-sizing: border-box !important;
}

.unified-point-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.unified-point-input::placeholder {
  color: #9ca3af;
  opacity: 1;
  font-weight: 400;
}


.point-input-column .action-btn {
  height: 60px !important;
  width: 140px !important;
  box-sizing: border-box !important;
}

.action-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-self: flex-start;
  margin-top: 0;
  min-height: 188px;
}

.action-column .action-btn {
  height: 60px !important;
  width: 140px !important;
  box-sizing: border-box !important;
}

.entry-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.entry-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.section-heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin: 0 0 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.entry-group label {
  font-weight: 600;
  color: #374151;
  font-size: 0.75rem;
  white-space: nowrap;
}


.action-buttons {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 10px 16px;
  border: 2px solid;
  border-radius: 8px;
  background: #ffffff !important;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  justify-content: center;
  height: 60px !important;
  min-height: 60px !important;
  max-height: 60px !important;
  box-sizing: border-box !important;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.action-btn.reward {
  border-color: #10b981;
  color: #10b981;
}

.action-btn.reward:hover:not(:disabled) {
  background: #10b981;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.action-btn.lose {
  border-color: #ef4444;
  color: #ef4444;
}

.action-btn.lose:hover:not(:disabled) {
  background: #ef4444;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.action-btn.spend {
  border-color: #f59e0b;
  color: #f59e0b;
}

.action-btn.spend:hover:not(:disabled) {
  background: #f59e0b;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.action-btn.withdraw {
  border-color: #f59e0b;
  color: #f59e0b;
}

.action-btn.withdraw:hover:not(:disabled) {
  background: #f59e0b;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.action-btn.transfer {
  border-color: #3b82f6;
  color: #3b82f6;
}

.action-btn.transfer:hover:not(:disabled) {
  background: #3b82f6;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-icon {
  font-size: 0.875rem;
}

.btn-text {
  font-size: 0.875rem;
}

/* Withdraw Section */
.point-preview {
  font-size: 0.75rem;
  color: #6b7280;
  text-align: center;
  min-height: 1rem;
}

/* Override min-height for withdraw section */
#withdraw-section .point-input-column,
#withdraw-section .action-column {
  min-height: auto;
}

.dollar-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.dollar-sign {
  position: absolute;
  left: 12px;
  color: #6b7280;
  font-weight: 600;
  z-index: 1;
}

.dollar-input {
  width: 100%;
  padding: 12px 12px 12px 28px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.dollar-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.point-preview {
  color: #6b7280;
  font-size: 0.6rem;
  margin-left: 0.5rem;
  white-space: nowrap;
  min-width: 60px;
  display: inline-block;
}

.withdraw-section .action-btn {
  width: auto;
  margin-left: 0.5rem;
  flex: none;
}

/* Transfer Section */
.transfer-section {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
}

.transfer-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.transfer-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.transfer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.transfer-buttons .action-btn {
  flex-direction: row;
  justify-content: center;
  padding: 1rem 1.5rem;
}

/* Responsive */
@media (max-width: 640px) {
  .action-buttons {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .action-btn {
    flex-direction: row;
    justify-content: center;
    padding: 1rem 1.5rem;
  }
  
  .transfer-buttons {
    grid-template-columns: 1fr;
  }
}

/* Extra small mobile screens */
@media (max-width: 480px) {
  .balance-cards {
    gap: 0.5rem; /* Even smaller gap */
  }
  
  .balance-card {
    padding: 0.75rem; /* Even more compact padding */
  }
  
  .balance-amount {
    font-size: 2.5rem; /* Larger even on small screens */
  }
  
  .balance-card h3 {
    font-size: 0.625rem; /* Smaller title */
  }
  
  .dashboard {
    padding: 15px; /* Reduce overall dashboard padding */
  }
  
  .transaction-bottom {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .transaction-meta {
    justify-content: flex-start;
    gap: 0.5rem;
  }
}

/* Transaction Editing */


.edit-btn, .delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0.125rem;
  border-radius: 3px;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}

.edit-btn:hover, .delete-btn:hover {
  opacity: 1;
}

.edit-btn:hover {
  background: rgba(59, 130, 246, 0.1);
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

.reason-edit {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: inherit;
  font-family: inherit;
  width: 100%;
  max-width: 200px;
}

.reason-edit:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}