:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-color: #f8fafc;
  --text-color: #1e293b;
  --card-bg: #ffffff;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --radius: 12px;
}

/* Theme: Blue (Default) */
.theme-blue {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
}

/* Theme: Green */
.theme-green {
  --primary-color: #16a34a;
  --primary-hover: #15803d;
}

/* Theme: Purple */
.theme-purple {
  --primary-color: #9333ea;
  --primary-hover: #7e22ce;
}

/* Theme: Pink (CU) สีประจำจุฬาลงกรณ์มหาวิทยาลัย */
.theme-pink {
  --primary-color: #DE5C8E;
  --primary-hover: #c44b7a;
}


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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  padding: 24px;
  /* Mobile friendly padding */
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  /* Centering content vertically on mobile for better focus */
  flex-direction: column;
  align-items: center;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
  color: #0f172a;
}

p {
  color: #64748b;
  text-align: center;
  margin-bottom: 2rem;
}

/* Mobile First: Stacked Layout */
.transaction-menu {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  /* Limit width on tablets before breakpoint */
}

.btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  /* Full width on mobile */
  padding: 16px 24px;
  background-color: var(--primary-color);
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  border: none;
  cursor: pointer;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Deposit specific color (example of variety) */
a[href*="deposit"] {
  background-color: #10b981;
}

a[href*="deposit"]:hover {
  background-color: #059669;
}

/* Withdraw specific color */
a[href*="withdraw"] {
  background-color: #ef4444;
}

a[href*="withdraw"]:hover {
  background-color: #dc2626;
}

/* Bill specific color */
a[href*="bill"] {
  background-color: #f59e0b;
}

a[href*="bill"]:hover {
  background-color: #d97706;
}

/* Open Account specific color */
a[href*="open_account"] {
  background-color: #6366f1;
}

a[href*="open_account"]:hover {
  background-color: #4f46e5;
}


/* Desktop / Tablet Styles */
@media (min-width: 768px) {
  body {
    padding: 60px;
    justify-content: flex-start;
    /* Reset vertical centering */
  }

  h1 {
    font-size: 2.5rem;
  }

  .transaction-menu {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
  }

  .btn {
    width: 100%;
    /* Fill grid cell */
    min-width: unset;
    /* Remove min-width requirement from flex */
    padding: 24px;
    font-size: 1.2rem;
    height: 100%;
    /* Ensure full height */
    display: flex;
    justify-content: center;
    align-items: center;
  }
}

/* Custom Dropdown Styles */
.custom-dropdown {
  position: relative;
  /* relative flow */
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
  /* Space before title */
  z-index: 1000;
}

.dropbtn {
  background-color: white;
  color: #333;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-family: var(--font-family);
  font-weight: 500;
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: white;
  min-width: 120px;
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  border: 1px solid #eee;
  z-index: 1;
  overflow: hidden;
  margin-top: 4px;
}

.dropdown-content a {
  color: #333;
  padding: 10px 16px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.dropdown-content a:hover {
  background-color: #f1f5f9;
}



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

/* CSS Flags */
.flag {
  width: 20px;
  height: 14px;
  display: inline-block;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
  background-size: cover;
  position: relative;
}

/* icon ธง th, la, en, cn */

/* TH: Red White Blue White Red */
.flag-th {
  background: linear-gradient(to bottom,
      #ef3340 0%, #ef3340 16.6%,
      #ffffff 16.6%, #ffffff 33.3%,
      #00247d 33.3%, #00247d 66.6%,
      #ffffff 66.6%, #ffffff 83.3%,
      #ef3340 83.3%, #ef3340 100%);
}

/* LA: Red Blue Red + White Circle */
.flag-la {
  background: linear-gradient(to bottom,
      #ce1126 0%, #ce1126 25%,
      #002868 25%, #002868 75%,
      #ce1126 75%, #ce1126 100%);
}

.flag-la::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background-color: white;
  border-radius: 50%;
}

/* EN: Simplified UK/English Flag */
.flag-en {
  background: white;
  background-image:
    linear-gradient(to right, transparent 42%, #ce1124 42%, #ce1124 58%, transparent 58%),
    linear-gradient(to bottom, transparent 42%, #ce1124 42%, #ce1124 58%, transparent 58%);
  box-shadow: inset 0 0 0 1px #eee;
  /* border for visibility */
}

/* CN: Red with Yellow Star */
.flag-cn {
  background-color: #de2910;
  display: flex;
  justify-content: center;
  align-items: center;
}


.flag-cn::after {
  content: "★";
  color: #ffde00;
  font-size: 10px;
  line-height: 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Specific styles for waiting/result page */
.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px auto;
}

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

  100% {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none;
}

.result-card {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  max-width: 400px;
  width: 100%;
}

.result-card p {
  margin-bottom: 0.5rem;
  color: #64748b;
}

.queue-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 10px 0;
}

.qr-image {
  width: 200px;
  height: 200px;
  margin: 20px auto;
  display: block;
}

.back-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 24px;
  background-color: #64748b;
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
}

.save-btn {
  display: inline-block;
  margin-top: 10px;
  padding: 12px 24px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}