/* Modern Reset & Base Styles */
:root {
  --primary: #7c3aed;
  --primary-light: #9867f9;
  --primary-dark: #6027c5;
  --secondary: #10b981;
  --secondary-light: #34d399;
  --secondary-dark: #059669;
  --background: #f8f7ff;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 0.75rem;
  --transition: 0.3s ease-in-out;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-elevated: #334155;
    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-tertiary: #9ca3af;
    --border: #334155;
  }
}

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

body {
  font-family:
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    Roboto,
    Oxygen,
    Ubuntu,
    Cantarell,
    'Open Sans',
    'Helvetica Neue',
    sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  background-image:
    radial-gradient(
      circle at 15% 50%,
      rgba(124, 58, 237, 0.05) 0%,
      transparent 25%
    ),
    radial-gradient(
      circle at 85% 30%,
      rgba(16, 185, 129, 0.05) 0%,
      transparent 25%
    );
  background-attachment: fixed;
  min-height: 100vh;
}

/* Layout */
.App {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 2rem;
  text-align: center;
}

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  width: 100%;
}

.hero-section::before {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  background: radial-gradient(
    circle,
    rgba(124, 58, 237, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
  top: -30px;
  left: 25%;
  z-index: -1;
}

.hero-section::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  background: radial-gradient(
    circle,
    rgba(16, 185, 129, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
  bottom: -20px;
  right: 25%;
  z-index: -1;
}

.App > h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  letter-spacing: -0.025em;
  position: relative;
  z-index: 1;
  line-height: 1.2;
}

.App > .subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 2rem;
  position: relative;
  z-index: 1;
}

.counters-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3rem;
  width: 100%;
  padding: 2rem 0;
  position: relative;
  z-index: 2;
}

/* Counter Components */
.counter-container {
  background-color: var(--surface);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow-md),
    0 0 0 1px rgba(0, 0, 0, 0.03);
  padding: 2.5rem;
  width: 100%;
  max-width: 360px;
  transition:
    transform var(--transition),
    box-shadow var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.counter-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  transform-origin: left;
}

.counter-container:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(0, 0, 0, 0.03),
    0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.options-counter::before {
  background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
}

.setup-counter::before {
  background: linear-gradient(
    90deg,
    var(--secondary-dark),
    var(--secondary-light)
  );
}

.counter-container h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-weight: 700;
  text-align: center;
}

.count-display {
  font-size: 4rem;
  font-weight: 800;
  margin: 1.5rem 0;
  text-align: center;
  color: var(--text-primary);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  padding: 0.5rem 1rem;
  width: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.count-display::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  background-color: rgba(0, 0, 0, 0.03);
  opacity: 0.7;
  z-index: -1;
}

.options-counter .count-display::before {
  background-color: rgba(124, 58, 237, 0.08);
}

.setup-counter .count-display::before {
  background-color: rgba(16, 185, 129, 0.08);
}

/* Number change animation */
.count-display.changing {
  transform: scale(1.2);
}

/* Button group update for 3 buttons */
.button-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  width: 100%;
}

.button-group button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    all var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 110px; /* Reduced to fit 3 buttons better */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  flex: 1;
}

/* Updated selectors for decrement and increment buttons */
.button-group button:nth-child(1)::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 12H4'%3E%3C/path%3E%3C/svg%3E");
}

.button-group button:nth-child(2)::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6v6m0 0v6m0-6h6m-6 0H6'%3E%3C/path%3E%3C/svg%3E");
}

/* Async button icon */
.button-group button:nth-child(3)::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15'%3E%3C/path%3E%3C/svg%3E");
}

/* Remove the original last-child selector as it's no longer accurate */
.button-group button:last-child::before {
  content: none;
}

/* Store Type Labels */
.store-type-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
}

.options-counter .store-type-badge {
  background-color: rgba(124, 58, 237, 0.15);
  color: var(--primary);
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.setup-counter .store-type-badge {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--secondary);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Animation for button clicks */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(10);
    opacity: 0;
  }
}

.button-group button {
  position: relative;
  overflow: hidden;
}

.button-group button::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition:
    transform 0.5s,
    opacity 1s;
}

.button-group button:active::after {
  transform: scale(0);
  opacity: 0.3;
  transition: 0s;
  animation: ripple 0.5s ease-out;
}

/* Footer */
.footer {
  margin-top: 4rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Responsive styles */
@media (max-width: 768px) {
  .App {
    padding: 2rem 1rem;
  }

  .counters-container {
    flex-direction: column;
    align-items: center;
  }

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

  .App > h1 {
    font-size: 2.5rem;
  }

  .App > .subtitle {
    font-size: 1rem;
  }
}

/* Improved Getters Section */
.getters-section {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background-color: rgba(0, 0, 0, 0.035);
  border-radius: var(--radius);
  font-size: 0.95rem;
  text-align: left;
  width: 100%;
  position: relative;
  backdrop-filter: blur(5px);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}

.options-counter .getters-section {
  background-color: rgba(124, 58, 237, 0.06);
  border: 1px solid rgba(124, 58, 237, 0.1);
}

.setup-counter .getters-section {
  background-color: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.1);
}

.getters-section:before {
  content: 'Computed Values';
  position: absolute;
  top: -10px;
  left: 15px;
  background-color: var(--surface);
  padding: 0 10px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.options-counter .getters-section:before {
  color: var(--primary);
}

.setup-counter .getters-section:before {
  color: var(--secondary);
}

.getters-section p {
  margin: 0.75rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding-bottom: 0.75rem;
}

.getters-section p:not(:last-child) {
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.getters-section strong {
  color: var(--text-secondary);
  margin-right: 1rem;
  font-weight: 600;
  flex-shrink: 0;
}

.getters-section span {
  font-weight: 600;
  color: var(--text-primary);
}

.options-counter .getters-section span {
  color: var(--primary-dark);
}

.setup-counter .getters-section span {
  color: var(--secondary-dark);
}

/* Improved Loading Button */
button.loading {
  position: relative;
  cursor: wait;
  opacity: 0.8;
  color: transparent !important;
}

button.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  animation: button-loading-spinner 0.8s linear infinite;
}

.options-counter button.loading::after {
  border-top-color: white;
}

.setup-counter button.loading::after {
  border-top-color: white;
}

@keyframes button-loading-spinner {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Fix for button group responsiveness */
@media (max-width: 400px) {
  .button-group {
    flex-direction: column;
  }

  .button-group button {
    width: 100%;
  }
}

/* Fix for missing button styles */
.options-counter .button-group button {
  background-color: var(--primary);
}

.options-counter .button-group button:hover {
  background-color: var(--primary-light);
  box-shadow: 0 10px 15px -3px rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

.setup-counter .button-group button {
  background-color: var(--secondary);
}

.setup-counter .button-group button:hover {
  background-color: var(--secondary-light);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
  transform: translateY(-2px);
}

.button-group button:active {
  transform: scale(0.95) !important;
}
