/* ==========================================================================
   Mobile Optimizations (Phase 5: UX Enhancements)
   ========================================================================== */

@media (max-width: 768px) {
  /* Reduce body/container padding on mobile */
  body {
    padding: 10px;
  }

  .container {
    padding: 15px;
    border-radius: 12px;
  }

  /* Larger touch targets for mobile */
  button {
    min-height: 44px;
    min-width: 44px;
    font-size: 16px;
  }

  /* Prevent iOS zoom on input focus */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  .stats-panel {
    padding: 15px;
  }

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

  .progress-by-region {
    grid-template-columns: 1fr;
  }

  /* Mobile header - remove sticky positioning */
  .compact-header {
    position: relative;
    margin: 0 0 15px 0;
    border-radius: 12px;
  }

  /* Card actions buttons - easier to tap */
  .card-actions button {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* Ownership filter buttons - proper touch targets */
  .ownership-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 14px;
  }

  /* Language filter buttons - proper touch targets */
  .lang-filter-btn,
  .lang-exclusive-btn {
    min-height: 40px;
    min-width: 40px;
  }

  /* Unified bar - wrap on mobile */
  .display-count-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
    justify-content: center;
  }

  .display-actions-left {
    order: 0;
  }

  .display-counts-center {
    order: 1;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
  }

  .display-controls-right {
    order: -1;
    width: 100%;
    justify-content: center;
  }

  .btn-batch-label {
    display: none;
  }

  /* Modal close buttons - proper touch targets */
  .modal-close {
    width: 44px;
    height: 44px;
    font-size: 28px;
  }

  /* Filter panel improvements */
  .filter-panel {
    padding: 12px;
  }

  .filter-group {
    margin-bottom: 12px;
  }

  .filter-group label {
    font-size: 14px;
    margin-bottom: 6px;
  }

  /* Filter exclude toggle - better positioning on mobile */
  .filter-exclude-toggle,
  .sort-order-toggle {
    right: 12px;
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .filter-group select {
    padding-right: 44px;
  }

  /* Simplified grid on mobile */
  .cards-grid {
    gap: 12px;
    padding: 12px;
  }

  /* Full-width modals on mobile */
  .modal-content {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    margin: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
  }

  .modal-header {
    padding: 12px 15px;
  }

  .modal-header h2 {
    font-size: 18px;
  }

  .modal-close {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .lightbox-nav {
    width: 50px;
    height: 50px;
    font-size: 36px;
  }

  .lightbox-prev {
    left: 10px;
  }

  .lightbox-next {
    right: 10px;
  }

  /* Reduce lightbox padding on mobile */
  .lightbox-content {
    padding: 20px 15px;
  }

  .lightbox-close {
    top: 10px;
    right: 10px;
  }
}

/* Owned Card Edit Modal - Redesigned */
.owned-edit-modal .modal-content {
  max-width: 750px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.owned-modal-content {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.owned-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Copies Section */
.owned-copies-section {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
}

/* Edit Mode Banner */
.edit-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.edit-mode-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #92400e;
}

.edit-mode-icon {
  font-size: 16px;
}

.edit-mode-copy-number {
  font-weight: 700;
  color: #b45309;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(146, 64, 14, 0.3);
  color: #92400e;
  padding: 4px 12px;
  font-size: 12px;
}

.btn-ghost:hover {
  background: rgba(146, 64, 14, 0.1);
  border-color: rgba(146, 64, 14, 0.5);
}

.owned-copies-header {
  margin-bottom: 12px;
}

.owned-copies-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
}

.copies-icon {
  font-size: 16px;
}

.copies-badge {
  background: var(--color-primary);
  color: white;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  margin-left: auto;
}

.owned-copies-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

/* Instance Item (Copy) - Compact */
.instance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 12px;
}

.instance-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.instance-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  color: #333;
}

.instance-details {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #666;
  flex: 1;
  min-width: 0;
}

.instance-detail-row {
  white-space: nowrap;
}

