/* HubCharge Components - shadcn/ui-inspired for Vanilla HTML + Tailwind */

/* ============================================
   BUTTONS
   ============================================ */

/* Base Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 0.75rem;
  transition: all 200ms ease-out;
  padding: 0.75rem 1.5rem;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  border: none;
  outline: none;
}

.btn:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

/* Button Sizes */
.btn-sm {
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  min-height: 32px;
}

.btn-md {
  font-size: 0.875rem;
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  min-height: 40px;
}

.btn-lg {
  font-size: 1rem;
  border-radius: 0.75rem;
  padding: 1rem 2rem;
  min-height: 48px;
}

.btn-xl {
  font-size: 1.125rem;
  border-radius: 1rem;
  font-weight: 600;
  padding: 1.25rem 2.5rem;
  min-height: 56px;
}

/* Primary Button - Orange brand */
.btn-primary {
  background: var(--brand-orange);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-orange-dark);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

/* Secondary Button */
.btn-secondary {
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-tertiary);
  border-color: var(--border-secondary);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--brand-orange);
  border: 1px solid var(--brand-orange);
}

.btn-outline:hover:not(:disabled) {
  background: var(--brand-orange-subtle);
}

/* Destructive Button */
.btn-danger,
.btn-destructive {
  background: var(--error);
  color: white;
}

.btn-danger:hover:not(:disabled),
.btn-destructive:hover:not(:disabled) {
  background: var(--error-light);
}

/* Link Button */
.btn-link {
  background: transparent;
  color: var(--brand-orange);
  padding: 0;
  height: auto;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-link:hover:not(:disabled) {
  color: var(--brand-orange-light);
}

/* Full Width */
.btn-block,
.w-full {
  width: 100%;
}

/* Icon Button */
.btn-icon {
  padding: 0.5rem;
  border-radius: 0.5rem;
  min-width: 40px;
  min-height: 40px;
}

.btn-icon-sm {
  padding: 0.375rem;
  border-radius: 0.375rem;
  min-width: 32px;
  min-height: 32px;
}

.btn-icon-lg {
  padding: 0.75rem;
  border-radius: 0.75rem;
  min-width: 48px;
  min-height: 48px;
}

/* ============================================
   INPUTS
   ============================================ */

/* Base Input */
.input {
  width: 100%;
  border-radius: 0.75rem;
  font-size: 1rem;
  transition: all 200ms ease-out;
  padding: 0.75rem 1rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  outline: none;
}

.input::placeholder {
  color: var(--text-tertiary);
}

.input:hover:not(:disabled):not(:focus) {
  border-color: var(--border-secondary);
}

.input:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--ring-color);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-secondary);
}

/* Input Sizes */
.input-sm {
  font-size: 0.875rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.input-lg {
  font-size: 1.125rem;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

/* Input with error state */
.input-error,
.input.error {
  border-color: var(--error);
}

.input-error:focus,
.input.error:focus {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-subtle);
}

/* Input with success state */
.input-success,
.input.success {
  border-color: var(--success);
}

/* ============================================
   SELECT
   ============================================ */

.select {
  width: 100%;
  border-radius: 0.75rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 200ms ease-out;
  appearance: none;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  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='%23888888' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem;
  outline: none;
}

.select:hover:not(:disabled) {
  border-color: var(--border-secondary);
}

.select:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--ring-color);
}

.select-sm {
  font-size: 0.875rem;
  border-radius: 0.5rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
}

/* ============================================
   TEXTAREA
   ============================================ */

.textarea {
  width: 100%;
  border-radius: 0.75rem;
  font-size: 1rem;
  resize: vertical;
  min-height: 100px;
  transition: all 200ms ease-out;
  padding: 0.75rem 1rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  outline: none;
}

.textarea::placeholder {
  color: var(--text-tertiary);
}

.textarea:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--ring-color);
}

/* ============================================
   LABELS
   ============================================ */

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.label-required::after {
  content: " *";
  color: var(--error);
}

/* ============================================
   CARDS
   ============================================ */

