/* CoreMineCapital Unified Button System */
/* Consistent button styling across all pages with CM emerald theme */

.cm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  position: relative;
  min-height: 40px;
  white-space: nowrap;
}

/* Primary button - Main CM emerald style */
.cm-btn--primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.cm-btn--primary:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #047857;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.cm-btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

.cm-btn--primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.4), 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* Secondary button - Outlined emerald style */
.cm-btn--secondary {
  background: transparent;
  color: #10b981;
  border-color: #10b981;
}

.cm-btn--secondary:hover {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: #059669;
  transform: translateY(-1px);
}

.cm-btn--secondary:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

/* Ghost button - Subtle style */
.cm-btn--ghost {
  background: rgba(16, 185, 129, 0.05);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.2);
}

.cm-btn--ghost:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.4);
}

/* Danger button */
.cm-btn--danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.cm-btn--danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

/* Success button */
.cm-btn--success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  border-color: #16a34a;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}

.cm-btn--success:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border-color: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
}

/* Button sizes */
.cm-btn--sm {
  padding: 6px 12px;
  font-size: 12px;
  min-height: 32px;
}

.cm-btn--lg {
  padding: 14px 24px;
  font-size: 16px;
  min-height: 48px;
}

.cm-btn--xl {
  padding: 18px 32px;
  font-size: 18px;
  min-height: 56px;
}

/* Icon buttons */
.cm-btn--icon {
  padding: 10px;
  min-width: 40px;
  min-height: 40px;
}

.cm-btn--icon.cm-btn--sm {
  padding: 6px;
  min-width: 32px;
  min-height: 32px;
}

.cm-btn--icon.cm-btn--lg {
  padding: 14px;
  min-width: 48px;
  min-height: 48px;
}

/* Full width button */
.cm-btn--full {
  width: 100%;
}

/* Disabled state */
.cm-btn:disabled,
.cm-btn--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.cm-btn:disabled:hover,
.cm-btn--disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Loading state */
.cm-btn--loading {
  position: relative;
  color: transparent;
}

.cm-btn--loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: cm-spin 1s linear infinite;
}

@keyframes cm-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
  .cm-btn--secondary {
    color: #6ee7b7;
    border-color: #6ee7b7;
  }

  .cm-btn--secondary:hover {
    background: rgba(110, 231, 183, 0.1);
    color: #34d399;
    border-color: #34d399;
  }

  .cm-btn--ghost {
    background: rgba(110, 231, 183, 0.05);
    color: #6ee7b7;
    border-color: rgba(110, 231, 183, 0.2);
  }

  .cm-btn--ghost:hover {
    background: rgba(110, 231, 183, 0.15);
    color: #34d399;
    border-color: rgba(110, 231, 183, 0.4);
  }
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .cm-btn {
    min-height: 44px; /* Touch-friendly minimum */
    padding: 12px 16px;
  }

  .cm-btn--sm {
    min-height: 36px;
    padding: 8px 12px;
  }

  .cm-btn--lg {
    min-height: 52px;
    padding: 16px 24px;
  }

  .cm-btn--xl {
    min-height: 60px;
    padding: 20px 32px;
  }
}

/* Button groups */
.cm-btn-group {
  display: inline-flex;
  border-radius: 10px;
  overflow: hidden;
}

.cm-btn-group .cm-btn {
  border-radius: 0;
  border-right-width: 1px;
}

.cm-btn-group .cm-btn:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.cm-btn-group .cm-btn:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  border-right-width: 2px;
}

.cm-btn-group .cm-btn:not(:last-child) {
  border-right-color: rgba(255, 255, 255, 0.2);
}
