/* Modal base styles - Tailwind utilities rely on these classes existing */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  background: #ffffff;
  border-radius: 0.75rem; /* rounded-xl */
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  padding: 1rem; /* p-4 */
  transform: translateY(-2.5rem); /* -translate-y-10 */
  opacity: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  color: #4b5563; /* text-gray-600 */
  background: transparent;
}

.btn-primary {
  background: #2e1818; /* brand-primary */
  color: #ffffff;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
}

.btn-secondary {
  background: #f3f4f6; /* gray-100 */
  color: #374151; /* gray-700 */
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
}

/* Account card improvements - Compact design */
.account-card {
  transition: all 0.3s ease;
  border-radius: 0.75rem;
}

.account-card.has-calculation {
  min-height: 240px;
}

.account-card:not(.has-calculation) .card-content {
  flex-grow: 0;
}

.account-card:not(.has-calculation) .calculation-block {
  margin-top: 0;
}

.account-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Compact card content */
.account-card .p-3 {
  padding: 0.75rem;
}

/* Rate section alignment */
.account-card .mt-2 {
  margin-top: 0.5rem;
}

/* Compact text sizes */
.account-card h2 {
  font-size: 0.75rem;
  line-height: 1rem;
}

.account-card p {
  font-size: 0.75rem;
  line-height: 1rem;
}

/* Calculation result button improvements - Compact */
.calculation-result-btn {
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
}

.calculation-result-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.calculation-result-btn .text-center {
  line-height: 1.2;
}

/* Interest rate placeholder improvements - Compact */
.interest-rate-placeholder {
  transition: all 0.2s ease;
  padding: 0.5rem;
}

/* Rate section improvements - Aligned */
.account-card .bg-gray-50 {
  padding: 0.5rem;
  min-height: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Ensure rate text alignment */
.account-card .bg-gray-50 span {
  display: block;
  text-align: center;
}

/* Rate value styling */
.account-card .bg-gray-50 .text-sm {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.25rem;
}

/* Offer badge improvements */
.account-card .bg-gradient-to-r {
  padding: 0.25rem 0.5rem;
  font-size: 0.625rem;
}

/* Currency button improvements */
.currency-btn {
  transition: all 0.2s ease;
  border: 1px solid;
}

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

/* Modal improvements */
.modal-content {
  transition: all 0.3s ease;
}

/* Grid responsive improvements - Compact */
#accounts-grid {
  min-height: 200px;
  gap: 0.75rem;
}

