:root {
  --color-bg: #f5f7fb;
  --color-surface: #ffffff;
  --color-text: #162033;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --color-primary: #2563eb;
  --color-secondary: #9333ea;
  --color-accent: #d4af37;
  --color-danger: #dc2626;
  --shadow-soft: 0 18px 36px rgba(15, 23, 42, 0.12);
  --shadow-card: 0 16px 28px rgba(15, 23, 42, 0.16);
  --radius-lg: 22px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 34rem),
    linear-gradient(180deg, #eef2f7 0, #f8fafc 44rem);
  color: var(--color-text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-header {
  min-height: 200px;
  padding: 36px 20px 52px;
  color: #ffffff;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.22), transparent 24rem),
    linear-gradient(115deg, #2563eb 0%, #8b2df4 52%, #183a9f 100%);
}

.header-content {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: left;
}

.logo-ring {
  width: 98px;
  height: 98px;
  border-radius: 999px;
  background: #0b1020;
  display: grid;
  place-items: center;
  box-shadow: 0 20px 32px rgba(15, 23, 42, 0.28);
  flex: 0 0 auto;
}

.app-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1;
  letter-spacing: 0;
  font-weight: 900;
}

.hero-copy p {
  margin: 12px 0 0;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.86);
}

.app-shell {
  width: min(1320px, calc(100% - 48px));
  margin: -16px auto 42px;
}

.stats-section {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
}

.stat-card,
.controls-section,
.stickers-panel,
.form-panel {
  background: var(--color-surface);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  min-height: 190px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card:nth-child(1) {
  background: linear-gradient(135deg, #eff6ff, #e8f0ff);
}

.stat-card:nth-child(2) {
  background: linear-gradient(135deg, #ecfdf5, #e8fff4);
}

.stat-card:nth-child(3) {
  background: linear-gradient(135deg, #f3f4f6, #f8fafc);
}

.stat-card:nth-child(4) {
  background: linear-gradient(135deg, #fffbeb, #fff7d6);
}

.progress-card {
  background: linear-gradient(135deg, #f5f3ff, #f1edff);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 900;
}

.stat-card:nth-child(2) .stat-icon {
  background: linear-gradient(135deg, #10b981, #059669);
}

.stat-card:nth-child(3) .stat-icon {
  background: linear-gradient(135deg, #6b7280, #4b5563);
}

.stat-card:nth-child(4) .stat-icon {
  background: linear-gradient(135deg, #d4af37, #c89416);
}

.progress-card .stat-icon {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-label {
  color: #344054;
  font-size: 1rem;
  font-weight: 800;
}

.stat-value {
  font-size: 2.45rem;
  line-height: 1;
  font-weight: 900;
  color: #2563eb;
}

.stat-card:nth-child(2) .stat-value {
  color: #10b981;
}

.stat-card:nth-child(3) .stat-value {
  color: #667085;
}

.stat-card:nth-child(4) .stat-value {
  color: #d4af37;
}

.progress-card .stat-value {
  color: #8b5cf6;
}

.controls-section {
  margin-top: 40px;
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) minmax(150px, 0.75fr) minmax(150px, 0.75fr) minmax(130px, 0.6fr);
  gap: 14px;
  align-items: end;
}

.control-group,
.sticker-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #344054;
  font-size: 0.92rem;
  font-weight: 800;
}

.search-control {
  position: relative;
}

.search-control::before {
  content: "";
  position: absolute;
  left: 18px;
  bottom: 17px;
  width: 18px;
  height: 18px;
  border: 2px solid #98a2b3;
  border-radius: 999px;
  pointer-events: none;
}

.search-control::after {
  content: "";
  position: absolute;
  left: 33px;
  bottom: 14px;
  width: 9px;
  height: 2px;
  background: #98a2b3;
  rotate: 45deg;
  pointer-events: none;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--color-text);
  padding: 14px 15px;
  outline: none;
}

.search-control input {
  min-height: 64px;
  padding-left: 62px;
  font-size: 1.08rem;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.pill-control select,
#sortSelect,
#orderSelect {
  font-weight: 800;
}

.content-layout {
  margin-top: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.65fr);
  gap: 24px;
  align-items: start;
}

.stickers-panel,
.form-panel {
  padding: 26px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2,
.form-panel h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 900;
}

.section-note {
  color: var(--color-muted);
  font-size: 0.95rem;
  font-weight: 700;
}

.message-container {
  min-height: 0;
  margin-bottom: 16px;
}

.message-container:not(:empty) {
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-weight: 800;
}

.message-container.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.24);
}

.message-container.error {
  background: #fff1f0;
  color: var(--color-danger);
  border: 1px solid rgba(220, 38, 38, 0.22);
}

.message-container.success {
  background: #ecfdf3;
  color: #027a48;
  border: 1px solid rgba(2, 122, 72, 0.22);
}

.stickers-grid {
  min-height: 320px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 28px;
}

.empty-message {
  grid-column: 1 / -1;
  min-height: 240px;
  margin: 0;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  color: var(--color-muted);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  font-weight: 800;
}

.sticker-card {
  --team-primary: #3b82f6;
  --team-secondary: #eff6ff;
  --team-accent: #1e3a8a;
  position: relative;
  min-height: 340px;
  overflow: hidden;
  padding: 26px 28px 22px;
  border: 3px solid var(--team-primary);
  border-bottom-width: 6px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, var(--team-primary) 0%, var(--team-secondary) 48%, #ffffff 49%, var(--team-secondary) 100%);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #182235;
}

.sticker-card::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 14px;
  pointer-events: none;
}

.sticker-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 42%, rgba(255, 255, 255, 0.18));
  pointer-events: none;
}

.sticker-card.missing {
  --team-primary: #9ca3af;
  --team-secondary: #e5e7eb;
  --team-accent: #6b7280;
  filter: grayscale(0.5);
  background: linear-gradient(135deg, #d1d5db 0%, #f3f4f6 52%, #d1d5db 100%);
  border-color: #9ca3af;
  color: #344054;
}

.sticker-card.duplicate {
  border-color: var(--color-accent);
  box-shadow: 0 18px 32px rgba(212, 175, 55, 0.28);
}

.sticker-code-bubble,
.duplicate-ribbon,
.status-label,
.sticker-number,
.sticker-name,
.sticker-country,
.sticker-position,
.sticker-quantity-row,
.sticker-actions {
  position: relative;
  z-index: 1;
}

.sticker-code-bubble {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--team-accent);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.22);
}

.sticker-card.duplicate .sticker-code-bubble,
.sticker-card.fwc .sticker-code-bubble {
  background: var(--color-accent);
  color: #111827;
}

.duplicate-ribbon {
  position: absolute;
  top: 18px;
  right: 12px;
  border-radius: 999px;
  background: var(--color-accent);
  color: #111827;
  padding: 7px 13px;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.18);
}

