:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface2: #1a1a1a;
  --border: #222222;
  --accent: #e8ff00;
  --accent2: #ff6b35;
  --text: #f0f0f0;
  --text-muted: #666;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Syne', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(232,255,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232,255,0,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  animation: gridDrift 20s linear infinite;
}

@keyframes gridDrift {
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 60px 60px, 60px 60px; }
}

/* ===========================
   LAYOUT
=========================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.main {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  padding: 24px 0 60px;
  align-items: start;
}

/* ===========================
   HEADER
=========================== */
header {
  padding: 40px 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: headerDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes headerDrop {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.logo {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  position: relative;
  cursor: default;
}

.logo span { color: var(--accent); }

.logo::after {
  content: attr(data-text);
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--accent2);
  opacity: 0;
  clip-path: inset(0 100% 0 0);
}

.logo:hover::after {
  animation: glitchReveal 0.4s steps(8) forwards;
}

@keyframes glitchReveal {
  0%   { opacity: 0.6; clip-path: inset(40% 0 50% 0); }
  25%  { clip-path: inset(10% 0 80% 0); }
  50%  { clip-path: inset(70% 0 10% 0); }
  75%  { clip-path: inset(20% 0 60% 0); }
  100% { opacity: 0; clip-path: inset(0 100% 0 0); }
}

.badge {
  background: var(--accent);
  color: #000;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
  font-family: 'JetBrains Mono', monospace;
}

/* ===========================
   PANELS
=========================== */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: panelRise 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.1s both;
}

.qr-display {
  animation: panelRise 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) 0.2s both;
}

@keyframes panelRise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.count-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.3s;
}

.count-badge-pop {
  animation: badgePop 0.4s cubic-bezier(0.34, 1.8, 0.64, 1);
}

@keyframes badgePop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ===========================
   TYPE TABS (QR tipi seçici)
=========================== */
.type-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
  flex-wrap: wrap;
}

.type-tab {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  transition: all 0.2s;
}

.type-tab:hover {
  border-color: #444;
  color: var(--text);
}

.type-tab.active {
  background: rgba(232,255,0,0.08);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===========================
   TYPE FORMS
=========================== */
.type-form {
  display: none;
  padding: 12px 16px 16px;
}

.type-form.active {
  display: block;
}

/* ===========================
   LINK LIST
=========================== */
.link-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
}

.link-list::-webkit-scrollbar { width: 4px; }
.link-list::-webkit-scrollbar-track { background: transparent; }
.link-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.link-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  transition: border-color 0.2s, transform 0.2s;
  animation: slideIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
  cursor: pointer;
  position: relative;
}

.link-item:hover {
  border-color: #333;
  transform: translateX(2px);
}

.link-item.active {
  border-color: var(--accent);
  background: rgba(232,255,0,0.03);
}

.link-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  animation: barSlide 0.3s ease;
}

