/* Global styling for the Spawn comics web app.  The palette takes
   inspiration from the dark, moody aesthetic of the Spawn comic books
   while keeping the interface modern and legible. */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;600&display=swap');

/* Base reset and smooth scrolling */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background-color: #0d0e11 !important;
  color: #e0e0e0 !important;
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Larger base font on desktop */
@media (min-width: 768px) {
  body {
    font-size: 16px;
  }
}

a {
  color: #9f7aea; /* soft purple accent */
  text-decoration: none;
}

a:hover {
  color: #b39ddb;
  text-decoration: underline;
}

/* Navbar */
.navbar {
  background-color: #14151a;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #22242a;
}

/* Fix Bootstrap dropdown - Tailwind overrides display */
.navbar .dropdown-menu {
  display: none;
  position: absolute;
}

.navbar .dropdown-menu.show {
  display: block;
}

.navbar .dropdown-item {
  display: flex;
  align-items: center;
}

.navbar .dropdown-item svg {
  flex-shrink: 0;
}

.navbar .logo {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff !important;
}

.navbar .logo a{
    color: #ffffff !important;
    text-decoration: none;
}

.navbar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.navbar li {
  font-size: 0.95rem;
}

.navbar li a {
  color: #e0e0e0;
  font-weight: 500;
}

.navbar li a.active {
  color: #9f7aea;
}

/* Hero section */
.hero {
  background: url('../images/abstract_chain.png') no-repeat center center/cover;
  padding: 2rem 1rem;
  text-align: center;
  color: #f5f5f5;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.hero p {
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Hero responsive */
@media (min-width: 768px) {
  .hero {
    padding: 3rem 1rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.1rem;
  }
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

@media (min-width: 768px) {
  .container {
    width: 90%;
    padding: 2rem 1rem;
  }
}

.section-title {
  font-size: 1.4rem;
  margin: 1.5rem 0 1rem;
  color: #c0b7f9;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 1.8rem;
    margin: 2rem 0 1rem;
  }
}

/* Character card */
.character-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .character-grid {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2rem;
  }
}

.character-details, .character-abilities {
  flex: 1 1 100%;
  background-color: #1a1c21;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

@media (min-width: 768px) {
  .character-details, .character-abilities {
    flex: 1 1 300px;
    padding: 1.5rem;
  }
}

.character-details h3, .character-abilities h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #9f7aea;
  font-size: 1.1rem;
}

.character-details ul, .character-abilities ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.character-details li, .character-abilities li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Issue cards */
.issues-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.issue-card {
  background-color: #1a1c21;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.issue-card:hover {
  transform: translateY(-4px);
}

.issue-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.issue-card .card-content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.issue-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #e0e0e0;
}

.key-facts {
  font-size: 0.85rem;
  color: #b0b0b0;
  margin-bottom: 0.5rem;
}

.price-range {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
  color: #9f7aea;
}

.issue-card .btn-group {
  display: flex;
  gap: 0.5rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  border-radius: 6px;
  text-align: center;
  background-color: #9f7aea;
  color: #1a1c21;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s, transform 0.1s;
  min-height: 44px; /* iOS recommended touch target */
  min-width: 44px;
  touch-action: manipulation;
}

.btn:hover {
  background-color: #b39ddb;
}

.btn:active {
  transform: scale(0.98);
}

@media (min-width: 768px) {
  .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-height: unset;
    min-width: unset;
  }
}

/* Sidebar filters */
.filters {
  background-color: #14151a;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  width: 100%;
}

@media (min-width: 768px) {
  .filters {
    max-width: 300px;
    margin-bottom: 2rem;
  }
}

.filters h4 {
  margin-top: 0;
  color: #9f7aea;
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
  color: #c0c0c0;
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #333;
  background-color: #1f2128;
  color: #e0e0e0;
  font-size: 16px; /* Prevents iOS zoom on focus */
}

.filter-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  accent-color: #9f7aea;
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 0;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .pagination {
    margin-top: 1rem;
  }
}

.pagination a, .pagination span {
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  background-color: #1a1c21;
  color: #e0e0e0;
  font-size: 0.85rem;
}

.pagination a.active {
  background-color: #9f7aea;
  color: #1a1c21;
}

.pagination a:hover {
  background-color: #b39ddb;
  color: #1a1c21;
}

/* Issue detail page */
.issue-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.issue-detail img {
  width: 100%;
  max-width: 350px;
  border-radius: 8px;
}

.issue-info {
  flex: 1 1 300px;
  background-color: #1a1c21;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.issue-info h2 {
  margin-top: 0;
  color: #9f7aea;
}