.instance-detail-label {
  color: #888;
}

.instance-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.instance-actions .btn {
  padding: 6px 10px;
  font-size: 12px;
}

/* Condition Badges */
.condition-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
}

.condition-badge.condition-nm {
  background: #d4edda;
  color: #155724;
}
.condition-badge.condition-lp {
  background: #fff3cd;
  color: #856404;
}
.condition-badge.condition-mp {
  background: #ffeaa7;
  color: #6c5c0d;
}
.condition-badge.condition-hp {
  background: #f8d7da;
  color: #721c24;
}
.condition-badge.condition-dmg {
  background: #721c24;
  color: white;
}

/* Form Section */
.owned-form-section {
  padding: 20px;
}

.owned-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Modal Footer */
.owned-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background: #fafafa;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  gap: 12px;
}

.owned-modal-footer-left {
  flex-shrink: 0;
}

.owned-modal-footer-right {
  display: flex;
  gap: 10px;
}

/* Responsive */
@media (max-width: 600px) {
  .owned-edit-modal .modal-content {
    max-width: calc(100% - 20px);
    margin: 10px;
    max-height: calc(100vh - 20px);
  }

  .owned-edit-modal .modal-header {
    padding: 12px 15px;
  }

  .owned-edit-modal .modal-header h2 {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 50px);
  }

  .owned-modal-body {
    max-height: none;
  }

  .owned-copies-section {
    padding: 12px 15px;
  }

  .owned-form-section {
    padding: 15px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .instance-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .instance-details {
    flex-wrap: wrap;
  }

  .instance-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .owned-modal-footer {
    flex-direction: column;
    gap: 10px;
    padding: 12px 15px;
  }

  .owned-modal-footer-left,
  .owned-modal-footer-right {
    width: 100%;
  }

  .owned-modal-footer-left {
    order: 2;
  }

  .owned-modal-footer-right {
    order: 1;
    flex-direction: row;
    justify-content: stretch;
    gap: 8px;
  }

  .owned-modal-footer-right .btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
  }

  .owned-modal-footer-left .btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-family: inherit;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* Order Modal Footer - improved layout */
.order-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  gap: 16px;
}

.order-modal-footer-left {
  flex-shrink: 0;
}

.order-modal-footer-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-outline-danger {
  background: transparent;
  color: var(--color-error);
  border: 1px solid var(--color-error);
  padding: 8px 16px;
}

.btn-outline-danger:hover {
  background: var(--color-error);
  color: white;
}

.btn .btn-icon {
  margin-right: 6px;
}

