/**
 * Button Utilities - LostFound
 * Consistent button styling fixes and utilities
 * Version: 1.0.0
 */

/* ===== CRITICAL BUTTON FIXES ===== */

/* Force consistent .btn-secondary styling across all instances */
.btn-secondary,
a.btn-secondary,
button.btn-secondary,
input.btn-secondary,
.btn.btn-secondary,
*[class*="btn-secondary"] {
    background: rgba(96, 165, 250, 0.1) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(96, 165, 250, 0.3) !important;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn-secondary:hover,
a.btn-secondary:hover,
button.btn-secondary:hover,
input.btn-secondary:hover,
.btn.btn-secondary:hover,
*[class*="btn-secondary"]:hover {
    background: rgba(96, 165, 250, 0.15) !important;
    color: #3b82f6 !important;
    border-color: rgba(96, 165, 250, 0.5) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(96, 165, 250, 0.2);
}

/* Force consistent .btn-primary styling */
.btn-primary,
a.btn-primary,
button.btn-primary,
input.btn-primary,
.btn.btn-primary,
*[class*="btn-primary"] {
    background: linear-gradient(135deg, #f97316, #ea580c) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
    box-sizing: border-box;
}

.btn-primary:hover,
a.btn-primary:hover,
button.btn-primary:hover,
input.btn-primary:hover,
.btn.btn-primary:hover,
*[class*="btn-primary"]:hover {
    background: linear-gradient(135deg, #ea580c, #dc2626) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.4);
}

/* ===== BUTTON SIZE VARIANTS ===== */

.btn-sm {
    padding: 6px 12px !important;
    font-size: 14px;
    border-radius: 8px !important;
}

.btn-lg {
    padding: 14px 28px !important;
    font-size: 18px;
    border-radius: 16px !important;
}

.btn-xl {
    padding: 18px 36px !important;
    font-size: 20px;
    border-radius: 20px !important;
}

/* ===== BUTTON STATE VARIANTS ===== */

.btn-success,
a.btn-success,
button.btn-success {
    background: linear-gradient(135deg, #10b981, #047857) !important;
    color: white !important;
    border: none !important;
}

.btn-success:hover,
a.btn-success:hover,
button.btn-success:hover {
    background: linear-gradient(135deg, #047857, #065f46) !important;
}

.btn-danger,
a.btn-danger,
button.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: white !important;
    border: none !important;
}

.btn-danger:hover,
a.btn-danger:hover,
button.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
}

.btn-warning,
a.btn-warning,
button.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    color: white !important;
    border: none !important;
}

.btn-warning:hover,
a.btn-warning:hover,
button.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
}

.btn-info,
a.btn-info,
button.btn-info {
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    color: white !important;
    border: none !important;
}

.btn-info:hover,
a.btn-info:hover,
button.btn-info:hover {
    background: linear-gradient(135deg, #0284c7, #0369a1) !important;
}

/* ===== OUTLINE BUTTON VARIANTS ===== */

.btn-outline-primary {
    background: transparent !important;
    color: #3b82f6 !important;
    border: 2px solid #3b82f6 !important;
}

.btn-outline-primary:hover {
    background: #3b82f6 !important;
    color: white !important;
}

.btn-outline-secondary {
    background: transparent !important;
    color: #6b7280 !important;
    border: 2px solid #6b7280 !important;
}

.btn-outline-secondary:hover {
    background: #6b7280 !important;
    color: white !important;
}

/* ===== BUTTON GROUPS ===== */

.btn-group {
    display: inline-flex;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-group .btn-secondary,
.btn-group .btn-primary {
    border-radius: 0 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.btn-group .btn-secondary:first-child,
.btn-group .btn-primary:first-child {
    border-top-left-radius: 12px !important;
    border-bottom-left-radius: 12px !important;
}

.btn-group .btn-secondary:last-child,
.btn-group .btn-primary:last-child {
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
    border-right: none !important;
}

/* ===== DISABLED BUTTON STATES ===== */

.btn-secondary:disabled,
.btn-primary:disabled,
.btn-secondary.disabled,
.btn-primary.disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-secondary:disabled:hover,
.btn-primary:disabled:hover,
.btn-secondary.disabled:hover,
.btn-primary.disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ===== LOADING BUTTON STATES ===== */

.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: btn-spin 1s linear infinite;
}

@keyframes btn-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn-loading .btn-text {
    opacity: 0;
}

/* ===== ICON BUTTONS ===== */

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
}

.btn-icon i {
    font-size: 18px;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

.btn-icon.btn-sm i {
    font-size: 14px;
}

.btn-icon.btn-lg {
    width: 56px;
    height: 56px;
}

.btn-icon.btn-lg i {
    font-size: 22px;
}

/* ===== FLOATING ACTION BUTTON ===== */

.btn-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50% !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    z-index: 1000;
}

.btn-fab i {
    font-size: 24px;
}

.btn-fab:hover {
    transform: translateY(-4px) scale(1.1) !important;
}

/* ===== RESPONSIVE BUTTON ADJUSTMENTS ===== */

@media (max-width: 768px) {
    .btn-primary,
    .btn-secondary {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .btn-lg {
        padding: 10px 20px !important;
        font-size: 16px;
    }
    
    .btn-fab {
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
    
    .btn-fab i {
        font-size: 20px;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

.btn-primary:focus,
.btn-secondary:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-secondary {
        border: 2px solid #3b82f6 !important;
        background: white !important;
        color: #3b82f6 !important;
    }
    
    .btn-secondary:hover {
        background: #3b82f6 !important;
        color: white !important;
    }
    
    .btn-primary {
        border: 2px solid #f97316 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .btn-primary,
    .btn-secondary,
    .btn-fab {
        transition: none !important;
    }
    
    .btn-primary:hover,
    .btn-secondary:hover,
    .btn-fab:hover {
        transform: none !important;
    }
}

/* ===== UTILITIES FOR SPECIFIC ISSUES ===== */

/* Fix for navigation buttons specifically */
.nav-link.btn-secondary,
.navbar .btn-secondary {
    background: rgba(96, 165, 250, 0.1) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

/* Fix for form buttons */
form .btn-secondary,
.form-group .btn-secondary {
    background: rgba(96, 165, 250, 0.1) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

/* Fix for card buttons */
.card .btn-secondary,
.hover-card .btn-secondary {
    background: rgba(96, 165, 250, 0.1) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

/* Ensure no Tailwind conflicts */
.btn-secondary:not(.no-override) {
    background: rgba(96, 165, 250, 0.1) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(96, 165, 250, 0.3) !important;
}

/* Print styles */
@media print {
    .btn-primary,
    .btn-secondary {
        background: transparent !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        box-shadow: none !important;
        transform: none !important;
    }
}