.issue-info ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.issue-info li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.issue-info .buy-link {
  margin-top: 1rem;
  display: inline-block;
  background-color: #9f7aea;
  color: #1a1c21;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
}

.issue-info .buy-link:hover {
  background-color: #b39ddb;
}

/* Responsive table wrapper */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

/* Styles for the collection pages */
.owned-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.8rem;
  min-width: 500px; /* Ensures table scrolls on mobile */
}

@media (min-width: 768px) {
  .owned-table {
    font-size: 0.9rem;
    min-width: unset;
  }
}

.owned-table th, .owned-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #333;
  white-space: nowrap;
}

.owned-table th {
  background-color: #1a1c21;
  color: #9f7aea;
  text-align: center;
  position: sticky;
  top: 0;
}

.owned-list {
  list-style: none;
  padding-left: 0;
  margin-top: 0.5rem;
}

.owned-list li {
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: #d0d0d0;
}

.issue-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;

    & img {
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    }

    & span.title {
      font-size: 1.5rem;
      font-weight: 600;
      color: #e0e0e0;
    }

    & p.plot {
      font-size: 0.9rem;
      color: #b0b0b0;
    }
}

.owned-form {
  display: flex;
  flex-direction: column; /* stack children top to bottom */
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: flex-start; /* align to left */
}

.owned-form form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}


.collection-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.8rem;
  min-width: 400px;
}

@media (min-width: 768px) {
  .collection-table {
    font-size: 0.9rem;
    min-width: unset;
  }
}

.collection-table th, .collection-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #333;
}

.collection-table th {
  background-color: #1a1c21;
  color: #9f7aea;
  text-align: left;
  position: sticky;
  top: 0;
}

.btn:focus,
.btn:active:focus,
.btn.show:focus {
  outline: none !important;
  box-shadow: none !important;
}

.collapse { visibility: visible !important; }

/* ===== Mobile-specific improvements ===== */

/* Improve Bootstrap modal for mobile */
@media (max-width: 767px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .modal-content {
    border-radius: 12px;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-body .row {
    margin-bottom: 0.75rem !important;
  }

  /* Stack form columns on mobile */
  .modal-body .col-md-6,
  .modal-body .col-lg-6 {
    margin-bottom: 0.75rem;
  }
}

/* Better form inputs on mobile */
.form-control,
.form-select {
  font-size: 16px !important; /* Prevents iOS zoom */
  padding: 0.625rem 0.75rem;
  min-height: 44px;
}

@media (min-width: 768px) {
  .form-control,
  .form-select {
    font-size: 0.875rem !important;
    min-height: unset;
  }
}

/* Touch-friendly checkboxes */
.form-check {
  padding: 0.5rem 0;
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
}

.form-check-label {
  padding-left: 0.25rem;
  cursor: pointer;
}

/* Improve spacing for stacked buttons on mobile */
.btn-group-mobile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .btn-group-mobile {
    flex-direction: row;
  }
}

/* Better pagination on mobile */
.pagination {
  flex-wrap: wrap;
  justify-content: center;
}

.pagination a, .pagination span {
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 768px) {
  .pagination a, .pagination span {
    min-width: unset;
    min-height: unset;
  }
}

/* Responsive pagination - show compact on small screens, full on large */
.pagination.pagination-desktop {
  display: none !important;
}
.pagination.pagination-mobile {
  display: flex !important;
}
@media (min-width: 1024px) {
  .pagination.pagination-desktop {
    display: flex !important;
  }
  .pagination.pagination-mobile {
    display: none !important;
  }
}

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;
}

/* Safe area padding for notched phones */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* Improve touch targets for links */
a {
  padding: 0.125rem 0;
}

/* Better card spacing on mobile */
@media (max-width: 767px) {
  .rounded-2xl {
    border-radius: 0.75rem !important;
  }

  .p-4 {
    padding: 1rem !important;
  }

  .gap-6 {
    gap: 1rem !important;
  }
}

/* Navbar user area improvements */
.navbar .nav-link {
  padding: 0.5rem 0.75rem;
}

