@use 'sass:map';
@use 'variables' as *;

/**
 * SCSS Mixins
 */

@mixin dark-mode {
    .dark-mode & {
        @content;
    }
}

/**
 * Shared Button Base Placeholder
 * Used via @extend to ensure consistent button behavior and settings inheritance.
 */
%presszone-comments-btn-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: $presszone-comments-btn-padding; // Standard/Default
    border-radius: $presszone-comments-radius-md; // Rounded/Default
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: all $presszone-comments-duration-normal;
    border-width: $presszone-comments-border-width;
    border-style: solid;
    border-color: transparent;
    font-family: inherit;
    font-size: $presszone-comments-font-size-sm;
    text-decoration: none;
    box-sizing: border-box;

    &:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }
}

/**
 * Theme Property Generator
 * 
 * Iterates through the $themes map and generates scoped CSS rules.
 * 
 * Usage:
 * @include theme-props((
 *     'background-color': 'bg-primary',
 *     'color': 'text-primary'
 * ));
 */
@mixin theme-props($props) {
    @each $theme, $map in $themes {

        .presszone-comments-theme--#{$theme} &,
        &.presszone-comments-theme--#{$theme} {
            @each $css-prop, $theme-key in $props {
                $value: map.get($map, $theme-key);

                @if $value !=null {
                    #{$css-prop}: $value;
                }

                @else {
                    @warn "Theme key '#{$theme-key}' not found in theme '#{$theme}'";
                }
            }
        }
    }
}