/* TrustyBooker - UX Enhancements Styles */

/* Inline spinner for form buttons */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* Form validation styles */
.field-error {
  color: var(--danger, #e74c3c);
  font-size: 0.85rem;
  margin-top: 4px;
  display: block;
  animation: slideDown 0.2s ease-out;
}

.input-error {
  border-color: var(--danger, #e74c3c) !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
}

input:focus.input-error,
textarea:focus.input-error,
select:focus.input-error {
  border-color: var(--danger, #e74c3c) !important;
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2) !important;
}

.field-help {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
  display: block;
  line-height: 1.4;
  opacity: 0.8;
}

.char-counter {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
  transition: color 0.2s ease;
}

/* Theme toggle label */
.theme-label {
  margin-left: 4px;
}

@media (max-width: 767px) {
  .theme-label {
    display: none;
  }
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumbs a {
  color: var(--primary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.breadcrumbs a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.breadcrumbs span {
  color: var(--muted);
  opacity: 0.6;
}

.breadcrumbs .current {
  color: var(--text);
  font-weight: 600;
}

/* Social footer for tool pages */
.tool-social-footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.tool-social-footer h3 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  color: var(--text);
}

.tool-social-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.tool-social-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.tool-social-links a:hover {
  background: var(--panel-2, var(--panel));
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(91, 140, 255, 0.2);
}

.tool-social-links a svg,
.tool-social-links a img {
  width: 20px;
  height: 20px;
}

/* Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Date input enhancements */
input[type="date"] {
  position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Improved focus states */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading state improvements */
button.btn-loading {
  position: relative;
}

button.btn-loading .spinner {
  margin-right: 8px;
}

/* ===== COMPREHENSIVE MOBILE LAYOUT FIXES ===== */

/* Fix card form mobile layout */
@media (max-width: 768px) {
  #addForm {
    grid-template-columns: 1fr !important;
  }
  
  #addForm > div[style*="span 2"] {
    grid-column: span 1 !important;
  }
  
  #category-bonuses-ui > div:first-child {
    flex-direction: column;
  }
  
  #category-bonuses-ui select,
  #category-bonuses-ui input[type="number"] {
    width: 100% !important;
    min-width: unset !important;
  }
  
  /* Fix grids with large min-widths */
  .strategy-grid,
  .chart-grid {
    grid-template-columns: 1fr !important;
  }
  
  .simulator-grid,
  .tools-grid,
  .card-grid,
  .how-it-works-grid,
  .data-grid,
  .streak-cards,
  .mix-grid,
  .team-stats,
  .stat-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Fix inline grid styles - force single column */
  div[style*="grid-template-columns: repeat(3"],
  div[style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  
  div[style*="minmax(300px"],
  div[style*="minmax(320px"],
  div[style*="minmax(400px"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Fix tables - make them scrollable */
  .table-responsive,
  div:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  table {
    min-width: 100%;
  }
  
  /* Ensure all cards have proper padding on mobile */
  .card {
    padding: 16px !important;
  }
  
  /* Fix hero form stacking */
  #heroForm {
    flex-direction: column !important;
  }
  
  #heroForm input,
  #heroForm button {
    width: 100% !important;
  }
  
  /* Fix button groups */
  div[style*="display: flex"][style*="gap"] {
    flex-wrap: wrap !important;
  }
  
  /* Ensure text doesn't overflow */
  h1, h2, h3, h4, p {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  /* Reduce padding on very small screens */
  .card {
    padding: 12px !important;
  }
  
  /* Smaller fonts for headings */
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.3rem !important; }
  h3 { font-size: 1.1rem !important; }
  
  /* Stack all flex containers */
  .flex-row,
  div[style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
}
