/* Button Components */

/* Base Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--gap-xs);
    padding: var(--gap-xs) var(--gap-sm);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
    user-select: none;
    vertical-align: middle;
    background: transparent;
    color: inherit;
}

.btn:focus {
    outline: 2px solid var(--blue, #667eea);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Sizes */
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-md {
    padding: var(--gap-xs) var(--gap-sm);
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.btn-xl {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: var(--radius-md);
}

/* Button Variants */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--light-secondary);
    color: var(--light-text);
    border-color: var(--light-border);
}

.btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border-color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.btn-ghost {
    background: transparent;
    color: #667eea;
    border-color: transparent;
}

.btn-ghost:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #5a67d8;
}

.btn-danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border-color: #f59e0b;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* Button States */
.btn-loading {
    color: transparent;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Icon Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-full);
    font-size: 1rem;
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    font-size: 0.875rem;
}

.btn-icon-lg {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
}

/* Button Groups */
.btn-group {
    display: inline-flex;
    align-items: center;
}

.btn-group .btn {
    border-radius: 0;
    border-right-width: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    border-right-width: 1px;
}

.btn-group .btn:hover {
    z-index: 1;
    border-color: currentColor;
}

/* Floating Action Button */
.btn-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: var(--transition-slow);
}

.btn-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Special Effects */
.btn-glow {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    filter: blur(8px);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.btn-glow:hover::before {
    opacity: 0.7;
}

.btn-shimmer {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    color: white;
    animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Dark Mode Buttons */
.dark-mode .btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: #45475a;
}

.dark-mode .btn-secondary:hover {
    background: #45475a;
}

.dark-mode .btn-outline {
    color: var(--mauve);
    border-color: var(--mauve);
}

.dark-mode .btn-outline:hover {
    background: var(--mauve);
    color: #11111b;
}

.dark-mode .btn-ghost {
    color: var(--mauve);
}

.dark-mode .btn-ghost:hover {
    background: rgba(203, 166, 247, 0.1);
}

/* Button Accessibility */
.btn:focus-visible {
    outline: 2px solid var(--blue, #667eea);
    outline-offset: 2px;
}

.dark-mode .btn:focus-visible {
    outline-color: var(--mauve);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: var(--radius-sm);
        border-right-width: 1px;
        border-bottom-width: 0;
        width: 100%;
    }
    
    .btn-group .btn:not(:last-child) {
        border-bottom-width: 0;
    }
    
    .btn-group .btn:last-child {
        border-bottom-width: 1px;
    }
}

/* Print Styles */
@media print {
    .btn {
        background: transparent !important;
        color: black !important;
        border: 1px solid black !important;
        box-shadow: none !important;
    }
    
    .btn-fab {
        display: none;
    }
}