/* Custom styles for Crypto Portfolio Tracker */

/* Sticky banner positioning */
.sticky-banner {
  position: sticky;
  top: 56px; /* Height of navbar */
  z-index: 1020;
}

/* Stale price styling */
.stale-price,
.price[data-stale="true"] {
  color: #6c757d !important;
  opacity: 0.6;
  transition: opacity 0.3s ease, color 0.3s ease;
}

/* Refresh button rotating animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotating {
  animation: rotate 1s linear infinite;
}

/* Mobile optimizations */
@media (max-width: 576px) {
  .navbar-brand {
    font-size: 1rem;
  }

  .list-group-item {
    padding: 0.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .btn-group-sm > .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
}

/* Prevent text selection on buttons */
button {
  user-select: none;
  -webkit-user-select: none;
}

/* Better touch targets for mobile */
.list-group-item button {
  min-width: 36px;
  min-height: 36px;
}

/* Modal animations */
.modal.fade .modal-dialog {
  transition: transform 0.3s ease-out;
}

/* Empty state icon */
#emptyState i {
  display: block;
  margin: 0 auto;
}

/* Total value emphasis */
#totalValue {
  font-weight: 700;
  color: #0d6efd;
}

/* Loading spinner for add button */
#addSpinner {
  width: 1rem;
  height: 1rem;
}

/* Toast container positioning for mobile */
@media (max-width: 576px) {
  .toast-container {
    left: 0;
    right: 0;
    bottom: 0 !important;
    padding: 0.5rem !important;
  }

  .toast {
    width: 100%;
  }
}

/* Ensure proper spacing on mobile */
body {
  padding-bottom: env(safe-area-inset-bottom);
}

/* PWA splash screen styling */
@media (display-mode: standalone) {
  body {
    background-color: #f8f9fa;
  }
}

/* Input styling improvements */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* Uppercase ticker input */
#tickerInput {
  text-transform: uppercase;
}

/* Better focus states for accessibility */
button:focus,
input:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* List group item hover effect */
.list-group-item {
  transition: background-color 0.2s ease;
}

.list-group-item:hover {
  background-color: #f8f9fa;
}

/* Price display styling */
.price {
  font-weight: 600;
}

/* Smooth transitions */
* {
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

button, a, input {
  transition: all 0.15s ease-in-out;
}

/* Swipeable list items */
.swipeable-item {
  position: relative;
  overflow: hidden;
  padding: 0 !important;
  touch-action: pan-y; /* Allow vertical scrolling */
}

.swipe-content {
  position: relative;
  background: white;
  padding: 0.75rem 1rem;
  z-index: 2;
  will-change: transform;
}

.swipe-actions {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 1;
}

.swipe-action {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  padding: 0;
  width: 70px;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.swipe-action:active {
  opacity: 0.8;
}

.edit-action {
  background-color: #0d6efd;
}

.edit-action:hover {
  background-color: #0b5ed7;
}

.delete-action {
  background-color: #dc3545;
}

.delete-action:hover {
  background-color: #bb2d3b;
}

/* Compressed row layout */
.list-group-item h6 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem !important;
}

.list-group-item small {
  font-size: 0.8rem;
  line-height: 1.2;
}

.list-group-item .price {
  font-size: 0.95rem;
}

/* Remove hover effect on swipeable items */
.swipeable-item:hover {
  background-color: transparent;
}

/* Reduce spacing on mobile */
@media (max-width: 576px) {
  .swipe-content {
    padding: 0.6rem 0.8rem;
  }

  .list-group-item h6 {
    font-size: 1rem;
  }

  .list-group-item small {
    font-size: 0.75rem;
  }

  .swipe-action {
    width: 65px;
    font-size: 1.1rem;
  }
}