/* Responsive: stack buttons on mobile */
@media (max-width: 540px) {
  .order-modal-footer {
    flex-direction: column;
    gap: 12px;
  }

  .order-modal-footer-left,
  .order-modal-footer-right {
    width: 100%;
  }

  .order-modal-footer-left {
    order: 2;
  }

  .order-modal-footer-right {
    order: 1;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .order-modal-footer-left .btn {
    width: 100%;
  }
}

/* Ordered Modal Form */
.ordered-modal-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.ordered-modal-card-info {
  margin-bottom: 8px;
}

.ordered-modal-card-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.ordered-modal-card-preview img {
  width: 60px;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ordered-modal-card-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ordered-modal-card-details strong {
  font-size: 15px;
  color: var(--text-primary);
}

.ordered-modal-card-details .text-muted {
  font-size: 13px;
}

.ordered-modal-form .form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.ordered-modal-form .form-row.form-row--2 {
  grid-template-columns: repeat(2, 1fr);
}

.ordered-modal-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ordered-modal-form .form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ordered-modal-form .form-group input,
.ordered-modal-form .form-group select,
.ordered-modal-form .form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.ordered-modal-form .form-group input:focus,
.ordered-modal-form .form-group select:focus,
.ordered-modal-form .form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.ordered-modal-form .form-group textarea {
  resize: vertical;
  min-height: 60px;
}

@media (max-width: 700px) {
  .ordered-modal-form .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 540px) {
  .ordered-modal-form {
    padding: 16px;
  }

  .ordered-modal-form .form-row,
  .ordered-modal-form .form-row.form-row--2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ordered-modal-card-preview img {
    width: 50px;
  }
}

/* Dark mode for ordered modal */
body.dark-mode .ordered-modal-card-preview {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .ordered-modal-form .form-group input,
body.dark-mode .ordered-modal-form .form-group select,
body.dark-mode .ordered-modal-form .form-group textarea {
  background: #2d2d44;
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e0f0;
}

body.dark-mode .ordered-modal-form .form-group select option {
  background: #2d2d44;
  color: #e0e0f0;
}

body.dark-mode .ordered-modal-form .form-group input:focus,
body.dark-mode .ordered-modal-form .form-group select:focus,
body.dark-mode .ordered-modal-form .form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.25);
}

body.dark-mode .ordered-modal-form .form-group label {
  color: #9898b0;
}

body.dark-mode .ordered-modal-card-details strong {
  color: #e0e0f0;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

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

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

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

.btn-danger:hover {
  background: #dc2626;
}

/* .btn-secondary is defined in src/styles/themes.css using CSS custom properties */

.btn-warning {
  background: var(--color-warning);
  color: #333;
}

.btn-warning:hover {
  background: #e69500;
}

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

.btn-info:hover {
  background: #2563eb;
}

/* Order Status Toggle */
.order-status-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-status-toggle > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-toggle-buttons {
  display: flex;
  gap: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.status-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.status-toggle-btn:first-child {
  border-right: 1px solid var(--border-color);
}

.status-toggle-btn:hover:not(.active) {
  background: var(--bg-primary);
}

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

.status-toggle-btn.active[data-status='pending'] {
  background: #d97706;
}

.status-toggle-btn.active[data-status='shipped'] {
  background: #0066cc;
}

.status-toggle-btn .status-icon {
  font-size: 14px;
}

/* Dark mode for status toggle */
body.dark-mode .status-toggle-buttons {
  border-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .status-toggle-btn {
  background: rgba(0, 0, 0, 0.2);
  color: #9898b0;
}

body.dark-mode .status-toggle-btn:first-child {
  border-right-color: rgba(255, 255, 255, 0.15);
}

body.dark-mode .status-toggle-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .status-toggle-btn.active {
  background: var(--color-primary);
  color: white;
}

body.dark-mode .status-toggle-btn.active[data-status='pending'] {
  background: #d97706;
}

body.dark-mode .status-toggle-btn.active[data-status='shipped'] {
  background: #0066cc;
}

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

.btn-success:hover {
  background: #388e3c;
}

/* Import/Export Stats Card */
.ie-stats-card {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.ie-stats-title {
  margin: 0 0 15px 0;
  font-size: 18px;
  color: #333;
}

.ie-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.ie-stats-label {
  font-size: 14px;
  color: #666;
}

.ie-stats-value {
  font-size: 24px;
  font-weight: bold;
}

.ie-stats-value-dark {
  color: #333;
}

/* Statistics Dashboard */
.statistics-dashboard {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.dashboard-header h2 {
  margin: 0;
}

.stats-content {
  margin-top: 20px;
}

/* Key Metrics */
.stats-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.metric-card {
  background: linear-gradient(135deg, var(--color-primary) 0%, #764ba2 100%);
  border-radius: 10px;
  padding: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.metric-icon {
  font-size: 32px;
  opacity: 0.9;
}

.metric-info {
  flex: 1;
}

.metric-label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 5px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
}

/* Charts */
.stats-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 30px;
}

.stats-section {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
}

.stats-section h3 {
  margin: 0 0 15px 0;
  font-size: 18px;
  color: var(--color-primary);
}

.chart-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-bar {
  display: grid;
  grid-template-columns: 140px 1fr 120px;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.chart-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-bar-container {
  background: #e0e0e0;
  border-radius: 5px;
  height: 24px;
  overflow: hidden;
}

.chart-bar-fill {
  background: linear-gradient(90deg, var(--color-primary) 0%, #764ba2 100%);
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.chart-bar-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
  text-align: right;
}

/* Inline Type and Flag Icons */
.type-icon-inline,
.flag-icon-inline {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
}

.progress-label .flag-icon-inline {
  width: 18px;
  height: 18px;
  margin-right: 6px;
}

/* Top Valuable Cards & Recent Acquisitions - moved to stats.css */

.recent-acquisitions-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 900px) {
  .stats-doughnut-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .stats-charts-row {
    grid-template-columns: 1fr;
  }

  .stats-doughnut-row {
    grid-template-columns: 1fr;
  }

  .chart-bar {
    grid-template-columns: 80px 1fr 80px;
  }
}

/* Breadcrumbs */
.breadcrumbs {
  padding: 0px 15px;
  margin-top: 12px;
  background: #f8f9fa;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.breadcrumbs-items {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
}

.breadcrumb-item .flag-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

.breadcrumb-remove {
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s;
}

.breadcrumb-remove:hover {
  background: var(--color-primary);
  color: white;
  transform: rotate(90deg);
}

.breadcrumb-item-clear {
  background: #fef2f2;
  border-color: #f87171;
  color: #ef4444;
  cursor: pointer;
  transition: all 0.2s;
}

.breadcrumb-item-clear:hover {
  background: #fee2e2;
  border-color: #ef4444;
  color: #dc2626;
}

/* Progress Tracking */
.progress-tracking {
  background: white;
  border-radius: 10px;
  padding: 15px;
  margin: 15px auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 1400px;
}

.progress-tracking h2 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Progress Master Layout (hero left, tracking right) ──── */

.progress-master-layout {
  display: grid;
  /* Wider left column so the source-spend cards inside .hero-stat-cards
     can wrap into a 2-up grid at desktop widths instead of stacking
     vertically in a narrow strip. */
  grid-template-columns: minmax(360px, 1.4fr) minmax(0, 2fr);
  gap: 20px;
  align-items: start;
}

/* ── Progress Hero ────────────────────────────────────────── */

.progress-hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  padding: 20px 24px;
}

.progress-hero-main {
  text-align: center;
  margin-bottom: 16px;
}

.progress-hero-count {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.progress-hero-label {
  font-size: 13px;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
  display: block;
}

.progress-hero .hero-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  margin-top: 12px;
}

.progress-hero .hero-bar .progress-bar {
  background: white;
}

.progress-hero-percent {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 4px;
}

.progress-hero-breakdown {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* Hero stat cards – stacked layout */
.hero-stat-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-stat-card {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 16px;
  gap: 12px;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.hero-stat-card:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.18);
}

.hero-stat-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.hero-stat-card-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.hero-stat-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.hero-stat-favicon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.hero-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.7;
  font-weight: 500;
}

.hero-stat-value {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.hero-stat-unit {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
  letter-spacing: 0;
  text-transform: lowercase;
}

.hero-stat-sub {
  font-size: 11px;
  opacity: 0.6;
  line-height: 1.3;
  /* Allow the sub-line to wrap inside narrow cards — the source cards
     in the progress hero column can drop to ~150-220px wide depending
     on viewport, where nowrap caused the line to escape the card. */
  overflow-wrap: anywhere;
}

.hero-stat-num {
  color: rgba(255, 255, 255, 0.95);
  font-weight: 600;
}

/* Total card – prominent, full width */
.hero-stat-total {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.2);
  padding: 18px 20px;
}

.hero-stat-total .hero-stat-icon {
  font-size: 26px;
  width: 36px;
}

.hero-stat-total .hero-stat-value {
  font-size: 26px;
  font-weight: 800;
}

.hero-stat-total .hero-stat-label {
  font-size: 11px;
  letter-spacing: 1.2px;
}

/* Source cards */
.hero-stat-source {
  background: rgba(255, 255, 255, 0.08);
}

/* No source card */
.hero-stat-nosource {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.06);
  opacity: 0.7;
}

.hero-stat-nosource:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.14);
}

/* Wishlist card */
.hero-stat-wishlist {
  background: rgba(255, 215, 0, 0.12);
  border-color: rgba(255, 215, 0, 0.15);
}

.hero-stat-wishlist:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: rgba(255, 215, 0, 0.3);
}

/* Ordered card */
.hero-stat-ordered {
  background: rgba(100, 180, 255, 0.12);
  border-color: rgba(100, 180, 255, 0.15);
}

.hero-stat-ordered:hover {
  background: rgba(100, 180, 255, 0.2);
  border-color: rgba(100, 180, 255, 0.3);
}

/* ── Language Tracking ───────────────────────────────────── */

.lang-tracking {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lang-tracking-section {
  background: #ffffff;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.lang-tracking-title {
  font-size: 12px;
  font-weight: 700;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
}

.lang-tracking-grid {
  display: grid;
  gap: 8px;
}

.lang-grid-availability {
  grid-template-columns: 1fr 1fr;
}

.lang-grid-2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lang-grid-3col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lang-tracking-fullwidth {
  margin-top: 20px;
}

.lang-grid-serie {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.progress-cell-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-cell-footer-left {
  font-size: 10px;
  color: #9ca3af;
  font-weight: 400;
}

.progress-cell-footer .progress-cell-percent {
  text-align: right;
}

.lang-tracking-empty {
  color: #a0aec0;
  font-size: 13px;
  text-align: center;
  padding: 12px;
  grid-column: 1 / -1;
}

/* ── Unified Progress Cell (used by all tracking sections) ─ */

.progress-cell {
  background: #f7fafc;
  border-radius: 8px;
  padding: 10px 12px;
}

.progress-cell-clickable {
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
}

.progress-cell-clickable:hover {
  background: #edf2f7;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.progress-cell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}

.progress-cell-label {
  font-size: 13px;
  font-weight: 600;
  color: #2d3748;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.progress-cell-count {
  font-size: 14px;
  font-weight: 700;
  color: #4a5568;
  white-space: nowrap;
  flex-shrink: 0;
}

.progress-cell-percent {
  font-size: 11px;
  color: #718096;
  text-align: right;
  margin-top: 2px;
}

/* ── Shared progress bar ─────────────────────────────────── */

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 3px;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-percentage {
  font-size: 11px;
  color: #666;
  text-align: right;
}

@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
  }

  h1 {
    font-size: 1.8em;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .progress-master-layout {
    grid-template-columns: 1fr;
  }

  .hero-stat-cards {
    gap: 8px;
  }

  .hero-stat-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .hero-stat-total {
    padding: 14px 14px;
  }

  .hero-stat-value {
    font-size: 17px;
  }

  .hero-stat-total .hero-stat-value {
    font-size: 22px;
  }

  .hero-stat-sub {
    font-size: 10px;
  }

  .lang-grid-availability,
  .lang-grid-2col,
  .lang-grid-3col,
  .lang-grid-serie {
    grid-template-columns: 1fr;
  }

  /* General mobile button improvements */
  .btn {
    min-height: 40px;
    padding: 10px 14px;
  }

  .btn-sm {
    min-height: 36px;
    padding: 8px 12px;
  }

  /* Ensure modal footers wrap buttons properly */
  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 15px;
  }

  .modal-footer .btn {
    min-width: 100px;
  }
}

/* Inline Region Filter Styles */
.inline-filter-section {
  background: #2a2a2a;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.inline-filter-label {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

.inline-filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Scoped to .inline-filter-buttons to avoid overriding main filter bar */
/* Note: lang filter buttons use hardcoded dark colors because they only
   appear inside the dark-mode mobile filter panel */
.inline-filter-buttons .lang-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid #555;
  background: #1a1a1a;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}

.inline-filter-buttons .lang-filter-btn:hover {
  background: #3a3a3a;
  border-color: #777;
  transform: translateY(-1px);
}

.inline-filter-buttons .lang-filter-btn[data-state='include'] {
  background: #33335a;
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.4);
}

.inline-filter-buttons .lang-filter-btn[data-state='exclude'] {
  background: #3d2a2a;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4);
  opacity: 0.7;
}

.inline-filter-buttons .lang-exclusive-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid #555;
  background: #1a1a1a;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  white-space: nowrap;
}

.inline-filter-buttons .lang-exclusive-btn:hover {
  background: #3a3a3a;
  border-color: #777;
  transform: translateY(-1px);
}

.inline-filter-buttons .lang-exclusive-btn[data-state='include'] {
  background: #33335a;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.4);
}

.inline-filter-buttons .lang-exclusive-btn[data-state='exclude'] {
  background: #3d2a2a;
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4);
  opacity: 0.7;
}