/* Base Card */
.card {
  border-radius: 1rem;
  transition: all 200ms ease;
  padding: 1.5rem;
  background: var(--surface-primary);
  border: 1px solid var(--border-primary);
  box-shadow: var(--shadow-card);
}

/* Card Variants */
.card-elevated {
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
}

.card-ghost {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Card Interactive */
.card-hover,
.card-interactive {
  cursor: pointer;
}

.card-hover:hover,
.card-interactive:hover {
  border-color: var(--brand-orange);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-selected {
  border-color: var(--brand-orange);
  background: var(--surface-tertiary);
}

/* Card Sections */
.card-header {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-primary);
}

.card-footer {
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border-primary);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  transition: color 200ms ease;
  padding: 0.25rem 0.75rem;
  background: var(--surface-secondary);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--brand-orange);
  color: var(--text-inverse);
}

.badge-secondary {
  background: var(--surface-tertiary);
  color: var(--text-primary);
}

.badge-success {
  background: var(--success-subtle);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.badge-error,
.badge-destructive {
  background: var(--error-subtle);
  color: var(--error);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
}

/* ============================================
   CHECKBOX
   ============================================ */

.checkbox {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: all 200ms ease;
  background: var(--surface-primary);
  border: 2px solid var(--border-secondary);
  flex-shrink: 0;
}

.checkbox:hover:not(:disabled) {
  border-color: var(--brand-orange);
}

.checkbox:checked {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.checkbox:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}

.checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Checkbox Group Item */
.checkbox-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 200ms ease;
}

.checkbox-item:hover {
  background: var(--surface-secondary);
}

/* ============================================
   RADIO
   ============================================ */

.radio {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms ease;
  background: var(--surface-primary);
  border: 2px solid var(--border-secondary);
  flex-shrink: 0;
}

.radio:hover:not(:disabled) {
  border-color: var(--brand-orange);
}

.radio:checked {
  border-color: var(--brand-orange);
  background: var(--brand-orange);
  box-shadow: inset 0 0 0 3px var(--surface-primary);
}

/* ============================================
   SWITCH / TOGGLE
   ============================================ */

.switch {
  appearance: none;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 200ms ease-in-out;
  background: var(--surface-tertiary);
  position: relative;
}

.switch::before {
  content: "";
  position: absolute;
  top: 0.125rem;
  left: 0.125rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  transition: transform 200ms ease-in-out;
  background: white;
  box-shadow: var(--shadow-sm);
}

.switch:checked {
  background: var(--brand-orange);
}

.switch:checked::before {
  transform: translateX(1.25rem);
}

