/* ===== PIONEER'S BREWERY - OPTIMIZED DARK THEME ===== */
/* Buttons */
/* Buttons - Use Tailwind Utility Classes */
/* Pagination */
@import "components/pagination.css";
/* Card Preview */
/* @import "components/card-preview.css"; */
/* Slider */
@import "components/slider.css";
/* Scrollbar */
/* Scrollbar - Handled via Tailwind in base.html */
/* Inventory card table (Removed) */
/* @import "components/inventory_card_table.css"; */
/* Date Picker (Removed to use native/Tailwind) */
/* @import "components/datepicker.css"; */

/* Custom Select */
@import "components/custom-select.css";

[x-cloak] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
  /* Force vertical scrollbar to prevent layout shift */
  overflow-y: scroll;
}

/* Flash Messages */
.flash-success {
  @apply bg-emerald-600 border border-emerald-500 text-white;
}
.flash-error {
  @apply bg-red-600 border border-red-500 text-white;
}
.flash-warning {
  @apply bg-amber-600 border border-amber-500 text-white;
}
.flash-info {
  @apply bg-blue-600 border border-blue-500 text-white;
}

/* Cards */
.card {
  @apply bg-slate-800 border border-slate-700 rounded-lg shadow-lg;
}
.card-header {
  @apply px-6 py-4 border-b border-slate-700 bg-slate-800 rounded-t-lg;
}
.card-body {
  @apply px-6 py-4;
}
.card-footer {
  @apply px-6 py-4 border-t border-slate-700 bg-slate-800/50 rounded-b-lg flex justify-between items-center;
}

/* Forms - Optimized */
.form-input,
.search-input {
  @apply bg-slate-800 border-slate-600 text-slate-50 rounded-lg w-full h-10 px-3 transition-all duration-200 outline-none;
  border-width: 1px;
}
.form-input:focus,
.search-input:focus {
  @apply border-blue-500 ring-2 ring-blue-500/10;
}
.search-input {
  @apply pl-10;
}

.form-select {
  @apply bg-slate-900 border-slate-700 text-slate-50 rounded-lg w-full h-10 pl-3 pr-10 appearance-none outline-none transition-all duration-200;
  border-width: 1px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-size: 1.5em 1.5em;
  background-repeat: no-repeat;
}
.form-select option {
  @apply bg-slate-900 text-slate-50 p-2 text-center;
}
.form-select:hover {
  @apply bg-slate-800 border-slate-600;
}
.form-select:focus {
  @apply border-blue-500 ring-2 ring-blue-500/10;
}

/* Centered form select (for compact fields) */
.form-select-centered {
  @apply bg-slate-900 border-slate-700 text-slate-50 rounded-lg w-full h-10 px-2 outline-none cursor-pointer text-sm leading-6 transition-all duration-200;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem 1.25rem;
  border-width: 1px;
  text-align-last: center;
}

.form-select-centered:hover {
  @apply bg-slate-800 border-slate-600;
}

.form-select-centered option {
  @apply bg-slate-900 text-slate-50 p-2 text-center text-sm;
}

.form-select-centered:focus {
  @apply border-blue-500 ring-2 ring-blue-500/10;
}

input[type="checkbox"] {
  background: #1e293b !important;
  border: 1px solid #475569 !important;
  border-radius: 0.25rem !important;
  width: 1rem !important;
  height: 1rem !important;
  accent-color: #3b82f6 !important;
}

/* Search */
.search-container {
  position: relative !important;
}
.search-icon {
  position: absolute !important;
  left: 0.75rem !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 1.25rem !important;
  height: 1.25rem !important;
  color: #94a3b8 !important;
  pointer-events: none !important;
}

/* Filter Grid */
.filter-container {
  @apply bg-slate-800/50 p-6 mb-0;
}
.filter-grid {
  @apply grid gap-4;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .filter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .filter-grid {
    grid-template-columns: repeat(8, minmax(120px, 1fr));
  }
}

/* Badges */
.badge {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
}
.badge-primary {
  @apply bg-blue-800 text-blue-100;
}
.badge-success {
  @apply bg-emerald-800 text-emerald-100;
}
.badge-warning {
  @apply bg-amber-700 text-amber-100;
}
.badge-danger {
  @apply bg-red-800 text-red-100;
}
.badge-secondary {
  @apply bg-slate-600 text-slate-200;
}
.badge-condition {
  @apply bg-slate-600 text-slate-200;
}

