/* ============================================
   FORGE DESIGN SYSTEM - Supplementary Styles
   Industrial Premium for B2B Sales
   ShelfWins Studio
   ============================================ */

/* ============================================
   ANIMATIONS - Smooth, substantial, professional
   ============================================ */

/* Skeleton Shimmer - Refined timing */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton-shimmer {
  background: linear-gradient(
    90deg,
    #E8E8E4 0%,
    #F5F5F7 50%,
    #E8E8E4 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

/* Fade animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.animate-fade-in-up {
  animation: fadeInUp 0.4s ease-out forwards;
}

.animate-fade-in-down {
  animation: fadeInDown 0.4s ease-out forwards;
}

/* Pulse Animation - Refined for professional feel */
@keyframes pulse-subtle {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.animate-pulse-subtle {
  animation: pulse-subtle 2s ease-in-out infinite;
}

/* Spin Animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

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

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

/* Scale In - Modal entrance */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-scale-in {
  animation: scaleIn 0.25s ease-out forwards;
}

/* Scale bounce - Success state */
@keyframes scaleBounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.animate-scale-bounce {
  animation: scaleBounce 0.3s ease-out forwards;
}

/* Slide In - Sidebars and drawers */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-left {
  animation: slideInLeft 0.3s ease-out forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.3s ease-out forwards;
}

/* Slide up - Toasts */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-in-up {
  animation: slideInUp 0.35s ease-out forwards;
}

/* Success/Error State Animations */
@keyframes successPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

.animate-success-pop {
  animation: successPop 0.3s ease-out forwards;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-3px);
  }
  40% {
    transform: translateX(3px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

.animate-shake {
  animation: shake 0.4s ease-out forwards;
}

/* ============================================
   FOCUS STATES - Copper accent focus rings
   ============================================ */

.focus-ring {
  outline: none;
}

.focus-ring:focus-visible {
  outline: 2px solid #C4683A;
  outline-offset: 2px;
}

.focus-ring-inset:focus-visible {
  outline: 2px solid #C4683A;
  outline-offset: -2px;
}

/* Dark background focus */
.focus-ring-light:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

/* ============================================
   DRAG AND DROP - Visual feedback
   ============================================ */

.drop-zone-active {
  border-color: #C4683A !important;
  background-color: rgba(196, 104, 58, 0.05) !important;
  box-shadow: inset 0 0 0 2px rgba(196, 104, 58, 0.1);
}

.dragging {
  opacity: 0.6;
  cursor: grabbing !important;
}

.drag-ghost {
  background: white;
  border: 2px dashed #C4683A;
  border-radius: 0.5rem;
  opacity: 0.9;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

/* ============================================
   PROGRESS BAR - Loading states
   ============================================ */

@keyframes progressIndeterminate {
  0% {
    left: -40%;
    width: 40%;
  }
  50% {
    left: 20%;
    width: 80%;
  }
  100% {
    left: 100%;
    width: 40%;
  }
}

.progress-bar {
  height: 4px;
  background: #E8E8E4;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #C4683A, #D88050);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.progress-indeterminate::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, #D88050, transparent);
  animation: progressIndeterminate 1.5s ease-in-out infinite;
}

/* ============================================
   TOOLTIP - Refined styling
   ============================================ */

.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: #1C1C1F;
  color: white;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: 0.375rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.tooltip:hover::after {
  opacity: 1;
}

/* Tooltip variants */
.tooltip-bottom::after {
  bottom: auto;
  top: calc(100% + 8px);
}

.tooltip-left::after {
  left: auto;
  right: calc(100% + 8px);
  bottom: 50%;
  transform: translateY(50%);
}

.tooltip-right::after {
  left: calc(100% + 8px);
  bottom: 50%;
  transform: translateY(50%);
}

/* ============================================
   TOAST CONTAINER - Position and animations
   ============================================ */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast-container > * {
  pointer-events: auto;
}

@keyframes toastEnter {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastExit {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
}

.toast-enter {
  animation: toastEnter 0.35s ease-out forwards;
}

.toast-exit {
  animation: toastExit 0.25s ease-in forwards;
}

/* ============================================
   CUSTOM SCROLLBAR VARIANTS
   ============================================ */

/* Thin scrollbar for sidebars */
.scrollbar-thin::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
  background: #C8C8D0;
  border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
  background: #9C9CA6;
}

/* Hidden scrollbar (still functional) */
.scrollbar-hidden {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollbar-hidden::-webkit-scrollbar {
  display: none;
}

/* Dark scrollbar for dark backgrounds */
.scrollbar-dark::-webkit-scrollbar-track {
  background: #1C1C1F;
}

.scrollbar-dark::-webkit-scrollbar-thumb {
  background: #4A4A50;
  border: 2px solid #1C1C1F;
}

.scrollbar-dark::-webkit-scrollbar-thumb:hover {
  background: #6B6B73;
}

/* ============================================
   FORM ELEMENTS - Enhanced styling
   ============================================ */

/* Select dropdown */
.select-base {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6B73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* Checkbox and Radio */
.checkbox-base,
.radio-base {
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid #C8C8D0;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
}

.checkbox-base {
  border-radius: 0.25rem;
}

.radio-base {
  border-radius: 50%;
}

.checkbox-base:checked,
.radio-base:checked {
  background: #C4683A;
  border-color: #C4683A;
}

.checkbox-base:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.radio-base:checked {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='4' fill='white'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.checkbox-base:focus-visible,
.radio-base:focus-visible {
  outline: 2px solid #C4683A;
  outline-offset: 2px;
}

/* ============================================
   TABLE STYLING - Professional data tables
   ============================================ */

.table-forge {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-forge th {
  background: #F5F5F7;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #4A4A50;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid #E8E8E4;
}

.table-forge td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #E8E8E4;
  color: #323236;
}

.table-forge tbody tr:hover {
  background: #FAFAF8;
}

.table-forge tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   METRIC CARDS - Financial data display
   ============================================ */

.metric-card {
  background: white;
  border: 1px solid #E8E8E4;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B6B73;
  margin-bottom: 0.375rem;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1C1C1F;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

.metric-value-positive {
  color: #2D6A4F;
}

.metric-value-negative {
  color: #B91C1C;
}

.metric-value-highlight {
  color: #C4683A;
}

.metric-change {
  font-size: 0.8125rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.metric-change-positive {
  color: #2D6A4F;
}

.metric-change-negative {
  color: #B91C1C;
}

/* ============================================
   EMPTY STATE - Professional placeholders
   ============================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  background: #F5F5F7;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: #9C9CA6;
}

.empty-state-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #323236;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  font-size: 0.9375rem;
  color: #6B6B73;
  max-width: 320px;
  line-height: 1.5;
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

:root.high-contrast {
  --hc-text: #000000;
  --hc-text-muted: #333333;
  --hc-bg: #ffffff;
  --hc-bg-secondary: #f5f5f5;
  --hc-border: #000000;
  --hc-border-light: #666666;
  --hc-primary: #8C4828;
  --hc-primary-hover: #6B3820;
  --hc-success: #006600;
  --hc-warning: #cc6600;
  --hc-error: #cc0000;
  --hc-focus: #000080;
}

.high-contrast body {
  color: var(--hc-text);
  background-color: var(--hc-bg);
}

.high-contrast *:focus-visible {
  outline: 3px solid var(--hc-focus) !important;
  outline-offset: 2px !important;
}

.high-contrast a {
  color: var(--hc-primary);
  text-decoration: underline;
}

.high-contrast button,
.high-contrast [role="button"] {
  border: 2px solid var(--hc-border) !important;
}

.high-contrast input,
.high-contrast textarea,
.high-contrast select {
  border: 2px solid var(--hc-border) !important;
  background-color: var(--hc-bg) !important;
  color: var(--hc-text) !important;
}

.high-contrast .skeleton-shimmer {
  animation: none !important;
  background: var(--hc-bg-secondary) !important;
  border: 1px dashed var(--hc-border-light) !important;
}

.high-contrast svg {
  stroke-width: 2.5 !important;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer {
    animation: none;
  }

  .animate-fade-in,
  .animate-fade-in-up,
  .animate-fade-in-down,
  .animate-scale-in,
  .animate-slide-in-up,
  .animate-slide-in-left,
  .animate-slide-in-right,
  .animate-success-pop,
  .animate-shake,
  .animate-pulse-subtle,
  .toast-enter,
  .toast-exit {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card,
  .card-elevated,
  .metric-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}
