/* Buttons CSS - All button variants */

/* ============================================
   Base Button Styles
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition-fast) ease-in-out;
}

.btn:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
    pointer-events: none;
    opacity: 0.5;
    cursor: not-allowed;
}

.btn svg,
.btn .icon {
    pointer-events: none;
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* ============================================
   Button Sizes
   ============================================ */
.btn-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: var(--text-xs);
    border-radius: calc(var(--radius) - 2px);
}

.btn,
.btn-default {
    height: 2.5rem;
    padding: 0 1rem;
}

.btn-lg {
    height: 3rem;
    padding: 0 2rem;
    border-radius: calc(var(--radius) - 2px);
}

.btn-wide {
    height: 2.5rem;
    min-width: 10rem;
    padding: 0 1rem;
}

.btn-icon {
    padding: 0;
}

.btn-icon svg,
.btn-icon .icon {
    width: 1.5rem;
    height: 1.5rem;
}

.btn-icon-outline {
    height: 2.5rem;
    padding: 0.5rem;
}

/* ============================================
   Default Variant
   ============================================ */
.btn-default,
.btn:not([class*="btn-"]) {
    background-color: hsl(var(--foreground) / 0.8);
    color: hsl(var(--background));
}

.btn-default:hover,
.btn:not([class*="btn-"]):hover {
    background-color: hsl(var(--foreground));
}

/* ============================================
   Primary Variants
   ============================================ */
.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--background));
}

.btn-primary:hover {
    background-color: hsl(var(--primary) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--primary) / 0.9);
}

.btn-primary-outline {
    border: 1px solid hsl(var(--primary));
    background-color: transparent;
    color: hsl(var(--primary));
}

.btn-primary-outline:hover {
    background-color: hsl(var(--primary));
    color: hsl(var(--background));
}

.btn-primary-muted {
    background-color: hsl(var(--primary-foreground));
    color: hsl(var(--primary));
}

.btn-primary-muted:hover {
    background-color: hsl(var(--primary-foreground) / 0.5);
    box-shadow: 0 0 0 1px hsl(var(--primary));
}

/* ============================================
   Secondary Variants
   ============================================ */
.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--background));
}

.btn-secondary:hover {
    background-color: hsl(var(--secondary) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--secondary) / 0.9);
}

.btn-secondary-outline {
    border: 1px solid hsl(var(--secondary));
    background-color: transparent;
    color: hsl(var(--secondary));
}

.btn-secondary-outline:hover {
    background-color: hsl(var(--secondary));
    color: hsl(var(--background));
}

.btn-secondary-muted {
    background-color: hsl(var(--secondary-foreground));
    color: hsl(var(--secondary));
}

.btn-secondary-muted:hover {
    background-color: hsl(var(--secondary-foreground) / 0.5);
    box-shadow: 0 0 0 1px hsl(var(--secondary));
}

/* ============================================
   Destructive/Error Variants
   ============================================ */
.btn-destructive,
.btn-error {
    background-color: hsl(var(--destructive));
    color: hsl(var(--background));
}

.btn-destructive:hover,
.btn-error:hover {
    background-color: hsl(var(--destructive) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--destructive) / 0.9);
}

.btn-error-outline {
    border: 1px solid hsl(var(--destructive));
    background-color: transparent;
    color: hsl(var(--destructive));
}

.btn-error-outline:hover {
    background-color: hsl(var(--destructive));
    color: hsl(var(--background));
}

.btn-error-muted {
    background-color: hsl(var(--destructive-foreground));
    color: hsl(var(--destructive));
}

.btn-error-muted:hover {
    background-color: hsl(var(--destructive-foreground) / 0.5);
    box-shadow: 0 0 0 1px hsl(var(--destructive));
}

/* ============================================
   Success Variants
   ============================================ */
.btn-success {
    background-color: hsl(var(--success));
    color: hsl(var(--background));
}

.btn-success:hover {
    background-color: hsl(var(--success) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--success) / 0.9);
}

.btn-success-outline {
    border: 1px solid hsl(var(--success));
    background-color: transparent;
    color: hsl(var(--success));
}