/* MTG Rarity Colors */
.rarity-mythic {
  color: #ff6b35 !important;
  font-weight: 700 !important;
}
.rarity-rare {
  color: #ffd700 !important;
  font-weight: 700 !important;
}
.rarity-uncommon {
  color: #c0c0c0 !important;
  font-weight: 700 !important;
}
.rarity-common {
  color: #6b7280 !important;
  font-weight: 700 !important;
}
.rarity-default {
  color: #94a3b8 !important;
  font-weight: 500 !important;
}

/* MTG Mana Symbols */
.ms {
  display: inline-block !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}

.ms.ms-cost {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ============================================
   GRID VIEW COMPONENTS
   ============================================ */

/* Grid Layout - Handled via Tailwind utility classes in inventory.html */

/* Card Image Container with hover actions */
.card-image-container {
  position: relative;
  aspect-ratio: 5/7;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #475569; /* slate-600 */
  border-radius: 0.5rem;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-hover-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: none; /* Changed: Hidden by default, shown on hover */
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10;
}

@media (min-width: 768px) {
  .card-grid-item:hover .card-hover-actions,
  .card-hover-actions.force-visible {
    display: flex;
  }
}

.card-hover-btn {
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #475569;
  border-radius: 0.375rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.card-hover-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  color: #e2e8f0;
  border-color: #64748b;
}

.card-hover-btn-danger:hover {
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  border-color: #dc2626;
}

/* Checkbox в hover actions */
.card-hover-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #475569;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.card-hover-checkbox:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: #60a5fa;
}

.card-hover-checkbox input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(30, 41, 59, 0.9);
  border: 2px solid #475569;
  border-radius: 0.25rem;
  transition: all 0.2s;
  position: relative;
}

.card-hover-checkbox input[type="checkbox"]:hover {
  border-color: #60a5fa;
}

.card-hover-checkbox input[type="checkbox"]:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.card-hover-checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.05rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Table Checkbox Styles */
.form-checkbox {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(30, 41, 59, 0.9);
  border: 2px solid #475569;
  border-radius: 0.25rem;
  transition: all 0.2s;
  position: relative;
}

.form-checkbox:hover {
  border-color: #60a5fa;
}

.form-checkbox:checked {
  background: #3b82f6;
  border-color: #3b82f6;
}

.form-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.05rem;
  width: 0.3rem;
  height: 0.6rem;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Add Another Checkbox - Enhanced Style */
.add-another-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: #1e293b;
  border: 2px solid #475569;
  border-radius: 0.375rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  flex-shrink: 0;
}

.add-another-checkbox:hover {
  border-color: #60a5fa;
  background: #334155;
  transform: scale(1.05);
}

.add-another-checkbox:checked {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.add-another-checkbox:checked:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
}

.add-another-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.1rem;
  width: 0.35rem;
  height: 0.7rem;
  border: solid white;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  /* Animation: checkmark-pop (Configured in tailwind.config.js) */
  animation: checkmark-pop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.add-another-checkbox:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Foil Overlay for Grid Cards */
.foil-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Optimized Gradient: Double Rainbow for seamless 200% slide loop */
  background: linear-gradient(
    135deg,
    rgba(255, 0, 0, 0.5) 0%,
    rgba(255, 255, 0, 0.5) 8.3%,
    rgba(0, 255, 0, 0.5) 16.6%,
    rgba(0, 255, 255, 0.5) 25%,
    rgba(0, 0, 255, 0.5) 33.3%,
    rgba(255, 0, 255, 0.5) 41.6%,
    rgba(255, 0, 0, 0.5) 50%,
    rgba(255, 255, 0, 0.5) 58.3%,
    rgba(0, 255, 0, 0.5) 66.6%,
    rgba(0, 255, 255, 0.5) 75%,
    rgba(0, 0, 255, 0.5) 83.3%,
    rgba(255, 0, 255, 0.5) 91.6%,
    rgba(255, 0, 0, 0.5) 100%
  );
  background-size: 200% 200%;
  animation: foil-shine 5s linear infinite;
  mix-blend-mode: overlay;
  border-radius: inherit;
  will-change: background-position; /* Hint for animation */
}

/* Isolate blend modes to prevent page-wide compositing */
.card-image-container .relative {
  isolation: isolate;
}

/* Диагональная зацикленная анимация фойла - эффект "отливания" */
@keyframes foil-shine {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

.foil-badge {
  display: none;
}

.qty-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: bold;
  font-size: 0.875rem;
}

