/* 
 * Kaisergarten Restaurant - Unified Button System
 * Mobile-first, accessible, consistent button styles
 * Following best practices for touch targets and visual hierarchy
 */

/* ===== BASE BUTTON ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    
    /* Sizing - Mobile first with min 44px touch target */
    padding: 0.75rem 1.25rem;
    min-height: 44px;
    font-size: 1rem;
    
    /* Visual */
    font-weight: 600;
    font-family: 'Raleway', sans-serif;
    letter-spacing: 0.02em;
    border: 2px solid transparent;
    border-radius: var(--border-radius-md);
    text-decoration: none;
    text-align: center;
    line-height: 1.5;
    white-space: nowrap;
    color: inherit; /* Reset anchor color inheritance */
    
    /* Interaction */
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: all 0.2s ease;
    
    /* Accessibility */
    position: relative;
    overflow: hidden;
}

/* Ensure anchor buttons don't inherit link colors */
a.btn,
a.btn:hover,
a.btn:focus,
a.btn:visited {
    text-decoration: none;
}

/* Icon spacing */
.btn i,
.btn svg {
    font-size: 1em;
    flex-shrink: 0;
}

/* Focus states - WCAG compliant */
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.4);
}

.btn:focus:not(:focus-visible) {
    box-shadow: none;
}

.btn:focus-visible {
    outline: 3px solid rgba(var(--primary-color-rgb), 0.6);
    outline-offset: 2px;
}

/* Disabled state */
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== PRIMARY BUTTON - Main CTA ===== */
.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-light);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(var(--primary-color-rgb), 0.2);
}

/* ===== SECONDARY BUTTON - Secondary CTA ===== */
.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--dark-color);
    border-color: var(--secondary-color);
    box-shadow: 0 2px 8px rgba(250, 183, 0, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(250, 183, 0, 0.3);
}

.btn-secondary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(250, 183, 0, 0.2);
}

/* ===== OUTLINE BUTTONS ===== */
.btn-outline-primary,
a.btn-outline-primary {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover:not(:disabled),
a.btn-outline-primary:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb), 0.2);
}

.btn-outline-secondary,
a.btn-outline-secondary {
    background-color: transparent;
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-outline-secondary:hover:not(:disabled),
a.btn-outline-secondary:hover:not(:disabled) {
    background-color: var(--secondary-color);
    color: var(--dark-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(250, 183, 0, 0.2);
}

/* Light outline for dark backgrounds */
.btn-outline-light {
    background-color: transparent;
    color: var(--text-light);
    border-color: rgba(255, 255, 255, 0.8);
}

.btn-outline-light:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--text-light);
    transform: translateY(-2px);
}

/* ===== GHOST BUTTON - Minimal style ===== */
.btn-ghost {
    background-color: transparent;
    color: currentColor;
    border-color: transparent;
    box-shadow: none;
}

.btn-ghost:hover:not(:disabled) {
    background-color: rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

/* ===== SIZE VARIANTS ===== */
.btn-sm {
    padding: 0.5rem 1rem;
    min-height: 36px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    min-height: 52px;
    font-size: 1.125rem;
}

.btn-xl {
    padding: 1.25rem 2.5rem;
    min-height: 60px;
    font-size: 1.25rem;
}

/* ===== FULL WIDTH ===== */
.btn-block {
    width: 100%;
    display: flex;
}

/* ===== ICON-ONLY BUTTONS ===== */
.btn-icon {
    padding: 0.75rem;
    min-width: 44px;
    border-radius: 50%;
}

.btn-icon.btn-sm {
    padding: 0.5rem;
    min-width: 36px;
}

.btn-icon.btn-lg {
    padding: 1rem;
    min-width: 52px;
}

/* ===== BUTTON GROUP ===== */
.btn-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-group-vertical {
    flex-direction: column;
}

.btn-group.btn-group-center {
    justify-content: center;
}

/* ===== LOADING STATE ===== */
.btn.is-loading {
    color: transparent;
    pointer-events: none;
    position: relative;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 1em;
    height: 1em;
    top: 50%;
    left: 50%;
    margin-left: -0.5em;
    margin-top: -0.5em;
    border: 2px solid currentColor;
    border-radius: 50%;
    border-right-color: transparent;
    animation: button-loading 0.6s linear infinite;
}

@keyframes button-loading {
    to { transform: rotate(360deg); }
}

/* ===== RESPONSIVE BEHAVIOR ===== */

/* Tablet and below */
@media (max-width: 768px) {
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 0.625rem 1.125rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 1.125rem 2rem;
        font-size: 1.125rem;
    }
    
    .btn-xl {
        padding: 1.25rem 2.25rem;
        font-size: 1.125rem;
    }
    
    /* Stack button groups on mobile */
    .btn-group-mobile-stack {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-mobile-stack .btn {
        width: 100%;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .btn-lg {
        padding: 1rem 1.75rem;
        font-size: 1rem;
    }
    
    .btn-xl {
        padding: 1.125rem 2rem;
        font-size: 1.0625rem;
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .btn {
        transition: none;
    }
    
    .btn:hover:not(:disabled) {
        transform: none;
    }
    
    .btn.is-loading::after {
        animation: none;
        border-right-color: currentColor;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .btn {
        border-width: 3px;
    }
    
    .btn:focus-visible {
        outline-width: 4px;
    }
}
