/* Life Counter Page Styles - Mobile First (320px-768px) - Mirrored Layout */

/* Prevent bounce scrolling and enable touch optimization */
.life-counter-container {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation; /* Disable 300ms tap delay */
  padding: 0.25rem;
  max-width: 600px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 3.5rem; /* Space for header bar */
  padding-bottom: calc(0.25rem + env(safe-area-inset-bottom)); /* Space for mobile nav buttons */
  overflow: hidden; /* Prevent scrolling */
  box-sizing: border-box;
}

/* Threshold Sections (Mirrored Layout) */
.threshold-section {
  padding: 0.5rem;
  background-color: var(--bg-elevated, #2a2a2a);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Opponent's threshold rotated 180° for mirrored view */
.opponent-threshold {
  transform: rotate(180deg);
}

.threshold-label {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  line-height: 1;
}

.threshold-elements {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.25rem;
  width: 100%;
}

.threshold-element {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-base, #1a1a1a);
  border-radius: 6px;
  min-width: 0;
  min-height: 80px;
  overflow: hidden;
}

.element-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 5;
  pointer-events: none;
  justify-content: center;
  padding: 0.5rem;
}

.element-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.element-counter-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color, #ffffff);
  text-align: center;
  user-select: none;
}

.element-decrement,
.element-increment {
  position: absolute;
  width: 100%;
  height: 50%;
  font-size: 1rem;
  font-weight: 700;
  background-color: transparent;
  color: rgba(255, 255, 255, 0.25);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 10;
  touch-action: manipulation;
}

.element-increment {
  top: 0;
  align-items: flex-start;
  padding-top: 0.25rem;
  color: rgba(74, 222, 128, 0.3);
}

.element-decrement {
  bottom: 0;
  align-items: flex-end;
  padding-bottom: 0.25rem;
  color: rgba(239, 68, 68, 0.3);
}

.element-decrement:hover,
.element-increment:hover {
  background-color: rgba(147, 51, 234, 0.1);
}

.element-increment:active {
  background-color: rgba(74, 222, 128, 0.15);
  color: rgba(74, 222, 128, 0.6);
}

.element-decrement:active {
  background-color: rgba(239, 68, 68, 0.15);
  color: rgba(239, 68, 68, 0.6);
}

