/**
 * Admin Button Components
 * 
 * Extends base button system with admin-specific variants and states
 * Consistent with design system color tokens
 */

/* Base Admin Button */
.admin-button {
    --_color: var(--color, var(--accent));
    
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--_color);
    border-radius: var(--radius-md);
    
    background: var(--_color);
    color: var(--bg);
    
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    
    transition: all var(--duration-default) var(--easing-default);
    
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.admin-button:hover:not(:disabled) {
    --_hoverColor: oklch(from var(--color, var(--accent)) calc(l - 0.05) c h);
    --_color: var(--hoverColor, var(--_hoverColor));
    transform: translateY(-1px);
    box-shadow: 0 4px 8px oklch(from var(--_color) l c h / 0.2);
}

.admin-button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px oklch(from var(--_color) l c h / 0.2);
}

.admin-button:focus-visible {
    outline: 2px solid var(--_color);
    outline-offset: 2px;
}

.admin-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button Variants */
.admin-button--secondary {
    --color: var(--border);
    background: transparent;
    color: var(--text);
}

.admin-button--secondary:hover:not(:disabled) {
    background: var(--bg-alt);
    color: var(--text);
}

.admin-button--outline {
    background: transparent;
    color: var(--_color);
}

.admin-button--outline:hover:not(:disabled) {
    background: oklch(from var(--_color) l c h / 0.1);
}

.admin-button--ghost {
    border: transparent;
    background: transparent;
    color: var(--_color);
}

.admin-button--ghost:hover:not(:disabled) {
    background: oklch(from var(--_color) l c h / 0.1);
    border-color: transparent;
}

/* Semantic Variants */
.admin-button--success {
    --color: var(--success);
}

.admin-button--warning {
    --color: var(--warning);
    color: var(--bg);
}

.admin-button--error {
    --color: var(--error);
}

.admin-button--info {
    --color: var(--info-base);
}

/* Size Variants */
.admin-button--small {
    padding: 0.25rem var(--space-sm);
    font-size: 0.75rem;
    gap: 0.25rem;
}

.admin-button--large {
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    gap: var(--space-sm);
}

.admin-button--full {
    width: 100%;
}

/* Icon Buttons */
.admin-button--icon-only {
    padding: var(--space-sm);
    aspect-ratio: 1;
    min-width: auto;
}

.admin-button--icon-only.admin-button--small {
    padding: 0.25rem;
}

.admin-button--icon-only.admin-button--large {
    padding: var(--space-md);
}

/* Loading State */
.admin-button--loading {
    position: relative;
    color: transparent;
}

.admin-button--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: button-spin 0.8s linear infinite;
}

@keyframes button-spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Button Groups */
.admin-button-group {
    display: inline-flex;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
}

.admin-button-group .admin-button {
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
}

.admin-button-group .admin-button:last-child {
    border-right: none;
}

.admin-button-group .admin-button:hover {
    transform: none;
    box-shadow: none;
    z-index: 1;
    position: relative;
}

.admin-button-group .admin-button.active {
    background: var(--accent);
    color: var(--bg);
    z-index: 2;
    position: relative;
}

/* Dropdown Buttons */
.admin-button--dropdown {
    position: relative;
}

.admin-button--dropdown::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: var(--space-sm);
}

/* Floating Action Button */
.admin-fab {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px oklch(from var(--accent) l c h / 0.3);
    transition: all var(--duration-default) var(--easing-default);
    z-index: 100;
    
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.admin-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px oklch(from var(--accent) l c h / 0.4);
}

.admin-fab:active {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
    .admin-button {
        padding: var(--space-sm);
        font-size: 0.875rem;
    }
    
    .admin-button--small {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .admin-button--large {
        padding: var(--space-md);
        font-size: 0.875rem;
    }
    
    .admin-button-group {
        width: 100%;
    }
    
    .admin-button-group .admin-button {
        flex: 1;
    }
    
    .admin-fab {
        width: 48px;
        height: 48px;
        bottom: var(--space-md);
        right: var(--space-md);
        font-size: 1.25rem;
    }
}