/* Card Info */
.card-info {
  padding: 1rem;
}

.card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #60a5fa;
  cursor: pointer;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  min-height: auto;
}

.card-name:hover {
  color: #93c5fd;
}

.card-printed-name {
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
  margin-bottom: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-printed-name:hover {
  color: #cbd5e1;
}

/* Meta Info */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
}

.meta-item {
  display: flex;
  gap: 0.25rem;
}

.meta-label {
  color: #64748b;
  font-weight: 500;
}

/* Footer */
.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #334155;
}

.card-price {
  font-size: 1.125rem;
  font-weight: bold;
  color: #10b981;
}

.card-rarity {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  color: #94a3b8;
}

/* Actions */
.card-actions {
  display: none;
}

.btn-icon-small {
  padding: 0.375rem;
  background: transparent;
  border: 1px solid #475569;
  border-radius: 0.375rem;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-small:hover {
  background: #334155;
  color: #e2e8f0;
  border-color: #64748b;
}

/* ============================================
   END GRID VIEW
   ============================================ */

/* Loading */
.loading-spinner {
  @apply animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500;
}

/* Custom reset animation */
@keyframes reset-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-180deg);
  }
}

.animate-reset-spin {
  animation: reset-spin 0.3s ease-out;
}

/* ============================================
   INTERACTIVE STATES
   ============================================ */
.btn-active-scale {
  @apply transition-transform duration-100 active:scale-95;
}

.card-active-scale {
  @apply transition-transform duration-100 active:scale-[0.98];
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
  @apply items-center px-3 py-1 rounded-full text-xs font-semibold uppercase tracking-wide;
}

/* ============================================
   ANIMATIONS & UTILITIES
   ============================================ */

/* Spin animation for loading states */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Sticky positioning helper */
.lg\:sticky {
  position: sticky;
}

.lg\:top-6 {
  top: 1.5rem;
}

/* Hover scale animation */
.hover\:scale-\[1\.02\]:hover {
  transform: scale(1.02);
}

/* Code tags inline styling */
code {
  padding: 0.125rem 0.25rem;
  border-radius: 0.25rem;
  font-size: 0.875em;
  font-family: "Monaco", "Menlo", "Consolas", monospace;
}

/* Kbd tags styling */
kbd {
  font-family: "Monaco", "Menlo", "Consolas", monospace;
  font-size: 0.75rem;
}

/* Focus ring styles for inputs */
.form-input:focus,
.form-select:focus,
textarea:focus {
  outline: none;
  transition: all 0.2s ease;
}

/* Shadow utilities */
.shadow-blue-500\/30 {
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.3),
    0 4px 6px -4px rgba(59, 130, 246, 0.3);
}

.shadow-green-500\/10 {
  box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.1),
    0 4px 6px -4px rgba(34, 197, 94, 0.1);
}

.shadow-purple-500\/10 {
  box-shadow: 0 10px 15px -3px rgba(168, 85, 247, 0.1),
    0 4px 6px -4px rgba(168, 85, 247, 0.1);
}

.shadow-blue-500\/10 {
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.1),
    0 4px 6px -4px rgba(59, 130, 246, 0.1);
}

.shadow-amber-500\/10 {
  box-shadow: 0 10px 15px -3px rgba(245, 158, 11, 0.1),
    0 4px 6px -4px rgba(245, 158, 11, 0.1);
}

/* ============================================
   TRADETOPIC PREVIEW STYLES
   ============================================ */

/* Ensure preview content is readable */
.bg-white a {
  color: #2563eb;
  text-decoration: underline;
}

.bg-white table {
  width: 100%;
  border-collapse: collapse;
}

.bg-white table th,
.bg-white table td {
  border: 1px solid #cbd5e1;
  padding: 8px;
  text-align: left;
}

.bg-white table th {
  background-color: #f1f5f9;
  font-weight: 600;
}

/* ============================================
   TABLE ROW ANIMATIONS
   ============================================ */

/* Анимация тряски для уведомлений */
/* Animation: shake (Configured in tailwind.config.js) */

