/* Számláló — domi29.hu */

:root {
  --bg: #060608;
  --surface: rgba(12, 12, 16, 0.97);
  --surface-2: rgba(20, 20, 28, 0.95);
  --surface-hover: rgba(20, 20, 28, 0.97);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);
  --border-strong: var(--border-hover);
  --text-primary: #f0f0f4;
  --text-secondary: #8b8b9e;
  --text-muted: #52526a;
  --green: #22c55e;
  --blue: #3b82f6;
  --orange: #f97316;
  --purple: #a855f7;
  --red: #ef4444;
  --yellow: #eab308;
  --dot-red: #ff5f57;
  --dot-yellow: #ffbd2e;
  --dot-green: #28c840;
  --text: var(--text-primary);
  --accent: var(--blue);
  --accent-dim: rgba(59, 130, 246, 0.14);
  --accent-glow: rgba(59, 130, 246, 0.35);
  --success: var(--green);
  --success-dim: rgba(34, 197, 94, 0.12);
  --info: var(--blue);
  --info-dim: rgba(59, 130, 246, 0.12);
  --danger: var(--red);
  --danger-dim: rgba(239, 68, 68, 0.12);
  --on-accent: var(--bg);
  --font-sans: "Inter", -apple-system, sans-serif;
  --font-mono: "Space Mono", monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) var(--bg);
}

/* Háttér — link oldallal megegyező */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 20%, transparent 75%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse 55% 45% at 15% 20%,
      rgba(59, 130, 246, 0.12),
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 40% at 85% 75%,
      rgba(34, 197, 94, 0.07),
      transparent 70%
    );
}

/* App shell */
.app {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 28px);
  animation: fade-up 0.6s var(--ease) both;
}

.site-home {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.site-home:hover .site-home__sub {
  color: var(--text-primary);
}

.site-home:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 8px;
}

.site-home__logo {
  flex-shrink: 0;
  border-radius: 8px;
}

.site-home__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-home__name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.site-home__sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 8px;
}

.topbar__stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.topbar__stat-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.topbar__stat-label {
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Main grid */
.app-main {
  display: grid;
  gap: clamp(16px, 2.5vw, 20px);
  flex: 1;
}

@media (min-width: 768px) {
  .app-main {
    grid-template-columns: minmax(260px, 320px) 1fr;
    grid-template-rows: auto 1fr;
    align-items: start;
  }

  .panel--create {
    grid-row: span 2;
  }

  .panel--log {
    grid-column: 2;
  }
}

@media (min-width: 1024px) {
  .app-main {
    grid-template-columns: 300px 1fr 280px;
  }

  .panel--log {
    grid-column: 3;
    grid-row: 1 / -1;
  }

  .panel--list {
    grid-column: 2;
  }
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: clamp(20px, 3vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel__head--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 6px;
}

.panel__title {
  font-size: clamp(1.15rem, 2.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.panel__desc {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.panel--list {
  min-height: 200px;
}

/* Form */
.create-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.field__optional {
  font-weight: 400;
  color: var(--text-muted);
}

.field__input {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.field__input::placeholder {
  color: var(--text-muted);
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition:
    background 0.2s var(--ease),
    transform 0.15s var(--ease),
    box-shadow 0.2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn--block {
  width: 100%;
  padding: 14px 20px;
}

.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn--primary:hover {
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn__icon {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}

.btn--icon {
  width: 44px;
  height: 44px;
  padding: 0;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 500;
}

.btn--icon:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.btn--icon.btn--plus {
  background: var(--accent-dim);
  border-color: rgba(59, 130, 246, 0.35);
  color: var(--accent);
}

.btn--icon.btn--plus:hover {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

.btn--icon.btn--danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.btn--icon.btn--danger:hover {
  background: var(--danger-dim);
  border-color: var(--danger);
}

/* Counter grid */
.counter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.counter-grid:has(.counter-card) .empty-state {
  display: none;
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(32px, 6vw, 48px) 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
}

.empty-state__icon {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state__title {
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state__hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 28ch;
}

/* Counter card */
.counter-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: card-in 0.45s var(--ease) both;
  transition:
    border-color 0.2s,
    transform 0.3s var(--ease),
    opacity 0.3s;
}

.counter-card:hover {
  border-color: var(--border-strong);
}

.counter-card__head {
  min-width: 0;
}

.counter-card__name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.counter-card__desc {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.counter-card__value-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}

.counter-card__value {
  font-family: var(--font-mono);
  font-size: clamp(2.5rem, 8vw, 3.25rem);
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition:
    transform 0.2s var(--ease),
    opacity 0.2s;
}

.counter-card__value.is-pulse {
  transform: scale(1.08);
  color: var(--accent);
}

.counter-card__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Activity log */
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--success);
  padding: 4px 10px;
  background: var(--success-dim);
  border-radius: 999px;
  flex-shrink: 0;
}

.live-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2s ease-in-out infinite;
}

.log-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(320px, 40vh);
  overflow-y: auto;
  padding-right: 4px;
}

@media (min-width: 1024px) {
  .panel--log {
    max-height: calc(100dvh - 120px);
  }

  .log-feed {
    max-height: none;
    flex: 1;
    min-height: 200px;
  }
}

.log-entry {
  display: flex;
  gap: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
  animation: log-in 0.35s var(--ease) both;
}

.log-entry__time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  min-width: 58px;
}

.log-entry__msg {
  color: var(--text-secondary);
  word-break: break-word;
}

.log-entry--create .log-entry__msg {
  color: var(--success);
}

.log-entry--update .log-entry__msg {
  color: var(--info);
}

.log-entry--delete .log-entry__msg {
  color: var(--danger);
}

.log-entry--system .log-entry__msg {
  font-style: italic;
}

/* Animations */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes log-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
