/* ==========================================================================
   OCP Java 17 Prep — Components (Buttons, Cards, Badges, Modals, Floats)
   ========================================================================== */

/* Button groups & rows with explicit gaps */
.button-row,
.hero-actions,
.card-foot,
.nav-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.button-row.centered {
  justify-content: center;
}

/* Universal Button */
.button,
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.button:hover,
a.button:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--text);
  transform: translateY(-1px);
  text-decoration: none;
}

.button:active,
a.button:active {
  transform: translateY(0);
}

.button:disabled,
a.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: none;
}

/* Primary Button */
.button.primary,
a.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 0 14px var(--primary-glow);
}

.button.primary:hover,
a.button.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 109, 245, 0.4);
  transform: translateY(-1px);
}

/* Danger Button */
.danger-button {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.3);
}

.danger-button:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* Small Button */
.small-button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

/* Cards */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: var(--border-strong);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.card-foot {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card.empty {
  text-align: center;
  padding: 36px 20px;
}

.muted-card {
  border-style: dashed;
  background: transparent;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-strong);
  background: var(--surface-elevated);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Progress Bar */
.progress {
  height: 6px;
  background: var(--surface-hover);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 10px 0 6px;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #6366f1);
  border-radius: inherit;
  transition: width 0.3s ease;
}

/* Modal Dialog */
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  min-width: min(440px, calc(100% - 32px));
  max-width: 90vw;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

dialog h2 {
  margin: 0 0 16px;
  font-size: 1.3rem;
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}

dialog label.toggle {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  margin: 4px 0;
}

dialog select {
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.9rem;
}

dialog .button {
  width: 100%;
  margin-top: 2px;
}

.file-button input {
  display: none;
}

/* Scroll To Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.scroll-top-btn:active {
  transform: translateY(0);
}

@media (max-width: 560px) {
  .scroll-top-btn {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Visibility utility (used by code-trap reveals) */
.hidden {
  display: none !important;
}