/* Анимация появления строк таблицы */
/* Keyframes definition ensuring independence from Tailwind build */
@keyframes slideInRow {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Animation: slideInRow (Configured in tailwind.config.js) */
.table-row {
  /* Using standard utility if possible, but keeping class for cascade delay selector */
  animation: slideInRow 0.2s ease-out backwards;
}

/* Задержка анимации для каждой строки (эффект каскада) */
.table-row:nth-child(1) {
  animation-delay: 0.01s;
}
.table-row:nth-child(2) {
  animation-delay: 0.02s;
}
.table-row:nth-child(3) {
  animation-delay: 0.03s;
}
.table-row:nth-child(4) {
  animation-delay: 0.04s;
}
.table-row:nth-child(5) {
  animation-delay: 0.05s;
}
.table-row:nth-child(6) {
  animation-delay: 0.06s;
}
.table-row:nth-child(7) {
  animation-delay: 0.07s;
}
.table-row:nth-child(8) {
  animation-delay: 0.08s;
}
.table-row:nth-child(9) {
  animation-delay: 0.09s;
}
.table-row:nth-child(10) {
  animation-delay: 0.1s;
}
.table-row:nth-child(11) {
  animation-delay: 0.11s;
}
.table-row:nth-child(12) {
  animation-delay: 0.12s;
}
.table-row:nth-child(13) {
  animation-delay: 0.13s;
}
.table-row:nth-child(14) {
  animation-delay: 0.14s;
}
.table-row:nth-child(15) {
  animation-delay: 0.15s;
}
.table-row:nth-child(16) {
  animation-delay: 0.16s;
}
.table-row:nth-child(17) {
  animation-delay: 0.17s;
}
.table-row:nth-child(18) {
  animation-delay: 0.18s;
}
.table-row:nth-child(19) {
  animation-delay: 0.19s;
}
.table-row:nth-child(20) {
  animation-delay: 0.2s;
}
.table-row:nth-child(21) {
  animation-delay: 0.21s;
}
.table-row:nth-child(22) {
  animation-delay: 0.22s;
}
.table-row:nth-child(23) {
  animation-delay: 0.23s;
}
.table-row:nth-child(24) {
  animation-delay: 0.24s;
}
.table-row:nth-child(25) {
  animation-delay: 0.25s;
}
.table-row:nth-child(n + 26) {
  animation-delay: 0.26s;
}

/* Анимация появления карточек в Grid View */
/* Animation: fadeInCard (Configured in tailwind.config.js) */
.card-grid-item {
  animation: fadeInCard 0.3s ease-out backwards;
}

/* Задержка анимации для каждой карточки (эффект каскада) */
.card-grid-item:nth-child(1) {
  animation-delay: 0.03s;
}
.card-grid-item:nth-child(2) {
  animation-delay: 0.06s;
}
.card-grid-item:nth-child(3) {
  animation-delay: 0.09s;
}
.card-grid-item:nth-child(4) {
  animation-delay: 0.12s;
}
.card-grid-item:nth-child(5) {
  animation-delay: 0.15s;
}
.card-grid-item:nth-child(6) {
  animation-delay: 0.18s;
}
.card-grid-item:nth-child(7) {
  animation-delay: 0.21s;
}
.card-grid-item:nth-child(8) {
  animation-delay: 0.24s;
}
.card-grid-item:nth-child(9) {
  animation-delay: 0.27s;
}
.card-grid-item:nth-child(10) {
  animation-delay: 0.3s;
}
.card-grid-item:nth-child(11) {
  animation-delay: 0.33s;
}
.card-grid-item:nth-child(12) {
  animation-delay: 0.36s;
}
.card-grid-item:nth-child(13) {
  animation-delay: 0.39s;
}

@layer utilities {
  /* Standard Thin Scrollbar */
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: theme("colors.slate.400") transparent;
  }
  .scrollbar-thin::-webkit-scrollbar {
    @apply w-1.5 h-1.5;
  }
  .scrollbar-thin::-webkit-scrollbar-track {
    @apply bg-transparent;
  }
  .scrollbar-thin::-webkit-scrollbar-thumb {
    @apply bg-slate-400/30 rounded-full transition-colors;
  }
  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    @apply bg-slate-400/50;
  }

  /* Premium Glass Scrollbar */
  .custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #64748b transparent; /* slate-500 optimized */
  }
  .custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  .custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05); /* white/5 */
    border-radius: 9999px;
    margin: 4px;
  }
  .custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: rgba(100, 116, 139, 0.5); /* slate-500/50 */
    border-radius: 9999px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: background-color 0.2s;
  }
  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: rgba(148, 163, 184, 0.8); /* slate-400/80 */
  }
  .custom-scrollbar::-webkit-scrollbar-corner {
    @apply bg-transparent;
  }
}