.btn-success-outline:hover {
    background-color: hsl(var(--success));
    color: hsl(var(--background));
}

.btn-success-muted {
    background-color: hsl(var(--success-foreground));
    color: hsl(var(--success));
}

.btn-success-muted:hover {
    background-color: hsl(var(--success-foreground) / 0.5);
    box-shadow: 0 0 0 1px hsl(var(--success));
}

/* ============================================
   Warning Variants
   ============================================ */
.btn-warning {
    background-color: hsl(var(--warning));
    color: hsl(var(--background));
}

.btn-warning:hover {
    background-color: hsl(var(--warning) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--warning) / 0.9);
}

.btn-warning-outline {
    border: 1px solid hsl(var(--warning));
    background-color: transparent;
    color: hsl(var(--warning));
}

.btn-warning-outline:hover {
    background-color: hsl(var(--warning));
    color: hsl(var(--background));
}

.btn-warning-muted {
    background-color: hsl(var(--warning-foreground));
    color: hsl(var(--warning));
}

.btn-warning-muted:hover {
    background-color: hsl(var(--warning-foreground) / 0.5);
    box-shadow: 0 0 0 1px hsl(var(--warning));
}

/* ============================================
   Info Variants
   ============================================ */
.btn-info {
    background-color: hsl(var(--info));
    color: hsl(var(--background));
}

.btn-info:hover {
    background-color: hsl(var(--info) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--info) / 0.9);
}

.btn-info-outline {
    border: 1px solid hsl(var(--info));
    background-color: transparent;
    color: hsl(var(--info));
}

.btn-info-outline:hover {
    background-color: hsl(var(--info));
    color: hsl(var(--background));
}

.btn-info-muted {
    background-color: hsl(var(--info-foreground));
    color: hsl(var(--info));
}

.btn-info-muted:hover {
    background-color: hsl(var(--info-foreground) / 0.5);
    box-shadow: 0 0 0 1px hsl(var(--info));
}

/* ============================================
   Muted Variants
   ============================================ */
.btn-muted {
    background-color: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
}

.btn-muted:hover {
    background-color: hsl(var(--muted) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--muted-foreground));
}

.btn-muted-outline {
    border: 1px solid hsl(var(--muted-foreground));
    background-color: transparent;
    color: hsl(var(--muted-foreground));
}

.btn-muted-outline:hover {
    background-color: hsl(var(--muted-foreground));
    color: hsl(var(--background));
}

.btn-muted-dark {
    background-color: hsl(var(--muted-foreground) / 0.9);
    color: hsl(var(--background));
}

.btn-muted-dark:hover {
    background-color: hsl(var(--muted-foreground) / 0.9);
    box-shadow: 0 0 0 1px hsl(var(--muted-foreground) / 0.9);
}

/* ============================================
   Outline Variant (Generic)
   ============================================ */
.btn-outline {
    border: 1px solid hsl(var(--muted-foreground));
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background-color: hsl(var(--foreground) / 0.1);
}

/* ============================================
   Ghost Variant
   ============================================ */
.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--muted));
}

/* ============================================
   Link Variant
   ============================================ */
.btn-link {
    background-color: transparent;
    color: hsl(var(--primary));
    text-decoration: none;
    height: auto;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ============================================
   Icon-only Button
   ============================================ */
.btn-icon-only {
    background-color: transparent;
    color: hsl(var(--muted-foreground));
    text-transform: none;
}

.btn-icon-only:hover {
    color: hsl(var(--foreground));
}

/* ============================================
   Button Group
   ============================================ */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: calc(var(--radius) - 2px);
    border-bottom-left-radius: calc(var(--radius) - 2px);
}

.btn-group .btn:last-child {
    border-top-right-radius: calc(var(--radius) - 2px);
    border-bottom-right-radius: calc(var(--radius) - 2px);
}

.btn-group .btn + .btn {
    margin-left: -1px;
}

/* ============================================
   Loading State
   ============================================ */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Full Width
   ============================================ */
.btn-block {
    width: 100%;
}
