/* ==========================================================================
   Mayor of Chicago - Helper / Resource Tracker CSS
   ========================================================================== */

:root {
  --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Playfair Display', Georgia, serif;
  
  --bg-main: #f8fafc;
  --card-border: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 6px 24px rgba(15, 23, 42, 0.08);
  
  --text-primary: #000000;
  --text-secondary: #000000;
  
  --bg-vote: rgb(160, 200, 92);       /* Green */
  --bg-popularity: rgb(230, 150, 125); /* Red */
  --bg-money: rgb(240, 220, 90);      /* Yellow */
  --bg-booze: rgb(200, 160, 200);     /* Purple */
  --bg-power: rgb(170, 170, 170);     /* Gray */
  --bg-corruption: rgb(170, 200, 230);/* Corruption */
  
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(253, 224, 71, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(252, 165, 165, 0.15) 0%, transparent 40%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  touch-action: manipulation;
}

.app-container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header Styling - Desktop Default */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.header-title-wrap h1 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #000000;
}

.header-title-wrap .subtitle {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #b45309;
  text-transform: uppercase;
  margin-top: 1px;
}

.reset-button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #000000;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-button svg {
  width: 20px;
  height: 20px;
}

.reset-button:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.reset-button:active {
  transform: scale(0.95);
}

/* Counters Grid - Desktop Default (3 Columns) */
.counters-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* Counter Card Styling - Desktop Default */
.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

/* Div Backgrounds by Resource */
.card-vote { background-color: var(--bg-vote); }
.card-popularity { background-color: var(--bg-popularity); }
.card-money { background-color: var(--bg-money); }
.card-booze { background-color: var(--bg-booze); }
.card-power { background-color: var(--bg-power); }
.card-corruption { background-color: var(--bg-corruption); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  background: #ffffff;
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  width: 100%;
}

.card-header .icon {
  font-size: 1.5rem;
  line-height: 1;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #000000;
  text-transform: capitalize;
}

.counter-display {
  margin: 6px 0 14px 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.counter-display .value {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
  color: #000000;
  transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Value change pulse animation */
.value.bump-up {
  animation: bumpUp 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.value.bump-down {
  animation: bumpDown 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bumpUp {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes bumpDown {
  0% { transform: scale(1); }
  50% { transform: scale(0.8); }
  100% { transform: scale(1); }
}

/* Control Buttons Styling - Desktop Default */
.controls {
  display: flex;
  width: 100%;
  gap: 10px;
}

.btn {
  flex: 1;
  height: 54px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.45);
  color: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.btn svg {
  width: 28px;
  height: 28px;
  stroke: #000000;
}

.btn:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.3);
}

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

.btn-minus:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(220, 38, 38, 0.4);
}

.btn-plus:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(22, 163, 74, 0.4);
}

/* Touch feedback ripple */
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}

.btn:active::after {
  transform: translate(-50%, -50%) scale(2);
  opacity: 1;
  transition: 0s;
}

/* Modal Styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
  text-align: center;
}

.modal-content h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: #000000;
}

.modal-content p {
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 20px;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.modal-btn.cancel {
  background: #f1f5f9;
  color: #000000;
  border: 1px solid #cbd5e1;
}

.modal-btn.cancel:hover {
  background: #e2e8f0;
}

.modal-btn.confirm {
  background: #ef4444;
  color: #ffffff;
}

.modal-btn.confirm:hover {
  background: #dc2626;
}

/* Mobile Screens Only (< 640px width - e.g. iPhone 15) */
@media (max-width: 639px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body {
    padding: 8px 8px 16px 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .app-container {
    width: 100%;
    max-width: 100%;
    gap: 6px;
    display: flex;
    flex-direction: column;
  }

  .app-header {
    padding: 6px 10px;
    border-radius: 10px;
  }

  .header-title-wrap h1 {
    font-size: 1.1rem;
    line-height: 1.1;
  }

  .header-title-wrap .subtitle {
    font-size: 0.58rem;
    letter-spacing: 2px;
  }

  .reset-button {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  .reset-button svg {
    width: 14px;
    height: 14px;
  }

  .counters-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .card {
    padding: 6px 6px 8px 6px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .card-header {
    padding: 3px 6px;
    margin-bottom: 2px;
    gap: 4px;
    border-radius: 6px;
    width: 100%;
  }

  .card-header .icon {
    font-size: 1.1rem;
  }

  .card-header h2 {
    font-size: 0.82rem;
  }

  .counter-display {
    margin: 2px 0 4px 0;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .counter-display .value {
    font-size: 2.2rem;
    line-height: 1;
  }

  .controls {
    gap: 6px;
    width: 100%;
  }

  .btn {
    height: 38px;
    border-radius: 8px;
    touch-action: manipulation;
  }

  .btn svg {
    width: 20px;
    height: 20px;
  }
}