.sticker-number {
  margin-top: 10px;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  color: #111827;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sticker-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.74);
}

.sticker-country {
  margin: 0;
  color: var(--team-accent);
  font-size: 1.15rem;
  font-weight: 900;
}

.sticker-position {
  margin: 6px 0 0;
  color: #334155;
  font-weight: 800;
}

.sticker-quantity {
  display: inline-grid;
  min-width: 42px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 5px 10px;
  color: var(--team-accent);
  font-weight: 900;
}

.sticker-quantity-row {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
  font-weight: 800;
}

.status-label {
  align-self: center;
  border-radius: 999px;
  background: var(--team-accent);
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sticker-card.missing .status-label {
  background: #f8fafc;
  color: #475569;
}

.sticker-card.duplicate .status-label,
.sticker-card.duplicate .duplicate-ribbon {
  background: var(--color-accent);
  color: #111827;
}

.sticker-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.sticker-action-button {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 900;
  font-size: 0.92rem;
}

.edit-action {
  background: rgba(255, 255, 255, 0.78);
  color: var(--team-accent);
}

.edit-action:hover {
  background: #ffffff;
}

.delete-action {
  width: 48px;
  color: #ffffff;
  background: #dc5661;
}

.delete-action:hover {
  background: #be3140;
}

.pagination-controls {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--color-muted);
  font-weight: 800;
  text-align: center;
}

.limit-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.limit-control select {
  width: auto;
  min-width: 78px;
}

.sticker-form {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.form-panel {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.06), transparent 140px),
    #ffffff;
}

.form-panel.editing {
  border-color: rgba(212, 175, 55, 0.85);
  box-shadow: 0 18px 36px rgba(212, 175, 55, 0.18);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  background: linear-gradient(135deg, #2563eb, #a21caf);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(124, 58, 237, 0.28);
}

.primary-button:hover {
  filter: brightness(1.05);
}

.secondary-button {
  background: #f1f5f9;
  color: var(--color-text);
}

.secondary-button:hover {
  background: #e2e8f0;
}

.button:disabled {
  background: #eef2f6;
  color: #98a2b3;
  box-shadow: none;
  cursor: not-allowed;
}

.app-footer {
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  text-align: center;
  padding: 24px 16px;
  font-weight: 700;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.app-footer p {
  margin: 0;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  background: #111827;
  color: #ffffff;
  padding: 12px 18px;
  text-decoration: none;
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(15, 23, 42, 0.18);
}

.github-link:hover {
  background: #2563eb;
}

.github-link img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

@media (max-width: 1100px) {
  .stats-section {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .controls-section,
  .content-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 28px, 1320px);
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .stats-section {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 138px;
  }

  .stickers-grid {
    grid-template-columns: 1fr;
  }

  .sticker-card {
    min-height: 310px;
  }
}
