@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
  --primary: #222222;
  --primary-hover: #333333;
  --secondary: #444444;
  --bg-dark: #0a0a0a;
  --bg-input: #171717;
  --bg-card: #1f1f1f;
  --text-white: #ffffff;
  --text-muted: white;
  --border: #262626;
  --accent: #ffffff;
  --pointer-color: #ffffff;
  --font-family: 'Outfit', sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
}

*:focus,
*:active,
*:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #666;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1rem;
  overflow-y: auto;
}

#app {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  z-index: 1;
}

header {
  text-align: center;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 0.5rem;
}

header p {
  color: var(--text-muted);
  padding-bottom: 1.5rem;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex: initial;
}

.action-btn.secondary {
  background: var(--primary);
  color: white;
  border: 1px solid var(--border);
}

.action-btn.secondary:hover {
  background: var(--primary-hover);
}

.action-btn.delete {
  background: #ef4444 !important;
  color: white !important;
}

.action-btn.delete:hover {
  background: #dc2626 !important;
}

.hidden {
  display: none !important;
}

.primary-btn {
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background-color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.view,
#main-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.primary-btn:hover {
  background-color: var(--primary-hover);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.15;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(1);
  pointer-events: none;
}

.secondary-btn {
  padding: 0.7rem 1.5rem;
  background: var(--primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn:hover {
  background: var(--primary-hover);
}


.deck-management {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  width: 100%;
}

.card-list-header h3 {
  text-align: left;
  padding-bottom: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

@media (max-width: 640px) {
  .deck-management {
    flex-direction: column;
    text-align: center;
  }
}

.manage-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  align-self: stretch;
}

.add-card-form {
  background: var(--bg-input);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  width: 100%;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 8px;
  color: white;
  outline: none;
  font-family: inherit;
  font-size: 1rem;
}

input:focus {
  border-color: var(--primary-hover);
}

.input-error {
  border-color: #ef4444 !important;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

.color-picker-wrapper label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.color-input-pill {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem;
  padding-right: 1.2rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  cursor: pointer;
}

.color-input-pill:hover {
  border-color: var(--primary-hover);
}

.color-input-pill input[type="color"] {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-input-pill input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-pill input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.color-input-pill input[type="text"] {
  background: none;
  border: none;
  padding: 0;
  width: 75px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-white);
  text-transform: uppercase;
}

.color-input-pill input[type="text"]:focus {
  border: none;
  outline: none;
  color: #fff;
}

@media (max-width: 480px) {
  .options-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 450px;
  overflow-y: auto;
  width: 100%;
}

.card-item {
  background: var(--bg-card);
  padding: 1.2rem;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  gap: 1.5rem;
  width: 100%;
}

.card-item-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.card-item-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.card-item-text span {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.card-item-actions {
  display: flex;
  gap: 0.6rem;
  flex-shrink: 0;
}

.edit-btn {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.edit-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--text-muted);
}

.delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.delete-btn:hover {
  background: #ef4444;
  color: white;
}

@media (max-width: 640px) {
  #app {
    padding: 1rem;
    margin-top: 80px;
  }

  .tab-item {
    padding: 0 0.8rem;
    font-size: 0.85rem;
  }
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #111111;
  padding: 2.5rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  max-width: 450px;
  width: 90%;
  text-align: center;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--text-white);
}

.modal-content p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.1rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.modal-actions button {
  padding: 0.7rem 1rem !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  height: auto !important;
  flex: 1;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #10b981;
  color: white;
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  font-weight: 600;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.toast.active {
  transform: translateX(-50%) translateY(0);
}

@media (prefers-color-scheme: light) {
  :root {
    --primary: #000000;
    --primary-hover: #333333;
    --secondary: #f0f0f0;
    --bg-dark: #ffffff;
    --bg-input: #ffffff;
    --bg-card: #ffffff;
    --text-white: #000000;
    --text-muted: #555555;
    --border: #d0d0d0;
    --pointer-color: #000000;
    --accent: #000000;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  }

  body {
    background-color: var(--bg-dark);
    color: var(--text-white);
  }

  .tabs-container {
    background: #e0e0e0 !important;
  }

  .tab-item {
    background: #e0e0e0 !important;
    color: #444444 !important;
  }

  .tab-item.active {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #dddddd !important;
    border-bottom: none !important;
  }

  .modal {
    background: rgba(255, 255, 255, 0.8) !important;
  }

  .modal-content {
    background: #ffffff !important;
    border: 1px solid #dddddd !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
  }

  .modal-content h2,
  .modal-content p {
    color: #000000 !important;
  }

  .primary-btn,
  .secondary-btn,
  .action-btn.secondary,
  .edit-btn {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 1px solid #333 !important;
  }

  .card-item {
    background: #ffffff !important;
    border: 1px solid #dddddd !important;
  }

  input {
    background: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #bbbbbb !important;
  }
}

.qr-result-wrapper {
  background: var(--bg-input);
  padding: 3rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  width: 100%;
  margin-top: 2rem;
  transition: all 0.4s ease;
}

#qrcode {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

#qrcode img,
#qrcode canvas {
  max-width: 100%;
  height: auto !important;
}

.qr-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.qr-actions button {
  flex: 1;
}