/* Life Sections */
.life-section {
  padding: 0.5rem;
  background-color: var(--bg-elevated, #2a2a2a);
  border-radius: 8px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* Opponent's life rotated 180° for mirrored view */
.opponent-life {
  transform: rotate(180deg);
}

/* Life Display - Core Counter with Transparent Overlay Buttons */
.life-display {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.life-btn {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  min-height: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  background-color: transparent;
  color: rgba(255, 255, 255, 0.3);
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  z-index: 10;
}

.life-btn.increment {
  top: 0;
  align-items: flex-start;
  padding-top: 1rem;
  color: rgba(74, 222, 128, 0.4); /* Green with transparency */
}

.life-btn.decrement {
  bottom: 0;
  align-items: flex-end;
  padding-bottom: 1rem;
  color: rgba(239, 68, 68, 0.4); /* Red with transparency */
}

.life-btn:hover,
.life-btn:active {
  background-color: rgba(147, 51, 234, 0.1);
}

.life-btn.increment:active {
  background-color: rgba(74, 222, 128, 0.15);
  color: rgba(74, 222, 128, 0.7);
}

.life-btn.decrement:active {
  background-color: rgba(239, 68, 68, 0.15);
  color: rgba(239, 68, 68, 0.7);
}

.life-value-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 5;
  pointer-events: none; /* Allow clicks to pass through to buttons */
}

.life-value {
  font-size: 6rem;
  font-weight: 700;
  color: var(--text-color, #ffffff);
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1;
  user-select: none;
}

/* Life value color based on amount */
.life-value.critical {
  color: #ef4444;
  animation: pulse 1s ease-in-out infinite;
}

.life-value.low {
  color: #f59e0b;
}

.life-value.high {
  color: #4ade80;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}


/* Match Report Button */
#report-match-btn {
  width: 100%;
  padding: 1rem;
  font-size: 1.125rem;
  font-weight: 700;
  min-height: 56px;
  background-color: var(--secondary, #9333ea);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#report-match-btn:hover,
#report-match-btn:active {
  background-color: var(--secondary-hover, #7c3aed);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(147, 51, 234, 0.3);
}

#report-match-btn.hidden {
  display: none;
}

/* Button Styles (Standalone - no base CSS) */
.btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.btn-primary {
  background-color: var(--secondary, #9333ea);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:active {
  background-color: var(--secondary-hover, #7c3aed);
  transform: scale(0.98);
}

.btn-secondary {
  background-color: var(--bg-base, #1a1a1a);
  color: var(--text-color, #ffffff);
  border: 1px solid var(--border-color, #444);
}

.btn-secondary:hover,
.btn-secondary:active {
  background-color: var(--bg-hover, #333);
}

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
}

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

.text-muted {
  color: var(--text-muted, #888);
  font-size: 0.875rem;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background-color: var(--bg-elevated, #2a2a2a);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color, #444);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-color, #ffffff);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted, #888);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-color, #ffffff);
}

.modal-body {
  padding: 1.5rem;
}

.text-muted {
  color: var(--text-muted, #888);
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 48px; /* Touch target */
}

.btn-primary {
  background-color: var(--secondary, #9333ea);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:active {
  background-color: var(--secondary-hover, #7c3aed);
  transform: scale(0.98);
}

.btn-secondary {
  background-color: var(--bg-base, #1a1a1a);
  color: var(--text-color, #ffffff);
  border: 1px solid var(--border-color, #444);
}

.btn-secondary:hover,
.btn-secondary:active {
  background-color: var(--bg-hover, #333);
}

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
}

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

/* Responsive adjustments */
@media (max-width: 375px) {
  .life-value {
    font-size: 5rem;
  }

  .life-btn {
    font-size: 1.25rem;
  }

  .threshold-elements {
    gap: 0.25rem;
  }

  .threshold-element {
    min-height: 70px;
  }

  .element-icon {
    width: 24px;
    height: 24px;
  }

  .element-counter-value {
    font-size: 1.25rem;
  }

  .element-decrement,
  .element-increment {
    font-size: 0.875rem;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .life-section {
    padding: 1rem;
  }

  .life-value {
    font-size: 5rem;
  }

  .threshold-section {
    padding: 0.5rem;
  }
}

/* Larger screens can show even bigger life values */
@media (min-width: 376px) and (max-width: 768px) {
  .life-value {
    font-size: 8rem;
  }

  .life-btn {
    font-size: 1.75rem;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .life-btn,
  .counter-btn,
  .btn {
    border-width: 2px;
  }
}

/* ============================================================================
   Match Report Modal - Form Styles
   ============================================================================ */

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color, #ffffff);
  margin-bottom: 0.5rem;
}

.form-group label .required {
  color: #ef4444;
  margin-left: 0.25rem;
}

/* Form Controls */
.form-control {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  background-color: var(--bg-base, #1a1a1a);
  color: var(--text-color, #ffffff);
  border: 1px solid var(--border-color, #444);
  border-radius: 6px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--secondary, #9333ea);
  box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
}

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-control::placeholder {
  color: var(--text-muted, #888);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted, #888);
  margin-top: 0.25rem;
}

.form-error {
  display: block;
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
  font-weight: 600;
}

.form-error.hidden {
  display: none;
}

.form-control.invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.invalid:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* Autocomplete Dropdown */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-elevated, #2a2a2a);
  border: 1px solid var(--border-color, #444);
  border-radius: 6px;
  margin-top: 0.25rem;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1050;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-bottom: 1px solid rgba(68, 68, 68, 0.5);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background-color: rgba(147, 51, 234, 0.1);
}

.autocomplete-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.autocomplete-item-name {
  font-size: 0.875rem;
  color: var(--text-color, #ffffff);
  flex: 1;
}

.autocomplete-item-badge {
  font-size: 0.625rem;
  padding: 0.125rem 0.5rem;
  background-color: rgba(147, 51, 234, 0.2);
  color: #9333ea;
  border-radius: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.autocomplete-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted, #888);
  font-size: 0.875rem;
}

/* Selected Opponent Display */
.selected-opponent {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background-color: rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 6px;
  margin-top: 0.5rem;
}

.selected-opponent.hidden {
  display: none;
}

.opponent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.opponent-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color, #ffffff);
}

.clear-opponent {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted, #888);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.clear-opponent:hover {
  color: #ef4444;
}

/* Button Group (Turn Order Toggle) */
.button-group {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border-color, #444);
}

.btn-toggle {
  flex: 1;
  padding: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  background-color: var(--bg-base, #1a1a1a);
  color: var(--text-muted, #888);
  border: none;
  border-right: 1px solid var(--border-color, #444);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-toggle:last-child {
  border-right: none;
}

.btn-toggle:hover {
  background-color: rgba(147, 51, 234, 0.1);
}

.btn-toggle.active {
  background-color: var(--secondary, #9333ea);
  color: #ffffff;
}

/* Button Variants */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  min-height: 40px;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-muted, #888);
  border: 1px solid transparent;
}

.btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-color, #ffffff);
}

.btn-success {
  background-color: #10b981;
  color: #ffffff;
}

.btn-success:hover,
.btn-success:active {
  background-color: #059669;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading Indicator */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background-color: rgba(147, 51, 234, 0.1);
  border-radius: 6px;
  margin-bottom: 1rem;
}

.loading-indicator.hidden {
  display: none;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(147, 51, 234, 0.2);
  border-top-color: var(--secondary, #9333ea);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-indicator span {
  font-size: 0.875rem;
  color: var(--text-color, #ffffff);
}

/* Alert Messages */
.alert {
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.alert.hidden {
  display: none;
}

.alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Modal Footer */
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #444);
}

/* Match Summary Text */
.match-summary {
  font-size: 1rem;
  color: var(--text-color, #ffffff);
  margin-bottom: 1.5rem;
  text-align: center;
  font-weight: 600;
}

/* Mobile Responsive Adjustments */
@media (max-width: 480px) {
  .modal-content {
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 95vh;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

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

  #cancel-report-btn {
    flex-basis: 100%;
    order: 3;
  }
}

/* ============================================================================
   Confirmation Modal - Pending Confirmations & Details
   ============================================================================ */

/* Pending Confirmations List */
.pending-confirmations {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pending-confirmation-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--bg-base, #1a1a1a);
  border: 1px solid var(--border-color, #444);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pending-confirmation-item:hover {
  background-color: rgba(147, 51, 234, 0.1);
  border-color: var(--secondary, #9333ea);
}

.pending-confirmation-item img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}

.pending-confirmation-info {
  flex: 1;
}

.pending-confirmation-name {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color, #ffffff);
  margin-bottom: 0.25rem;
}

.pending-confirmation-summary {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted, #888);
}

.pending-confirmation-badge {
  padding: 0.25rem 0.75rem;
  background-color: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.loading-text {
  text-align: center;
  padding: 2rem;
}

/* Confirmation Details */
.confirmation-details {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.confirmation-details.hidden {
  display: none;
}

.confirmation-submitter {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: rgba(147, 51, 234, 0.1);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 8px;
}

.confirmation-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.confirmation-submitter-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.confirmation-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-color, #ffffff);
}

.confirmation-label {
  font-size: 0.875rem;
  color: var(--text-muted, #888);
}

/* Match Info Grid */
.confirmation-match-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background-color: var(--bg-base, #1a1a1a);
  border-radius: 8px;
}

.confirmation-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(68, 68, 68, 0.5);
}

.confirmation-info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted, #888);
}

.info-value {
  font-size: 0.875rem;
  color: var(--text-color, #ffffff);
  font-weight: 500;
}

.deck-link {
  font-size: 0.875rem;
  color: var(--secondary, #9333ea);
  text-decoration: none;
  transition: color 0.2s ease;
}

.deck-link:hover {
  color: #7c3aed;
  text-decoration: underline;
}

.confirmation-info-row.hidden {
  display: none;
}

/* Confirmation Actions */
.confirmation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color, #444);
}

/* Mobile Adjustments for Confirmation Modal */
@media (max-width: 480px) {
  .confirmation-submitter {
    flex-direction: column;
    text-align: center;
  }

  .confirmation-actions {
    flex-wrap: wrap;
  }

  .confirmation-actions .btn {
    flex: 1 1 auto;
  }

  #back-to-list-btn {
    flex-basis: 100%;
    order: 3;
  }
}
