/* ==========================================================================
   SPDLAB.hu — components.css
   Reusable UI components: buttons, badges, cards, tags, separators,
   code snippets, stat blocks, icons.
   ========================================================================== */

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */

/* Base button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--btn-height-md);
    padding-inline: var(--btn-padding-x-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-wide);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-all);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1;
    user-select: none;
}

/* Shimmer pseudo-element (activated on hover by JS/CSS) */
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.06) 0%,
        transparent 60%
    );
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-out-quart);
}

.btn:hover::before {
    opacity: 1;
}

/* Size variants */
.btn--sm {
    height: var(--btn-height-sm);
    padding-inline: var(--btn-padding-x-sm);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn--lg {
    height: var(--btn-height-lg);
    padding-inline: var(--btn-padding-x-lg);
    font-size: var(--text-md);
    border-radius: var(--radius-lg);
}

/* — Primary: Accent-filled */
.btn--primary {
    background-color: var(--color-accent);
    color: var(--color-text-inverse);
    border-color: transparent;
    font-weight: var(--fw-medium);
    position: relative;
    overflow: hidden;
}

.btn--primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255, 255, 255, 0.18) 50%,
        transparent 60%
    );
    transform: translateX(-100%);
    transition: transform 0.55s var(--ease-out-expo);
}

.btn--primary:hover {
    background-color: var(--color-accent-hover);
    box-shadow:
        0 0 0 3px var(--color-accent-dim),
        var(--shadow-accent-sm);
    transform: translateY(-1px);
}

.btn--primary:hover::after {
    transform: translateX(100%);
}

.btn--primary:active {
    transform: translateY(0);
    background-color: var(--color-accent);
    box-shadow: none;
}

/* — Secondary: Ghost / outlined */
.btn--secondary {
    background-color: transparent;
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn--secondary:hover {
    background-color: var(--color-surface);
    border-color: var(--color-graphite);
    color: var(--color-white);
    transform: translateY(-1px);
}

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

/* — Ghost: No border, minimal */
.btn--ghost {
    background-color: transparent;
    color: var(--color-text-secondary);
    border-color: transparent;
}

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

/* — Accent-dim: Subtle accent tinted background */
.btn--accent-dim {
    background-color: var(--color-accent-dim);
    color: var(--color-accent);
    border-color: var(--color-accent-muted);
}

.btn--accent-dim:hover {
    background-color: rgba(0, 212, 170, 0.18);
    box-shadow: var(--shadow-accent-sm);
    transform: translateY(-1px);
}

/* — Danger */
.btn--danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn--danger:hover {
    background-color: rgba(239, 68, 68, 0.25);
}

/* Icon-only circular buttons */
.btn--icon {
    width: var(--btn-height-md);
    height: var(--btn-height-md);
    padding-inline: 0;
    border-radius: var(--radius-full);
}

.btn--icon.btn--sm {
    width: var(--btn-height-sm);
    height: var(--btn-height-sm);
}

/* Disabled state */
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button with arrow icon */
.btn__arrow {
    transition: transform var(--duration-normal) var(--ease-out-quart);
}

.btn:hover .btn__arrow {
    transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   BADGES
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: var(--badge-height);
    padding-inline: var(--badge-padding-x);
    border-radius: var(--badge-radius);
    font-size: var(--badge-font-size);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}

.badge--accent {
    background-color: var(--color-accent-dim);
    color: var(--color-accent);
    border: 1px solid var(--color-accent-muted);
}

.badge--surface {
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
    border: var(--border-default);
}

.badge--outline {
    background-color: transparent;
    color: var(--color-text-tertiary);
    border: var(--border-default);
}

.badge--dot::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   TAGS
   -------------------------------------------------------------------------- */

.tag {
    display: inline-flex;
    align-items: center;
    height: var(--tag-height);
    padding-inline: var(--tag-padding-x);
    border-radius: var(--tag-radius);
    font-size: var(--tag-font-size);
    font-family: var(--font-mono);
    font-weight: var(--fw-regular);
    background-color: var(--color-surface);
    color: var(--color-text-tertiary);
    border: var(--border-subtle);
    white-space: nowrap;
    transition: var(--transition-color);
}

.tag--accent {
    background-color: var(--color-accent-dim);
    color: var(--color-accent);
    border-color: transparent;
}

.tag--interactive {
    cursor: pointer;
}

.tag--interactive:hover {
    background-color: var(--color-surface-raised);
    color: var(--color-text-secondary);
    border-color: var(--color-border);
}

/* --------------------------------------------------------------------------
   CARDS
   -------------------------------------------------------------------------- */

.card {
    position: relative;
    background-color: var(--color-surface);
    border: var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    transition: var(--transition-all);
    overflow: hidden;
}

.card::before {
    /* Inset highlight on top edge */
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.06) 50%,
        transparent 100%
    );
    pointer-events: none;
}

/* Card sizes */
.card--lg {
    padding: var(--card-padding-lg);
}

.card--sm {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
}

/* Hoverable card — lifts on hover */
.card--hover {
    cursor: pointer;
}

.card--hover:hover {
    background-color: var(--color-surface-raised);
    border-color: var(--color-graphite);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Card with accent top-border glow */
.card--accent {
    border-top-color: var(--color-accent-muted);
    box-shadow: var(--shadow-accent-sm);
}

.card--accent:hover {
    box-shadow: var(--shadow-accent-md);
}

/* Card internals */
.card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background-color: var(--color-accent-dim);
    color: var(--color-accent);
    margin-bottom: var(--space-4);
    flex-shrink: 0;
}

.card__icon svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.card__label {
    margin-bottom: var(--space-2);
}

.card__title {
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-tight);
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    line-height: var(--lh-snug);
}

.card__body {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--lh-relaxed);
}