.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
}

.flag-icon.flag-icon-sm {
  width: 14px;
  height: 10px;
  border-radius: 1px;
}

/* Filter Exclude Toggle Styles */
.filter-group {
  position: relative;
}

.filter-exclude-toggle,
.sort-order-toggle {
  position: absolute;
  right: 18px;
  top: 24px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border-color);
  background: white;
  color: #999;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
  z-index: 1;
}

.filter-exclude-toggle:hover,
.sort-order-toggle:hover {
  background: #f0f0f0;
  border-color: #999;
}

.filter-exclude-toggle.active {
  background: #cc3333;
  border-color: #cc3333;
  color: white;
  font-weight: bold;
}

.sort-order-toggle[data-order='desc'] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
  transform: rotate(180deg);
}

.filter-exclude-toggle--pokemon,
.filter-exclude-toggle--illustrator {
  top: 58px;
}

.filter-group select {
  padding-right: 40px; /* Make room for the exclude toggle */
}

/* Visual feedback when exclude mode is active */
.filter-group:has(.filter-exclude-toggle.active) select:not([value='']) {
  border-color: #cc3333;
  background-color: #fff5f5;
}

/* Pokémon filter with search */
.pokemon-filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pokemon-filter-search {
  padding: 6px 8px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  background: white;
  transition: border-color 0.3s;
}

