/**
 * GenForm SCSS Mixins
 */
@use 'variables' as vars;

// ========================================
// 1. Common Utility Mixins
// ========================================

@mixin flex-center($direction: row) {
    display: flex;
    flex-direction: $direction;
    align-items: center;
    justify-content: center;
}

@mixin flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@mixin transition($prop: all, $time: 0.2s, $ease: ease-in-out) {
    transition: $prop $time $ease;
}

@mixin visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

// ========================================
// 2. Premium Admin Mixins
// ========================================

@mixin card {
    background: vars.$white;
    border-radius: vars.$radius;
    padding: vars.$space-md;
    box-shadow: vars.$shadow-md;
    border: 1px solid vars.$border;
    transition: vars.$transition-base;
}

@mixin input-field {
    border-radius: vars.$radius-md;
    border: 1px solid vars.$border;
    padding: vars.$input-padding;
    font-size: vars.$size-base;
    line-height: normal;
    height: vars.$input-height;
    width: 100%;
    transition: vars.$transition-base;
    background: vars.$white;
    color: vars.$text-main;

    &::placeholder {
        color: vars.$text-muted;
        opacity: 0.6;
    }

    &:focus {
        border-color: vars.$primary;
        box-shadow: 0 0 0 4px rgba(vars.$primary, 0.1);
        outline: none;
        background: vars.$white;
    }
}

@mixin input-focus {
    border-color: vars.$primary;
    box-shadow: 0 0 0 4px rgba(vars.$primary, 0.1);
    outline: none;
}

@mixin badge($color) {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: vars.$radius-full;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba($color, 0.08);
    color: $color;
    border: 1px solid rgba($color, 0.2);
}

// ========================================
// 3. Frontend / Legacy Mixins (GFM Prefixed)
// ========================================

@mixin gfm-flex-row-center {
    display: flex;
    flex-direction: row;
    align-items: center;
}

@mixin gfm-flex-column {
    display: flex;
    flex-direction: column;
}

@mixin gfm-focus-styles($color: vars.$gfm-color-brand, $offset: 1px) {
    outline: none;
    border-color: $color;
    box-shadow: 0 0 0 $offset $color;
}

@mixin gfm-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, vars.$primary 0%, vars.$primary-dark 100%);
    color: #fff;
    padding: 0 32px;
    height: 48px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 14px -4px rgba(vars.$primary, 0.35);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    line-height: 1;

    &:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px -6px rgba(vars.$primary, 0.45);
    }

    &:active {
        transform: scale(0.98);
    }

    &:disabled {
        background: #ccc;
        cursor: not-allowed;
        opacity: 0.6;
        transform: none;
        box-shadow: none;
    }
}

@mixin gfm-alert($bg-color, $text-color, $border-color) {
    padding: 16px;
    border-radius: 4px;
    font-size: 14px;
    background: $bg-color;
    color: $text-color;
    border: 1px solid $border-color;
}

@mixin gfm-alert-success {
    @include gfm-alert(vars.$gfm-color-success, vars.$gfm-color-success-text, vars.$gfm-color-success-border);
}

@mixin gfm-alert-error {
    @include gfm-alert(vars.$gfm-color-error, vars.$gfm-color-error-text, vars.$gfm-color-error-border);
}

@mixin gfm-form-input-base {
    width: 100%;
    height: 46px;
    padding: 0 16px;
    border: 1px solid vars.$border;
    border-radius: 10px;
    font-size: 14.5px;
    color: vars.$text-main;
    background: vars.$white;
    font-family: vars.$font-main;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    box-sizing: border-box;
    line-height: 1.4;

    &::placeholder {
        color: vars.$text-light;
    }

    &:hover {
        border-color: vars.$border-dark;
    }

    &:focus {
        border-color: vars.$primary;
        outline: none;
        box-shadow: 0 0 0 3px rgba(vars.$primary, 0.12);
    }
}

@mixin gfm-absolute-cover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

// Responsive
@mixin gfm-mobile-only {
    @media (max-width: (vars.$gfm-bp-md - 1)) {
        @content;
    }
}