////
///
/// Keyboard Component Mixins
/// =========================================================================
///
/// Provides mixins for creating virtual keyboard UI components for
/// kiosks, touch interfaces, and accessibility features.
///
/// @group Controls
/// @author Scape Agency
/// @link https://move.gl
/// @since 0.1.0 initial release
/// @access public
///
////


// ============================================================================
// Use
// ============================================================================

@use "../../variables" as *;


// ============================================================================
// Keyboard Container Mixins
// ============================================================================

///
/// Main keyboard container.
///
@mixin keyboard_container {
    background: var(--keyboard-bg, $keyboard-bg);
    border-radius: var(--keyboard-radius, $keyboard-radius);
    padding: var(--keyboard-padding, $keyboard-padding);
}

///
/// Keyboard row layout.
///
@mixin keyboard_row {
    display: flex;
    justify-content: center;
    gap: var(--keyboard-gap, $keyboard-gap);
    margin-bottom: var(--keyboard-gap, $keyboard-gap);

    &:last-child {
        margin-bottom: 0;
    }
}


// ============================================================================
// Key Mixins
// ============================================================================

///
/// Base key styling.
///
@mixin key_base {
    min-width: var(--key-min-width, $key-min-width);
    height: var(--key-height, $key-height);
    border: none;
    border-radius: var(--key-radius, $key-radius);
    background: var(--key-bg, $key-bg);
    color: var(--key-color, $key-color);
    font-size: var(--key-font-size, $key-font-size);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;

    &:hover {
        background: var(--key-bg-hover, $key-bg-hover);
        transform: translateY(-2px);
    }

    &:active {
        background: var(--key-bg-active, $key-bg-active);
        transform: translateY(0);
    }
}

///
/// Space key (wide).
///
@mixin key_space {
    flex: 1;
    max-width: var(--key-space-max-width, $key-space-max-width);
}

///
/// Special keys (shift, backspace, enter).
///
@mixin key_special {
    min-width: var(--key-special-width, $key-special-width);
    background: var(--key-special-bg, $key-special-bg);
}

///
/// Mode switch key.
///
@mixin key_mode {
    min-width: var(--key-special-width, $key-special-width);
    background: var(--key-special-bg, $key-special-bg);
}

///
/// Active/pressed key state.
///
@mixin key_active {
    background: var(--key-bg-active, $key-bg-active);
    transform: translateY(0) scale(0.95);
}

///
/// Highlighted key state.
///
@mixin key_highlight {
    background: var(--key-bg-active, $key-bg-active);
    animation: key-glow 1s ease-in-out infinite;
}


// ============================================================================
// Key Animations
// ============================================================================

///
/// Key press animation keyframes.
///
@mixin keyframes_key_press {
    @keyframes key-press {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(0.92);
        }
        100% {
            transform: scale(1);
        }
    }
}

///
/// Key glow animation keyframes.
///
@mixin keyframes_key_glow {
    @keyframes key-glow {
        0%, 100% {
            box-shadow: 0 0 0 rgba(102, 126, 234, 0);
        }
        50% {
            box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
        }
    }
}


// ============================================================================
// Keyboard Layouts
// ============================================================================

///
/// Compact keyboard layout.
///
@mixin keyboard_compact {
    --keyboard-padding: 0.5rem;
    --keyboard-gap: 4px;
    --key-min-width: 32px;
    --key-height: 40px;
    --key-font-size: 14px;
}

///
/// Large keyboard layout.
///
@mixin keyboard_large {
    --keyboard-padding: 1.5rem;
    --keyboard-gap: 8px;
    --key-min-width: 48px;
    --key-height: 56px;
    --key-font-size: 18px;
}

///
/// Floating keyboard styling.
///
@mixin keyboard_floating {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

///
/// Dark theme keyboard.
///
@mixin keyboard_dark {
    --keyboard-bg: #1a1a2e;
    --key-bg: #2d2d44;
    --key-bg-hover: #3d3d5c;
}

///
/// Light theme keyboard.
///
@mixin keyboard_light {
    --keyboard-bg: #e5e5e5;
    --key-bg: #ffffff;
    --key-bg-hover: #f0f0f0;
    --key-color: #333333;
}


// ============================================================================
// Keyboard Input Mixins
// ============================================================================

///
/// Keyboard input field.
///
@mixin keyboard_input {
    width: 100%;
    padding: 1rem;
    font-size: 18px;
    border: 2px solid var(--keyboard-input-border, #444);
    border-radius: 8px;
    background: var(--keyboard-input-bg, #0d1117);
    color: var(--keyboard-input-color, white);
    margin-bottom: 1.5rem;

    &:focus {
        outline: none;
        border-color: var(--keyboard-input-focus, #667eea);
    }
}


// ============================================================================
// Keyboard Mode Mixins
// ============================================================================

///
/// Mode button container.
///
@mixin keyboard_modes {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
}

///
/// Mode button styling.
///
@mixin keyboard_mode_btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--keyboard-mode-border, #667eea);
    border-radius: 8px;
    background: transparent;
    color: var(--keyboard-mode-color, #667eea);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover,
    &.active {
        background: var(--keyboard-mode-active-bg, #667eea);
        color: var(--keyboard-mode-active-color, white);
    }
}


// ============================================================================
// Keyboard Stats Mixins
// ============================================================================

///
/// Stats display for keyboard metrics.
///
@mixin keyboard_stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--keyboard-stats-border, #444);
    color: var(--keyboard-stats-color, #aaa);
    font-size: 14px;

    span {
        color: var(--keyboard-stats-value, #667eea);
        font-weight: 600;
    }
}

