/**
 * Unified Button Styles
 * Consolidated from button-fix-final.css
 * This file provides comprehensive button styling across the entire application
 */

/* Global button reset and styles */
.btn {
    /* Reset everything first */
    all: unset;
    
    /* Then apply correct button styles */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    outline: none !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    position: relative !important;
    overflow: hidden !important;
    user-select: none !important;
}

/* Small buttons */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 13px !important;
}

/* Icon styling inside buttons */
.btn i {
    font-size: 14px !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    line-height: 1 !important;
    display: inline-block !important;
}

/* Button colors - Primary (Blue) */
.btn-primary {
    background-color: #0d6efd !important;
    color: #ffffff !important;
    border-color: #0d6efd !important;
}

.btn-primary:hover:not(:disabled) {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25) !important;
}

.btn-primary:active:not(:disabled) {
    background-color: #0a58ca !important;
    border-color: #0954b0 !important;
    transform: translateY(0) !important;
}

/* Button colors - Secondary (Gray) */
.btn-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border-color: #6c757d !important;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5c636a !important;
    border-color: #545b62 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.25) !important;
}

.btn-secondary:active:not(:disabled) {
    background-color: #545b62 !important;
    border-color: #4d5459 !important;
    transform: translateY(0) !important;
}

/* Button colors - Success (Green) */
.btn-success {
    background-color: #198754 !important;
    color: #ffffff !important;
    border-color: #198754 !important;
}

.btn-success:hover:not(:disabled) {
    background-color: #157347 !important;
    border-color: #146c43 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.25) !important;
}

.btn-success:active:not(:disabled) {
    background-color: #146c43 !important;
    border-color: #13653f !important;
    transform: translateY(0) !important;
}

/* Button colors - Danger (Red) */
.btn-danger {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border-color: #dc3545 !important;
}

.btn-danger:hover:not(:disabled) {
    background-color: #bb2d3b !important;
    border-color: #b02a37 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.25) !important;
}

.btn-danger:active:not(:disabled) {
    background-color: #b02a37 !important;
    border-color: #a52834 !important;
    transform: translateY(0) !important;
}

/* Button colors - Warning (Yellow) */
.btn-warning {
    background-color: #ffc107 !important;
    color: #000000 !important;
    border-color: #ffc107 !important;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e0a800 !important;
    border-color: #d39e00 !important;
    color: #000000 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(255, 193, 7, 0.25) !important;
}

.btn-warning:active:not(:disabled) {
    background-color: #d39e00 !important;
    border-color: #c69500 !important;
    transform: translateY(0) !important;
}

/* Button colors - Info (Cyan) */
.btn-info {
    background-color: #0dcaf0 !important;
    color: #000000 !important;
    border-color: #0dcaf0 !important;
}

.btn-info:hover:not(:disabled) {
    background-color: #0bb5d8 !important;
    border-color: #0aa2c0 !important;
    color: #000000 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(13, 202, 240, 0.25) !important;
}

.btn-info:active:not(:disabled) {
    background-color: #0aa2c0 !important;
    border-color: #099bba !important;
    transform: translateY(0) !important;
}

/* Button colors - Light */
.btn-light {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border-color: #f8f9fa !important;
}

.btn-light:hover:not(:disabled) {
    background-color: #e2e6ea !important;
    border-color: #dae0e5 !important;
    color: #212529 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
}

.btn-light:active:not(:disabled) {
    background-color: #dae0e5 !important;
    border-color: #d3d9df !important;
    transform: translateY(0) !important;
}

/* Button colors - Dark */
.btn-dark {
    background-color: #212529 !important;
    color: #ffffff !important;
    border-color: #212529 !important;
}

.btn-dark:hover:not(:disabled) {
    background-color: #1c1e21 !important;
    border-color: #191c1f !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(33, 37, 41, 0.5) !important;
}

.btn-dark:active:not(:disabled) {
    background-color: #191c1f !important;
    border-color: #171a1d !important;
    transform: translateY(0) !important;
}

/* Outline buttons */
.btn-outline-primary {
    background-color: transparent !important;
    color: #0d6efd !important;
    border-color: #0d6efd !important;
}

.btn-outline-primary:hover:not(:disabled) {
    background-color: #0d6efd !important;
    color: #ffffff !important;
    border-color: #0d6efd !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.25) !important;
}

.btn-outline-secondary {
    background-color: transparent !important;
    color: #6c757d !important;
    border-color: #6c757d !important;
}

.btn-outline-secondary:hover:not(:disabled) {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border-color: #6c757d !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.25) !important;
}

.btn-outline-success {
    background-color: transparent !important;
    color: #198754 !important;
    border-color: #198754 !important;
}

.btn-outline-success:hover:not(:disabled) {
    background-color: #198754 !important;
    color: #ffffff !important;
    border-color: #198754 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.25) !important;
}

.btn-outline-danger {
    background-color: transparent !important;
    color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.btn-outline-danger:hover:not(:disabled) {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    border-color: #dc3545 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.25) !important;
}

/* Active state for all buttons */
.btn:active:not(:disabled) {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) !important;
}

/* Disabled state */
.btn:disabled,
.btn.disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

/* Focus state */
.btn:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25) !important;
}

.btn-secondary:focus {
    box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.25) !important;
}

.btn-success:focus {
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.25) !important;
}

.btn-danger:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
}

/* Button groups */
.btn-group {
    display: inline-flex !important;
    vertical-align: middle !important;
}

.btn-group > .btn {
    border-radius: 0 !important;
}

.btn-group > .btn:first-child {
    border-top-left-radius: 6px !important;
    border-bottom-left-radius: 6px !important;
}

.btn-group > .btn:last-child {
    border-top-right-radius: 6px !important;
    border-bottom-right-radius: 6px !important;
}

/* Specific fixes for contract tab buttons */
.contracts-tab-modern .btn,
.document-actions .btn,
.exhibitor-detail-window .btn,
#preview-contract-btn {
    /* Ensure these buttons follow the global styles */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

/* Dark mode adjustments */
body.dark-mode .btn {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .btn:hover:not(:disabled) {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .btn-light {
    background-color: #343a40 !important;
    color: #f8f9fa !important;
    border-color: #343a40 !important;
}

body.dark-mode .btn-light:hover:not(:disabled) {
    background-color: #23272b !important;
    border-color: #1d2124 !important;
    color: #f8f9fa !important;
}

/* Ensure proper button spacing in containers */
.document-actions,
.btn-toolbar,
.button-group {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
}

/* Fix for Font Awesome icons specifically */
.btn .fa,
.btn .fas,
.btn .far,
.btn .fab {
    font-size: inherit !important;
    vertical-align: middle !important;
}

/* Ensure buttons don't inherit unwanted text styles */
.btn,
.btn * {
    text-transform: none !important;
    letter-spacing: normal !important;
}

/* Fix for exhibitor detail window save/cancel buttons visibility */
#save-btn[style*="display: none"],
#cancel-btn[style*="display: none"] {
    display: none !important;
}

/* When buttons should be visible, ensure they use inline-flex */
#save-btn:not([style*="display: none"]),
#cancel-btn:not([style*="display: none"]) {
    display: inline-flex !important;
}

/* Compatibility with legacy button classes */
.btn-action {
    @extend .btn-primary;
}

.btn-icon {
    padding: 0.25rem !important;
    background-color: transparent !important;
    color: var(--gray-dark, #6c757d) !important;
}

.btn-icon:hover {
    background-color: var(--gray-light, #f8f9fa) !important;
    color: var(--dark-color, #212529) !important;
}