/**
 * M24B2B Reactions - Frontend Styles
 * 
 * Theme-agnostic styles for reaction buttons
 * Uses CSS custom properties for easy theming
 * 
 * @package M24B2B
 * @since 2025.11.11
 */

:root {
    /* Colors */
    --m24b2b-reaction-color: #6b7280;
    --m24b2b-reaction-hover-color: #374151;
    --m24b2b-reaction-active-color: #ef4444;
    --m24b2b-reaction-bg: transparent;
    --m24b2b-reaction-hover-bg: rgba(0, 0, 0, 0.05);
    --m24b2b-reaction-active-bg: rgba(239, 68, 68, 0.1);
    
    /* Sizes */
    --m24b2b-reaction-size: 20px;
    --m24b2b-reaction-padding: 8px 12px;
    --m24b2b-reaction-border-radius: 6px;
    --m24b2b-reaction-gap: 6px;
    
    /* Animation */
    --m24b2b-reaction-transition: all 0.2s ease;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --m24b2b-reaction-color: #9ca3af;
        --m24b2b-reaction-hover-color: #d1d5db;
        --m24b2b-reaction-hover-bg: rgba(255, 255, 255, 0.05);
        --m24b2b-reaction-active-bg: rgba(239, 68, 68, 0.15);
    }
}

/* Base button styles */
.m24b2b-reaction-button {
    display: inline-flex;
    align-items: center;
    gap: var(--m24b2b-reaction-gap);
    padding: var(--m24b2b-reaction-padding);
    background: var(--m24b2b-reaction-bg);
    color: var(--m24b2b-reaction-color);
    border: none;
    border-radius: var(--m24b2b-reaction-border-radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: var(--m24b2b-reaction-transition);
    text-decoration: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.m24b2b-reaction-button:hover {
    color: var(--m24b2b-reaction-hover-color);
    background: var(--m24b2b-reaction-hover-bg);
}

.m24b2b-reaction-button:focus {
    outline: 2px solid var(--m24b2b-reaction-active-color);
    outline-offset: 2px;
}

.m24b2b-reaction-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Icon */
.m24b2b-reaction-button .reaction-icon {
    width: var(--m24b2b-reaction-size);
    height: var(--m24b2b-reaction-size);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.m24b2b-reaction-button .reaction-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Count */
.m24b2b-reaction-button .reaction-count {
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    min-width: 1ch;
    text-align: left;
}

/* Active/Reacted state */
.m24b2b-reaction-button.is-reacted {
    color: var(--m24b2b-reaction-active-color);
    background: var(--m24b2b-reaction-active-bg);
}

.m24b2b-reaction-button.is-reacted .reaction-icon svg {
    fill: currentColor;
}

/* Loading state */
.m24b2b-reaction-button.is-loading {
    pointer-events: none;
}

.m24b2b-reaction-button.is-loading .reaction-icon {
    animation: m24b2b-spin 0.6s linear infinite;
}

@keyframes m24b2b-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Button variations - Size */
.m24b2b-reaction-button.size-small {
    --m24b2b-reaction-size: 16px;
    --m24b2b-reaction-padding: 6px 10px;
    font-size: 12px;
}

.m24b2b-reaction-button.size-large {
    --m24b2b-reaction-size: 24px;
    --m24b2b-reaction-padding: 10px 16px;
    font-size: 16px;
}

/* Button variations - Style */
.m24b2b-reaction-button.style-minimal {
    padding: 4px;
    background: transparent;
}

.m24b2b-reaction-button.style-minimal:hover {
    background: transparent;
    transform: scale(1.1);
}

.m24b2b-reaction-button.style-outlined {
    border: 1px solid currentColor;
}

.m24b2b-reaction-button.style-solid {
    background: var(--m24b2b-reaction-hover-bg);
}

.m24b2b-reaction-button.style-solid:hover {
    background: var(--m24b2b-reaction-active-bg);
}

/* Hide count (icon only) */
.m24b2b-reaction-button.hide-count .reaction-count {
    display: none;
}

/* Reactions bar - multiple buttons together */
.m24b2b-reactions-bar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.m24b2b-reactions-bar .m24b2b-reaction-button {
    margin: 0;
}

/* Separator between buttons in bar */
.m24b2b-reactions-bar .reaction-separator {
    width: 1px;
    height: 20px;
    background: var(--m24b2b-reaction-color);
    opacity: 0.2;
    margin: 0 4px;
}

/* Specific reaction types */
.m24b2b-reaction-button[data-reaction-type="like"].is-reacted {
    --m24b2b-reaction-active-color: #ef4444; /* Red */
}

.m24b2b-reaction-button[data-reaction-type="save"].is-reacted {
    --m24b2b-reaction-active-color: #3b82f6; /* Blue */
}

.m24b2b-reaction-button[data-reaction-type="view"] {
    cursor: default;
}

.m24b2b-reaction-button[data-reaction-type="view"]:hover {
    background: transparent;
}

/* Animation on reaction */
@keyframes m24b2b-heart-beat {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.m24b2b-reaction-button.is-reacted .reaction-icon {
    animation: m24b2b-heart-beat 0.3s ease;
}

/* Responsive */
@media (max-width: 640px) {
    .m24b2b-reaction-button {
        --m24b2b-reaction-padding: 6px 10px;
        font-size: 13px;
    }
    
    .m24b2b-reactions-bar {
        gap: 2px;
    }
}

/* Print styles */
@media print {
    .m24b2b-reaction-button {
        display: none;
    }
}

/* Accessibility - Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .m24b2b-reaction-button,
    .m24b2b-reaction-button .reaction-icon {
        animation: none !important;
        transition: none !important;
    }
}

/* RTL support */
[dir="rtl"] .m24b2b-reactions-bar {
    direction: rtl;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .m24b2b-reaction-button {
        border: 2px solid currentColor;
    }
    
    .m24b2b-reaction-button:focus {
        outline-width: 3px;
    }
}