.pokemon-filter-search:focus {
  outline: none;
  border-color: var(--color-primary);
}

.pokemon-filter-search::placeholder {
  color: #aaa;
  font-style: italic;
}

.filter-group-pokemon {
  min-width: 200px;
}

/* Illustrator filter with search */
.illustrator-filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.illustrator-filter-search {
  padding: 6px 8px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  background: white;
  transition: border-color 0.3s;
}

.illustrator-filter-search:focus {
  outline: none;
  border-color: var(--color-primary);
}

.illustrator-filter-search::placeholder {
  color: #aaa;
  font-style: italic;
}

.filter-group-illustrator {
  min-width: 200px;
}

/* Clear search button */
.clear-search-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: none;
  background: #999;
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.clear-search-btn:hover {
  background: #666;
  transform: translateY(-50%) scale(1.1);
}

/* ═══════════════════════════════════════════════════════════
   Mobile Warning Banner
   Shown on small screens, hidden on desktop.
   ═══════════════════════════════════════════════════════════ */

.mobile-warning-banner {
  display: none;
}

@media (max-width: 768px) {
  .mobile-warning-banner {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(135deg, var(--color-primary, #667eea) 0%, #764ba2 100%);
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .mobile-warning-banner.dismissed {
    display: none;
  }

  .mobile-warning-content {
    text-align: center;
    max-width: 340px;
  }

  .mobile-warning-mascot {
    width: 80px;
    height: 80px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  }

  .mobile-warning-title {
    font-size: 28px;
    margin: 0 0 20px;
    color: #fff;
  }

  .mobile-warning-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.6;
    margin: 0 0 28px;
  }

  .mobile-warning-btn {
    display: inline-block;
    padding: 14px 32px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .mobile-warning-btn:hover,
  .mobile-warning-btn:active {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.6);
  }
}