/* ============================================
   ALERTS / MESSAGES
   ============================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  padding: 1rem;
  background: var(--surface-secondary);
  border: 1px solid var(--border-primary);
}

.alert-success {
  background: var(--success-subtle);
  border-color: var(--success);
  color: var(--success);
}

.alert-warning {
  background: var(--warning-subtle);
  border-color: var(--warning);
  color: var(--warning);
}

.alert-error,
.alert-destructive {
  background: var(--error-subtle);
  border-color: var(--error);
  color: var(--error);
}

.alert-info {
  background: var(--info-subtle);
  border-color: var(--info);
  color: var(--info);
}

/* Message variant (simpler) */
.message {
  font-size: 0.875rem;
  text-align: center;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

.message-success,
.message.success {
  background: var(--success-subtle);
  color: var(--success);
  border: 1px solid var(--success);
}

.message-error,
.message.error {
  background: var(--error-subtle);
  color: var(--error);
  border: 1px solid var(--error);
}

/* ============================================
   SKELETON LOADER
   ============================================ */

.skeleton {
  border-radius: 0.5rem;
  background: linear-gradient(
    90deg,
    var(--surface-secondary) 25%,
    var(--surface-tertiary) 50%,
    var(--surface-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite linear;
}

.skeleton-text {
  height: 1rem;
  border-radius: 0.25rem;
}

.skeleton-heading {
  height: 1.5rem;
  width: 75%;
  border-radius: 0.25rem;
}

.skeleton-avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
}

.skeleton-card {
  height: 8rem;
  border-radius: 1rem;
}

/* ============================================
   SPINNER
   ============================================ */

.spinner {
  display: inline-block;
  border-radius: 9999px;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-primary);
  border-top-color: var(--brand-orange);
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.spinner-xl {
  width: 56px;
  height: 56px;
  border-width: 5px;
}

/* ============================================
   DIVIDER
   ============================================ */

.divider {
  margin: 1.5rem 0;
  height: 1px;
  background: var(--border-primary);
}

.divider-vertical {
  margin: 0 1rem;
  width: 1px;
  height: auto;
  align-self: stretch;
  background: var(--border-primary);
}

.divider-text {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-primary);
}

.divider-text::before {
  margin-right: 1rem;
}

.divider-text::after {
  margin-left: 1rem;
}

/* ============================================
   AVATAR
   ============================================ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 500;
  overflow: hidden;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--surface-tertiary);
  color: var(--text-secondary);
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.875rem;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.25rem;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   OTP INPUT (Special style for verification codes)
   ============================================ */

.otp-input {
  text-align: center;
  font-weight: 600;
  border-radius: 0.75rem;
  transition: all 200ms ease;
  width: 48px;
  height: 60px;
  font-size: 1.5rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
  outline: none;
}

.otp-input:hover:not(:disabled):not(:focus) {
  border-color: var(--border-secondary);
}

.otp-input:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--ring-color);
}

.otp-input::placeholder {
  color: var(--text-tertiary);
}

/* Mobile optimization */
@media (max-width: 480px) {
  .otp-input {
    width: 42px;
    height: 52px;
    font-size: 1.25rem;
  }
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress {
  width: 100%;
  height: 0.5rem;
  border-radius: 9999px;
  overflow: hidden;
  background: var(--surface-tertiary);
}

.progress-bar {
  height: 100%;
  border-radius: 9999px;
  transition: all 500ms ease-out;
  background: var(--brand-orange);
}

.progress-indeterminate .progress-bar {
  width: 30%;
  animation: progress-indeterminate 1.5s infinite ease-in-out;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

/* ============================================
   ICON BUTTON (Theme toggle, etc.)
   ============================================ */

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 200ms ease;
  padding: 0.5rem;
  background: var(--surface-secondary);
  border: 1px solid var(--border-primary);
  color: var(--text-secondary);
  cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
  background: var(--surface-tertiary);
  border-color: var(--brand-orange);
  color: var(--text-primary);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   LANGUAGE SELECT (Special compact style)
   ============================================ */

.language-select {
  font-size: 0.875rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 200ms ease;
  appearance: none;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  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='%23888888' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1rem;
  outline: none;
}

.language-select:hover:not(:disabled) {
  border-color: var(--brand-orange);
}

.language-select:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px var(--ring-color);
}

/* ============================================
   UTILITY TEXT CLASSES
   ============================================ */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-muted { color: var(--text-muted); }
.text-orange { color: var(--brand-orange); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  max-width: 100%;
}

@media (min-width: 640px) {
  .container { max-width: 640px; }
}

@media (min-width: 768px) {
  .container { max-width: 768px; }
}

@media (min-width: 1024px) {
  .container { max-width: 1024px; }
}

/* Center content utility */
.center-content {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* ============================================
   SPACING UTILITIES (matching design tokens)
   ============================================ */

.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }

.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

/* ============================================
   GOOGLE/OAUTH BUTTON
   ============================================ */

.btn-google,
.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  font-weight: 500;
  border-radius: 0.75rem;
  transition: all 200ms ease;
  padding: 0.875rem 1.5rem;
  background: var(--surface-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-primary);
  cursor: pointer;
}

.btn-google:hover:not(:disabled),
.btn-oauth:hover:not(:disabled) {
  background: var(--surface-secondary);
  border-color: var(--border-secondary);
  transform: translateY(-1px);
}

.btn-google svg,
.btn-oauth svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
