/* Base styles */
:root {
  --primary-color: #e3350d;
  --secondary-color: #30a7d7;
  --background-color: #f5f5f5;
  --text-color: #333;
  --border-color: #ddd;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
}

/* Navbar */
.navbar {
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--primary-color);
  text-decoration: none;
}

.navbar-links {
  display: flex;
  gap: 0.25rem;
}

.navbar-link {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.navbar-link:hover {
  background-color: var(--background-color);
}

.navbar-link.active {
  color: var(--primary-color);
  font-weight: 600;
}

.navbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-user {
  font-size: 0.85rem;
  color: #666;
}

/* Authentication pages */
.welcome-container {
  max-width: 600px;
  margin: 100px auto;
  padding: 2rem;
  text-align: center;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-buttons {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
}

/* Dashboard */
.dashboard-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.dashboard-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-card h2 {
  margin-top: 0;
  color: var(--primary-color);
}

.card-count, .deck-count {
  font-size: 2rem;
  font-weight: bold;
  margin: 1rem 0;
}

.card-actions, .deck-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

/* Scanner Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 90%;
  width: 500px;
  text-align: center;
}

/* Importing list */
.importing-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.importing-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  color: var(--text-color);
}

.importing-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.importing-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: #666;
}

.importing-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
}

.import-actions {
  display: flex;
  gap: 1rem;
}

.import-actions .btn {
  flex: 1;
}

#scanner-video {
  width: 100%;
  max-width: 400px;
  margin: 1rem auto;
  border-radius: 4px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  box-sizing: border-box;
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary:hover {
  background-color: #c62f0c;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background-color: #2891bc;
}