.card__footer {
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: var(--border-subtle);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   STAT / METRIC BLOCKS
   -------------------------------------------------------------------------- */

.stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.stat__value {
    font-size: var(--text-3xl);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-tight);
    color: var(--color-text-primary);
    line-height: 1;
}

.stat__value--accent {
    color: var(--color-accent);
}

.stat__label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--lh-normal);
}

/* --------------------------------------------------------------------------
   SEPARATORS
   -------------------------------------------------------------------------- */

.separator {
    display: block;
    width: 100%;
    height: 1px;
    background-color: var(--color-border);
    border: none;
}

.separator--vertical {
    width: 1px;
    height: auto;
    align-self: stretch;
}

.separator--accent {
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-accent-muted) 20%,
        var(--color-accent-muted) 80%,
        transparent
    );
}

.separator--glow {
    background: linear-gradient(
        90deg,
        transparent,
        var(--color-accent) 50%,
        transparent
    );
    height: 1px;
    box-shadow: 0 0 8px var(--color-accent-muted);
}

/* --------------------------------------------------------------------------
   FEATURE LIST ITEMS
   -------------------------------------------------------------------------- */

.feature-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.feature-list__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: var(--lh-relaxed);
}

/* The checkmark / icon */
.feature-list__item::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2300d4aa'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex-shrink: 0;
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   PIPELINE / PROCESS STEPS
   -------------------------------------------------------------------------- */

.pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding-block: var(--space-2);
}

.pipeline-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.pipeline-step__node {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    border: var(--border-default);
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
    transition: var(--transition-all);
    position: relative;
}

.pipeline-step__node.is-active {
    background-color: var(--color-accent-dim);
    border-color: var(--color-accent-muted);
    color: var(--color-accent);
    box-shadow: var(--shadow-accent-sm);
}

.pipeline-step__connector {
    width: 32px;
    height: 1px;
    background-color: var(--color-border);
    position: relative;
    overflow: hidden;
}

.pipeline-step__connector::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--color-accent);
    animation: pipeline-flow 1.8s var(--ease-out-expo) infinite;
}

@keyframes pipeline-flow {
    0% {
        left: -100%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        left: 100%;
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   CODE SNIPPET BLOCK
   -------------------------------------------------------------------------- */

.code-block {
    background-color: var(--color-surface);
    border: var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.code-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background-color: var(--color-surface-raised);
    border-bottom: var(--border-subtle);
}

.code-block__dots {
    display: flex;
    gap: 6px;
}

.code-block__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--color-graphite);
}

.code-block__dot:nth-child(1) {
    background-color: #ff5f57;
}
.code-block__dot:nth-child(2) {
    background-color: #febc2e;
}
.code-block__dot:nth-child(3) {
    background-color: #28c840;
}

.code-block__filename {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--color-text-tertiary);
}

.code-block__body {
    padding: var(--space-6);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: var(--lh-relaxed);
    color: var(--color-text-secondary);
    overflow-x: auto;
}

/* Syntax colouring — manual classes */
.token-keyword {
    color: #c792ea;
}
.token-string {
    color: #c3e88d;
}
.token-number {
    color: #f78c6c;
}
.token-comment {
    color: var(--color-text-tertiary);
    font-style: italic;
}
.token-accent {
    color: var(--color-accent);
}
.token-fn {
    color: #82aaff;
}

/* --------------------------------------------------------------------------
   NAV LINK
   -------------------------------------------------------------------------- */

.nav-link {
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--color-text-secondary);
    transition: color var(--duration-normal) var(--ease-out-quart);
    padding-block: var(--space-1);
    position: relative;
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-accent);
    transition: width var(--duration-normal) var(--ease-out-quart);
}

.nav-link:hover {
    color: var(--color-text-primary);
}

.nav-link:hover::after,
.nav-link.is-active::after {
    width: 100%;
}

.nav-link.is-active {
    color: var(--color-text-primary);
}

/* --------------------------------------------------------------------------
   LOGO MARK
   -------------------------------------------------------------------------- */

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--color-text-primary);
}

.logo__mark {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    position: relative;
}

.logo__wordmark {
    font-size: var(--text-md);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-tight);
    color: var(--color-text-primary);
}

.logo__wordmark span {
    color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   TRUST LOGO STRIP
   -------------------------------------------------------------------------- */

.trust-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-6);
    background-color: var(--color-surface);
    border: var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: var(--ls-widest);
    color: var(--color-text-tertiary);
    transition: var(--transition-all);
    font-family: var(--font-mono);
    cursor: default;
    user-select: none;
}

.trust-logo:hover {
    color: var(--color-text-secondary);
    border-color: var(--color-graphite);
    background-color: var(--color-surface-raised);
}

/* --------------------------------------------------------------------------
   TOOLTIP
   -------------------------------------------------------------------------- */

.tooltip-wrapper {
    position: relative;
    display: inline-flex;
}

.tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-surface-raised);
    color: var(--color-text-primary);
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    border: var(--border-default);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out-quart);
    z-index: var(--z-dropdown);
}

.tooltip-wrapper:hover .tooltip {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   AVATAR / ICON CHIP
   -------------------------------------------------------------------------- */

.icon-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    background-color: var(--color-accent-dim);
    color: var(--color-accent);
    border: var(--border-accent);
}

.icon-chip svg {
    width: 24px;
    height: 24px;
}

.icon-chip--sm {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
}

.icon-chip--sm svg {
    width: 18px;
    height: 18px;
}

/* Code block copy button — dynamically injected by JS */
.code-block__copy {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: var(--ls-wide);
    color: var(--color-text-tertiary);
    padding-inline: var(--space-3);
    height: 28px;
}

.code-block__copy:hover {
    color: var(--color-text-secondary);
}