@keyframes barSlide {
  from { height: 0; opacity: 0; }
  to   { height: 60%; opacity: 1; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* QR Tipi rozeti */
.link-type-badge {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.link-info { overflow: hidden; }

.link-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
}

.icon-btn:hover { color: var(--text); border-color: #444; }

.icon-btn.danger:hover {
  color: #ff4444;
  border-color: #ff4444;
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%  { transform: translateX(-3px) rotate(-5deg); }
  75%  { transform: translateX(3px) rotate(5deg); }
}

/* ===========================
   EMPTY STATE
=========================== */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p { font-size: 14px; }

/* ===========================
   ADD SECTION (inputs)
=========================== */
.add-section {
  border-top: 1px solid var(--border);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.input-row-wifi {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  gap: 8px;
}

.input-row-vcard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.input-row-vcard .add-btn {
  grid-column: 1 / -1;
}

/* CSV */
.csv-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  resize: vertical;
  min-height: 90px;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(232,255,0,0.15);
}

.csv-btn { width: 100%; }

/* ===========================
   INPUTS GENEL
=========================== */
input[type="text"],
input[type="url"],
input[type="tel"],
input[type="email"],
input[type="password"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Syne', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(232,255,0,0.15);
}

input::placeholder { color: var(--text-muted); }

.select-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Syne', sans-serif;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.select-input:focus { border-color: var(--accent); }

/* ===========================
   BUTTONS
=========================== */
.add-btn {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.add-btn:hover {
  background: #fff;
  transform: translateY(-1px);
}

/* ===========================
   QR PANEL
=========================== */
.qr-panel {
  position: sticky;
  top: 24px;
}

.qr-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.qr-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.qr-body {
  padding: 32px 24px;
  text-align: center;
}

.qr-canvas-wrap {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: glowPulse 3s ease-in-out infinite;
  transition: box-shadow 0.3s;
}

.qr-canvas-wrap:hover {
  box-shadow: 0 0 60px rgba(232,255,0,0.2);
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 30px rgba(232,255,0,0.08); }
  50%       { box-shadow: 0 0 60px rgba(232,255,0,0.18); }
}

/* QR flip animasyonu */
.qr-flip {
  animation: qrFlip 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes qrFlip {
  0%   { opacity: 1; transform: rotateY(0deg) scale(1); }
  40%  { opacity: 0; transform: rotateY(90deg) scale(0.85); }
  60%  { opacity: 0; transform: rotateY(-90deg) scale(0.85); }
  100% { opacity: 1; transform: rotateY(0deg) scale(1); }
}

/* Scan sweep */
.qr-canvas-wrap.scanning::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: -4px;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: scanSweep 0.6s ease-in-out;
  pointer-events: none;
  z-index: 10;
}

@keyframes scanSweep {
  from { top: -4px; opacity: 1; }
  to   { top: 100%; opacity: 0; }
}

#qr-output { display: block; }

.qr-placeholder {
  width: 200px;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}

.qr-placeholder-icon {
  font-size: 48px;
  opacity: 0.2;
  animation: breathe 2.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.2; }
  50%       { transform: scale(1.12); opacity: 0.35; }
}

.qr-label {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.qr-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
  padding: 0 8px;
  margin-bottom: 20px;
  min-height: 32px;
}

/* ===========================
   QR OPTIONS
=========================== */
.qr-options {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-label {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.size-controls {
  display: flex;
  gap: 6px;
}

.size-btn {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.size-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(232,255,0,0.05);
}

.color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.color-pick:hover { border-color: #444; }

.color-pick input[type="color"] {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
  background: none;
}

.color-pick span {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.ec-controls { display: flex; gap: 6px; }

.ec-btn {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 4px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.ec-btn.active {
  border-color: var(--accent2);
  color: var(--accent2);
  background: rgba(255,107,53,0.05);
}

/* ===========================
   DOWNLOAD BUTTONS
=========================== */
.dl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.dl-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.dl-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.dl-btn.primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.dl-btn.primary:hover {
  background: #fff;
  border-color: #fff;
  color: #000;
}

/* ===========================
   BATCH SECTION
=========================== */
.batch-section {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: opacity 0.3s, transform 0.3s;
}

.batch-section.visible {
  animation: panelRise 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.batch-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.batch-dl-btn {
  background: var(--accent2);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  font-family: 'Syne', sans-serif;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.batch-dl-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.batch-dl-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.batch-grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
}

.batch-qr-item {
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.batch-qr-item:hover {
  transform: scale(1.08) translateY(-3px);
}

.batch-qr-inner {
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  overflow: hidden;
}

.batch-qr-inner canvas,
.batch-qr-inner img {
  width: 80px !important;
  height: 80px !important;
  display: block;
  flex-shrink: 0;
}

.batch-qr-name {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================
   RIPPLE
=========================== */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: rippleAnim 0.5s linear;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ===========================
   TOAST
=========================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent);
  color: #000;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  z-index: 999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Syne', sans-serif;
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 768px) {
  .main {
    grid-template-columns: 1fr;
  }

  .qr-panel { position: static; }

  .input-row,
  .input-row-wifi {
    grid-template-columns: 1fr;
  }

  .input-row-vcard {
    grid-template-columns: 1fr;
  }
}