/* Responsive grid adjustments */
@media (min-width: 640px) {
  #accounts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  #accounts-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  #accounts-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1280px) {
  #accounts-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1536px) {
  #accounts-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Loading state improvements */
.calculate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Reduce accidental tap highlights and caret flashes on interactive elements */
a, button, [role="button"], select {
  -webkit-tap-highlight-color: transparent;
  outline: none;
  /* Allow normal text selection and caret rendering */
}

/* Disable text selection and copying globally (except form fields) */
html, body, main, nav, header, footer, section, article, div, p, span, h1, h2, h3, h4, h5, h6, a, button, label, ul, li, table, th, td {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Allow selection where needed (form controls and opt-in class) */
input, textarea, select, code, pre, .allow-select, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Stronger safeguard: disable selection inside account cards */
.account-card,
.account-card *:not(input):not(textarea):not(select):not([contenteditable="true"]) {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

a:focus, button:focus, [role="button"]:focus, select:focus {
  outline: none;
  box-shadow: none;
}

/* Skip link for keyboard navigation - must be visible when focused */
a[href="#main-content"]:focus {
  outline: 2px solid #c1ff72;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(193, 255, 114, 0.3);
}

/* Unified product card design - matching daily deposit style */
.product-card > div {
  /* Border-based design matching daily deposit cards */
  border-color: rgb(229, 231, 235) !important; /* gray-200 */
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.product-card:hover > div {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important; /* shadow-lg */
}

/* Product image styling for transparent background-removed images */
/* Only target the main product image with .product-image class, not store logos */
.product-card .product-image {
  /* Clean white background for transparent images - looks professional */
  background-color: #ffffff;
  /* No transitions, hover effects, or borders - completely static image */
  border: 2px solid transparent;
}

/* Prevent store logos from scaling on hover - they should remain static */
.product-card img:not(.product-image) {
  transition: none !important;
  transform: none !important;
}

.product-card:hover img:not(.product-image) {
  transform: none !important;
}

/* Remove background from image container - let it be transparent */
.product-card > div > div.flex.items-center.justify-center {
  background: transparent;
}

/* PWA install banner layout and styling */
.pwa-install-banner {
  position: fixed;
  bottom: clamp(0.75rem, 1.5vw, 1.5rem);
  right: clamp(0.75rem, 2vw, 2rem);
  left: auto;
  z-index: 120 !important;
  width: min(100%, 28rem);
  display: none;
  justify-content: flex-end;
}

#pwa-install-banner.hidden {
  display: none !important;
}

@media (max-width: 767px) {
  .pwa-install-banner {
    display: flex;
  }
}

@media (max-width: 639px) {
  .pwa-install-banner {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    justify-content: center;
  }
}

@media (min-width: 640px) {
  .pwa-install-banner {
    right: 1.5rem;
  }
}

@media (min-width: 768px) {
  .pwa-install-banner {
    right: 2rem;
  }
}

.pwa-install-card {
  pointer-events: auto;
  width: 100%;
  max-width: 24rem;
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  column-gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 1.75rem;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    radial-gradient(circle at 90% -10%, rgba(46, 24, 24, 0.25), transparent 45%),
    linear-gradient(135deg, #ffffff 0%, #f9fafb 65%, #fef6f0 100%);
  box-shadow: 0 25px 60px -30px rgba(15, 23, 42, 0.7);
  transform-origin: bottom right;
  animation: pwa-card-pop 0.35s ease-out both;
}

.pwa-install-card::before {
  content: "";
  position: absolute;
  inset: -30% -10% 50% 55%;
  background: radial-gradient(circle, rgba(46, 24, 24, 0.16), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
  pointer-events: none;
}

.pwa-install-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(46, 24, 24, 0.08), transparent 55%);
  opacity: 0.4;
  z-index: 0;
  pointer-events: none;
}

.pwa-install-card:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 35px 75px -35px rgba(15, 23, 42, 0.8);
}

.pwa-install-card:hover::before {
  opacity: 1;
}

.pwa-install-card > * {
  position: relative;
  z-index: 1;
}

.pwa-install-card > img {
  height: 3.25rem;
  width: 3.25rem;
  border-radius: 0.35rem;
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7), 0 15px 35px -25px rgba(15, 23, 42, 0.8);
}

.pwa-install-card .flex-1 {
  display: flex;
  flex-direction: column;
}

.pwa-install-card .text-sm {
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: #111827;
}

.pwa-install-card .text-xs {
  font-size: 0.85rem;
  line-height: 1.4;
  color: #475467;
  margin-top: 0.15rem;
}

.pwa-install-card .mt-3 {
  margin-top: 1rem;
  gap: 0.75rem;
}

.pwa-install-card button {
  border-radius: 999px;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

#pwa-install-dismiss {
  border-color: rgba(15, 23, 42, 0.12);
  background-color: rgba(255, 255, 255, 0.9);
  color: #475467;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

#pwa-install-dismiss:hover {
  transform: translateY(-1px);
  background-color: #f8fafc;
  box-shadow: 0 6px 12px -8px rgba(15, 23, 42, 0.3);
}

#pwa-install-confirm {
  background-color: #2e1818;
  color: #ffffff;
  box-shadow: 0 12px 24px -12px rgba(46, 24, 24, 0.65);
}

#pwa-install-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px -12px rgba(46, 24, 24, 0.75);
}

@media (max-width: 420px) {
  .pwa-install-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .pwa-install-card > img {
    margin: 0 auto 0.75rem;
  }

  .pwa-install-card .mt-3 {
    flex-direction: column;
  }

  .pwa-install-card button {
    width: 100%;
  }
}

@keyframes pwa-card-pop {
  0% {
    opacity: 0;
    transform: translateY(1rem) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