/* Auth container */
.auth-container {
  max-width: 480px;
  margin: 60px auto;
  padding: 2rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.auth-container h1 {
  text-align: center;
  color: var(--primary-color);
  margin-top: 0;
  margin-bottom: 1.5rem;
}

/* Form elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(48, 167, 215, 0.2);
}

.form-hint {
  display: block;
  font-size: 0.85rem;
  font-style: italic;
  color: #888;
  margin-top: 0.25rem;
}

.form-error {
  display: block;
  font-size: 0.85rem;
  color: var(--primary-color);
  margin-top: 0.25rem;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.form-check input[type="checkbox"] {
  accent-color: var(--primary-color);
}

.form-actions {
  margin-top: 1.5rem;
}

.form-actions .btn {
  width: 100%;
}

/* Auth links */
.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.auth-links a {
  display: block;
  color: var(--secondary-color);
  text-decoration: none;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.auth-links a:hover {
  text-decoration: underline;
}

/* Flash messages */
.flash {
  max-width: 480px;
  margin: 1rem auto;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  text-align: center;
}

.flash-notice {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.flash-alert {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Form errors block */
.form-errors {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.form-errors h3 {
  margin-top: 0;
  font-size: 0.95rem;
}

.form-errors ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

/* Danger action */
.btn-danger {
  color: var(--primary-color);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
}

.btn-danger:hover {
  color: #c62f0c;
}

.badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 500;
}

.badge-warning {
  background: #fff3cd;
  color: #856404;
}

.badge-success {
  background: #d4edda;
  color: #155724;
}

.badge-danger {
  background: #f8d7da;
  color: #721c24;
}

/* Result modal */
.result-modal {
  border: none;
  border-radius: 12px;
  padding: 2rem;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.result-modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.result-modal-content h2 {
  margin: 0 0 1.5rem;
}

.result-type-buttons {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.result-type-btn {
  flex: 1;
  padding: 0.6rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.15s;
}

.result-type-btn.active {
  color: white;
}

.result-win.active { background: #28a745; border-color: #28a745; }
.result-loss.active { background: #dc3545; border-color: #dc3545; }
.result-draw.active { background: #6c757d; border-color: #6c757d; }
.result-timeout.active { background: #fd7e14; border-color: #fd7e14; }

.archetype-search-results {
  position: relative;
}

.archetype-search-item {
  padding: 0.5rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archetype-search-item:hover {
  background: #f0f0f0;
}

.archetype-search-pokemon {
  color: #888;
  font-size: 0.85em;
}

.result-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.result-modal-actions .btn {
  flex: 1;
  text-align: center;
}

.archetype-create-item {
  color: #2563eb;
  border-top: 2px solid #eee;
}

.create-archetype-section {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

/* Decks list */
.decks-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.decks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.decks-header h1 {
  margin: 0;
}

.decks-header-actions {
  display: flex;
  gap: 0.5rem;
}

.decks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.deck-item {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  transition: box-shadow 0.2s;
}

.deck-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.deck-item-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.deck-item h2 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.2rem;
  padding-right: 5rem;
}

.deck-description {
  color: #666;
  font-size: 0.9rem;
}

.deck-card-count {
  font-weight: 600;
  color: var(--secondary-color);
}

.deck-item-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

/* Deck show */
.deck-show-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.deck-show-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.deck-show-header h1 {
  margin: 0;
}

.deck-show-description {
  color: #666;
  margin-top: 0.25rem;
}

.deck-actions-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.deck-show-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 1rem 1.5rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.85rem;
  color: #666;
}

.deck-section {
  margin-bottom: 1.5rem;
}

.deck-section h2 {
  font-size: 1.1rem;
  color: var(--secondary-color);
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 0.5rem;
}

.deck-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.deck-card-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.deck-card-qty {
  font-weight: 600;
  min-width: 2rem;
  color: var(--primary-color);
}

.deck-card-name {
  flex: 1;
}

.deck-card-set {
  font-size: 0.85rem;
  color: #999;
}

/* Deck show layout */
.deck-show-content {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.deck-show-main {
  flex: 1;
  min-width: 0;
}

.deck-show-preview {
  width: 300px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
}

.card-preview-image {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.deck-card-item {
  cursor: pointer;
}

.deck-card-item:hover {
  background-color: #f0f7ff;
}

.deck-card-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 4.5rem;
}

.qty-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: white;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  padding: 0;
  transition: background-color 0.2s, border-color 0.2s;
}

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

.card-preview-link {
  display: block;
  text-align: center;
  margin-top: 0.75rem;
  color: var(--secondary-color);
  font-size: 0.9rem;
}

/* Card show */
.card-show-container {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.card-show-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.card-show-header h1 {
  margin: 0;
}

.card-show-content {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.card-show-image {
  width: 350px;
  flex-shrink: 0;
}

.card-full-image {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.card-show-details {
  flex: 1;
  min-width: 0;
}

.card-info-section {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.card-info-section h2 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.1rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.card-info-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

.card-info-list dt {
  font-weight: 600;
  color: #666;
}

.card-info-list dd {
  margin: 0;
}

.card-move {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
}

.card-move:last-child {
  border-bottom: none;
}

.card-move-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-move-cost {
  font-size: 0.85rem;
  color: #666;
}

.card-move-damage {
  font-weight: bold;
  color: var(--primary-color);
  margin-left: auto;
}

.alt-printings {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.alt-printing-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  width: 120px;
  transition: transform 0.2s;
}

.alt-printing-item:hover {
  transform: scale(1.05);
}

.alt-printing-image {
  width: 120px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alt-printing-set {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  color: #666;
  text-align: center;
}

/* Card search */
.deck-card-search {
  position: relative;
  margin-bottom: 1.5rem;
}

.card-search-input {
  max-width: 400px;
}

.card-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  width: 400px;
  max-height: 400px;
  overflow-y: auto;
  background: white;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 50;
}

.card-search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #eee;
}

.card-search-result-item:hover {
  background-color: #f0f7ff;
}

.card-search-result-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.card-search-result-name {
  font-weight: 500;
}

.card-search-result-set {
  font-size: 0.8rem;
  color: #999;
}

.card-search-result-type {
  font-size: 0.75rem;
  color: white;
  background: var(--secondary-color);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

.card-search-add-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--primary-color);
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.card-search-add-btn:hover {
  background: #c62f0c;
}

.card-search-empty {
  padding: 0.75rem;
  color: #666;
  font-size: 0.9rem;
}

/* Cards index */
.cards-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.cards-container > h1 {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.cards-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.sets-sidebar {
  width: 250px;
  flex-shrink: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  box-sizing: border-box;
}

.sets-block {
  margin-bottom: 1rem;
}

.sets-block:last-child {
  margin-bottom: 0;
}

.sets-block-name {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-color);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-color);
}

.sets-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sets-list li a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.5rem;
  text-decoration: none;
  color: var(--text-color);
  border-radius: 4px;
  font-size: 0.85rem;
  transition: background-color 0.2s;
}

.sets-list li a:hover {
  background-color: var(--background-color);
}

.sets-list li.active a {
  background-color: var(--primary-color);
  color: white;
}

.set-full-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.set-code {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-left: 0.5rem;
  white-space: nowrap;
}

.cards-grid-area {
  flex: 1;
  min-width: 0;
}

.cards-grid-area h2 {
  margin-top: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.card-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-color);
  transition: transform 0.2s;
}

.card-grid-item:hover {
  transform: scale(1.05);
}

.card-grid-image {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-grid-name {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  text-align: center;
}

.card-grid-number {
  font-size: 0.7rem;
  color: #999;
}

.cards-empty {
  color: #666;
  font-size: 1.1rem;
}

/* Deck form */
.deck-form-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.deck-form {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-top: 1.5rem;
}

.deck-form-actions {
  display: flex;
  gap: 1rem;
}

.deck-form-actions .btn {
  flex: 1;
  text-align: center;
}

/* Admin */
.admin-navbar {
  background: #2d3748;
}

.admin-navbar .navbar-brand {
  color: #e2e8f0;
}

.admin-navbar .navbar-link {
  color: #cbd5e0;
}

.admin-navbar .navbar-link:hover {
  background: #4a5568;
}

.admin-navbar .navbar-link.active {
  color: white;
  font-weight: 600;
}

.admin-navbar .navbar-user {
  color: #a0aec0;
}

.admin-navbar .navbar-toggle-icon,
.admin-navbar .navbar-toggle-icon::before,
.admin-navbar .navbar-toggle-icon::after {
  background: #e2e8f0;
}

.admin-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.admin-header-actions {
  display: flex;
  gap: 0.5rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color);
}

.admin-stat-label {
  font-size: 0.85rem;
  color: #666;
}

.admin-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* Div-based table: flex on desktop, cards on mobile */
.data-table {
  width: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.data-table-header {
  display: flex;
  border-bottom: 2px solid var(--border-color);
}

.data-table-header .data-table-cell {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
}

.data-table-row {
  display: flex;
  border-bottom: 1px solid #eee;
}

.data-table-row:last-child {
  border-bottom: none;
}

.data-table-row:hover {
  background-color: #f8f9fa;
}

.data-table-row .data-table-cell {
  flex: 1;
  padding: 0.75rem 1rem;
  min-width: 0;
}

.data-table a:not(.btn) {
  color: var(--secondary-color);
  text-decoration: none;
}

.data-table a:not(.btn):hover {
  text-decoration: underline;
}

/* Detail table (key/value pairs in admin show views) */
.detail-table {
  width: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-collapse: collapse;
}

.detail-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}

.detail-table tr:last-child td {
  border-bottom: none;
}

.admin-search {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.admin-search-input {
  max-width: 300px;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.text-muted {
  color: #999;
  font-size: 0.85rem;
}

/* Dropdown */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
  min-width: 180px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 50;
  padding: 0.25rem 0;
}

.dropdown-menu--open {
  display: block;
}

.dropdown-item {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  text-align: left;
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-color);
}

.dropdown-item:hover {
  background: var(--background-color);
}

.dropdown-item-form {
  margin: 0;
  padding: 0;
}

.dropdown-item-danger {
  color: #c62f0c;
}

.deck-header-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: 500px;
}

.deck-header-name-input {
  font-size: 2rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
}

.deck-header-description-input {
  font-size: 0.95rem;
  padding: 0.5rem;
  min-height: auto;
}

.deck-header-form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Card preview modal (mobile) */
.card-preview-modal {
  border: none;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 300px;
  width: 85%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card-preview-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.card-preview-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.card-preview-modal-image {
  width: 100%;
  border-radius: 12px;
}

/* Navbar toggle (hidden on desktop) */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}

.navbar-toggle-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-color);
  position: relative;
}

.navbar-toggle-icon::before,
.navbar-toggle-icon::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-color);
  position: absolute;
  left: 0;
}

.navbar-toggle-icon::before { top: -6px; }
.navbar-toggle-icon::after { top: 6px; }

.navbar-menu {
  display: contents;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  /* Navbar: hamburger menu */
  .navbar-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    gap: 0;
  }

  .navbar-toggle {
    display: block;
  }

  .navbar-menu {
    display: none;
    width: 100%;
    padding-bottom: 0.75rem;
  }

  .navbar-menu.navbar-menu--open {
    display: block;
  }

  .navbar-links {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }

  .navbar-link {
    display: block;
    padding: 0.6rem 0.75rem;
  }

  .navbar-right {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-left: 0;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
  }

  .navbar-user {
    padding: 0.4rem 0.75rem;
  }

  .navbar-right .navbar-link {
    padding: 0.6rem 0.75rem;
  }

  /* Dashboard */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .card-actions, .deck-actions {
    flex-direction: column;
  }

  .card-actions .btn, .deck-actions .btn {
    width: 100%;
  }

  /* Cards index: stack sidebar above grid */
  .cards-layout {
    flex-direction: column;
  }

  .sets-sidebar {
    width: 100%;
    position: static;
    max-height: 250px;
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  /* Card show: stack image above details */
  .card-show-content {
    flex-direction: column;
  }

  .card-show-image {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }

  .card-show-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Decks index */
  .decks-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

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

  /* Deck show */
  .deck-show-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .deck-actions-bar {
    flex-direction: column;
  }

  .deck-actions-bar .btn {
    width: 100%;
    text-align: center;
  }

  .deck-show-stats {
    gap: 0.75rem;
    padding: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .deck-show-content {
    flex-direction: column;
  }

  .deck-show-preview {
    display: none;
  }

  /* Card search dropdown */
  .card-search-input {
    max-width: 100%;
  }

  .card-search-results {
    width: 100%;
  }

  /* Deck form */
  .deck-form-actions {
    flex-direction: column;
  }

  .deck-form-actions .btn {
    width: 100%;
  }

  /* Result modal */
  .result-modal {
    max-width: 95%;
    padding: 1.25rem;
  }

  .result-type-buttons {
    flex-wrap: wrap;
  }

  .result-type-btn {
    flex: 1 1 40%;
  }

  /* Auth */
  .auth-container {
    margin: 2rem 1rem;
  }

  .welcome-container {
    margin: 2rem 1rem;
  }

  /* Admin grid */
  .admin-grid-2col {
    grid-template-columns: 1fr;
  }

  .admin-grid-2col img {
    max-width: 100%;
    height: auto;
  }

  /* Admin navbar mobile adjustments */
  .admin-navbar .navbar-right {
    border-top-color: #4a5568;
  }

  /* Admin header (used in stats/results) */
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  /* Table → card layout */
  .data-table-header {
    display: none;
  }

  .data-table-row {
    flex-direction: column;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-bottom: none;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    background: white;
    gap: 0.4rem;
  }

  .data-table-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .data-table-row .data-table-cell {
    padding: 0.15rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .data-table-row .data-table-cell::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 1rem;
    flex-shrink: 0;
  }
}