@media (max-width: 991px) {
  .navbar-nav .nav-item {
    padding: 0.25rem 0;
  }

  .navbar-nav .btn {
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* ===== Toast Notifications ===== */
.spawn-toast {
  border-radius: 8px !important;
  padding: 12px 16px !important;
  font-family: 'Montserrat', sans-serif !important;
  font-size: 14px !important;
  min-width: 280px !important;
  max-width: 400px !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 12px !important;
}

.toast-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

/* Toast close button styling - Toastify uses .toastify-close */
.spawn-toast .toast-close,
.spawn-toast .toastify-close {
  opacity: 0.7 !important;
  padding: 4px !important;
  margin-left: auto !important;
  flex-shrink: 0 !important;
  position: static !important;
}

.spawn-toast .toast-close:hover,
.spawn-toast .toastify-close:hover {
  opacity: 1 !important;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .spawn-toast {
    min-width: calc(100vw - 32px) !important;
    max-width: calc(100vw - 32px) !important;
    margin: 0 16px !important;
  }
}

/* ===== Loading Skeletons ===== */
.skeleton {
  background: linear-gradient(90deg, #1a1c21 25%, #2a2d35 50%, #1a1c21 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  background-color: #1a1c21;
  border-radius: 8px;
  overflow: hidden;
}

.skeleton-image {
  height: 180px;
  background: linear-gradient(90deg, #1a1c21 25%, #2a2d35 50%, #1a1c21 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #1a1c21 25%, #2a2d35 50%, #1a1c21 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background-color: #1a1c21;
  border-radius: 6px;
  margin-bottom: 8px;
}

.skeleton-avatar {
  width: 48px;
  height: 64px;
  flex-shrink: 0;
  background: linear-gradient(90deg, #1a1c21 25%, #2a2d35 50%, #1a1c21 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-content {
  flex: 1;
}

/* Skeleton shimmer - use with Tailwind classes for sizing */
.skeleton-shimmer {
  background: linear-gradient(90deg, #1a1c21 25%, #2a2d35 50%, #1a1c21 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-pagination {
  height: 32px;
  width: 300px;
  background: linear-gradient(90deg, #1a1c21 25%, #2a2d35 50%, #1a1c21 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* View toggle buttons */
.view-toggle-btn {
  transition: background-color 0.15s ease;
}
.view-toggle-btn.active {
  background-color: #9f7aea;
  color: white;
}

/* ===== Empty States ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6b7280;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  opacity: 0.5;
  color: #9f7aea;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 0.5rem;
}

.empty-state-message {
  color: #9ca3af;
  margin-bottom: 1.5rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #9f7aea;
  color: #1a1c21;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s;
}

.empty-state-action:hover {
  background-color: #b39ddb;
  text-decoration: none;
  color: #1a1c21;
}

/* ===== Confirmation Modal ===== */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.confirm-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.confirm-modal {
  background-color: #1f2128;
  border-radius: 12px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.2s;
}

.confirm-modal-overlay.show .confirm-modal {
  transform: scale(1);
}

.confirm-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.25rem;
  border-bottom: 1px solid #333;
}

.confirm-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirm-modal-icon.danger {
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.confirm-modal-icon.warning {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.confirm-modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #e0e0e0;
  margin: 0;
}

.confirm-modal-body {
  padding: 1.25rem;
  color: #9ca3af;
  line-height: 1.6;
}

.confirm-modal-footer {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #333;
  justify-content: flex-end;
}

.confirm-modal-btn {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.confirm-modal-btn.cancel {
  background-color: #374151;
  color: #e0e0e0;
}

.confirm-modal-btn.cancel:hover {
  background-color: #4b5563;
}

.confirm-modal-btn.confirm {
  background-color: #ef4444;
  color: white;
}

.confirm-modal-btn.confirm:hover {
  background-color: #dc2626;
}

.confirm-modal-btn.confirm.warning {
  background-color: #f59e0b;
}

.confirm-modal-btn.confirm.warning:hover {
  background-color: #d97706;
}

/* ===== Bulk Selection ===== */
.bulk-select-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #1f2128;
  border-top: 1px solid #9f7aea;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 1000;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.bulk-select-bar.show {
  transform: translateY(0);
}

.bulk-select-count {
  font-weight: 600;
  color: #9f7aea;
}

.bulk-select-actions {
  display: flex;
  gap: 0.75rem;
}

.bulk-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.bulk-select-btn.primary {
  background-color: #9f7aea;
  color: #1a1c21;
}

.bulk-select-btn.primary:hover {
  background-color: #b39ddb;
}

.bulk-select-btn.secondary {
  background-color: #374151;
  color: #e0e0e0;
}

.bulk-select-btn.secondary:hover {
  background-color: #4b5563;
}

.bulk-select-btn.danger {
  background-color: #ef4444;
  color: white;
}

.bulk-select-btn.danger:hover {
  background-color: #dc2626;
}

/* Mobile adjustments for bulk bar */
@media (max-width: 640px) {
  .bulk-select-bar {
    flex-direction: column;
    text-align: center;
  }

  .bulk-select-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Offline Indicator ===== */
.offline-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #f59e0b;
  color: #1a1c21;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.offline-indicator.show {
  transform: translateY(0);
}

.offline-indicator.syncing {
  background-color: #3b82f6;
  color: white;
}