/* Button Styles */
.btn {
    border-radius: 25px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    border: none !important;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: none !important;
    box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.25) !important;
}

/* Primary Button - Convert to outline style to match table controls */
.btn-primary {
    border: 2px solid var(--accent-blue) !important;
    color: var(--accent-blue);
    background: transparent;
}

.btn-primary:hover {
    background-color: var(--accent-blue);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-primary:hover * {
    color: white !important;
}

/* Success Button - Convert to outline style for consistency */
.btn-success {
    border: 2px solid var(--accent-green) !important;
    color: var(--accent-green);
    background: transparent;
}

.btn-success:hover {
    background-color: var(--accent-green);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-success:hover * {
    color: white !important;
}

/* Warning Button - Convert to outline style for consistency */
.btn-warning {
    border: 2px solid var(--accent-orange) !important;
    color: var(--accent-orange);
    background: transparent;
}

.btn-warning:hover {
    background-color: var(--accent-orange);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-warning:hover * {
    color: white !important;
}

/* Danger Button - Convert to outline style for consistency */
.btn-danger {
    border: 2px solid var(--accent-red) !important;
    color: var(--accent-red);
    background: transparent;
}

.btn-danger:hover {
    background-color: var(--accent-red);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-danger:hover * {
    color: white !important;
}

/* Info Button - Convert to outline style for consistency */
.btn-info {
    border: 2px solid var(--accent-slate) !important;
    color: var(--accent-slate);
    background: transparent;
}

.btn-info:hover {
    background-color: var(--accent-slate);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-info:hover * {
    color: white !important;
}

/* Secondary Button - Convert to outline style for consistency */
.btn-secondary {
    border: 2px solid var(--steel-gray) !important;
    color: var(--steel-gray);
    background: transparent;
}

.btn-secondary:hover {
    background-color: var(--steel-gray);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-secondary:hover * {
    color: white !important;
}

/* Outline Buttons */
.btn-outline-primary {
    border: 2px solid var(--accent-blue) !important;
    color: var(--accent-blue);
    background: transparent;
}

.btn-outline-primary:hover {
    background-color: var(--accent-blue);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-primary:hover * {
    color: white !important;
}

.btn-outline-success {
    border: 2px solid var(--accent-green) !important;
    color: var(--accent-green);
    background: transparent;
}

.btn-outline-success:hover {
    background-color: var(--accent-green);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-success:hover * {
    color: white !important;
}

.btn-outline-warning {
    border: 2px solid var(--accent-orange) !important;
    color: var(--accent-orange);
    background: transparent;
}

.btn-outline-warning:hover {
    background-color: var(--accent-orange);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-warning:hover * {
    color: white !important;
}

.btn-outline-danger {
    border: 2px solid var(--accent-red) !important;
    color: var(--accent-red);
    background: transparent;
}

.btn-outline-danger:hover {
    background-color: var(--accent-red);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-danger:hover .fa-trash {
    color: #ffffff !important;
}

/* Ensure trash icons are red by default */
.btn-outline-danger .fa-trash {
    color: var(--accent-red) !important;
}

/* Table action buttons specific styling */
.btn-group-sm .btn-outline-danger {
    transition: all 0.3s ease;
}

.btn-group-sm .btn-outline-danger:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.btn-outline-info {
    border: 2px solid var(--accent-slate) !important;
    color: var(--accent-slate);
    background: transparent;
}

.btn-outline-info:hover {
    background-color: var(--accent-slate);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-info:hover * {
    color: white !important;
}

.btn-outline-secondary {
    border: 2px solid var(--steel-gray) !important;
    color: var(--steel-gray);
    background: transparent;
}

.btn-outline-secondary:hover {
    background-color: var(--steel-gray);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-secondary:hover * {
    color: white !important;
}

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

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    border-radius: 30px;
}

/* Button Groups */
.btn-group > .btn:not(:last-child):not(.dropdown-toggle) {
    border-radius: 25px 0 0 25px !important;
}

.btn-group > .btn:not(:first-child) {
    border-radius: 0 25px 25px 0 !important;
}

.btn-group > .btn:only-child {
    border-radius: 25px !important;
}

.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
    border-radius: 0 !important;
}

/* Table Control and Filtering Buttons */
.btn-sm {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    border-radius: 18px;
}

.btn-group .btn-sm {
    border-radius: 18px;
}

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

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

.btn-group .btn-sm:only-child {
    border-radius: 18px;
}

/* Export and Filter button enhancements */
.btn[onclick*="export"], .btn[onclick*="Export"] {
    position: relative;
    overflow: hidden;
}

.btn[onclick*="export"]:hover, .btn[onclick*="Export"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn[onclick*="clear"], .btn[onclick*="Clear"] {
    position: relative;
}

.btn[onclick*="clear"]:hover, .btn[onclick*="Clear"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.2);
}

/* Close Button */
.btn-close {
    border-radius: 50%;
    padding: 0.5rem;
}

/* Modal Close Button */
.modal-header .btn-close {
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    opacity: 0.8;
}

.modal-header .btn-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.3);
}

/* ========================================
   FILTER BUTTON ACTIVE STATES
   ======================================== */

/* Active filter buttons inherit the hover state to show solid background */
.btn-outline-primary.active,
.btn-outline-primary.filter-active {
    /* Inherit the exact same styles as btn-outline-primary:hover */
    background-color: var(--accent-blue);
    color: white !important;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.btn-outline-primary.active *,
.btn-outline-primary.filter-active * {
    color: white !important;
}

/* Maintain active appearance on hover */
.btn-outline-primary.active:hover,
.btn-outline-primary.filter-active:hover {
    background-color: var(--accent-blue);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    filter: brightness(0.9);
}

/* Focus state for active filter buttons */
.btn-outline-primary.active:focus,
.btn-outline-primary.filter-active:focus {
    background-color: var(--accent-blue);
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.25) !important;
}

/* Filter button icon animation when active */
.btn-outline-primary.active i.fa-filter,
.btn-outline-primary.filter-active i.fa-filter {
    animation: filterPulse 2s ease-in-out infinite;
}

@keyframes filterPulse {
    0%, 100% { 
        transform: scale(1);
        opacity: 1;
    }
    50% { 
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* Ensure consistent styling across different button contexts */
.advanced-table-controls .btn-outline-primary.active,
.bom-filter-controls .btn-outline-primary.active,
.filter-controls .btn-outline-primary.active,
.btn-filter-group .btn-outline-primary.active {
    background-color: var(--accent-blue);
    color: white !important;
}

/* Filter Tag/Chip Styling */
.filter-chip {
    display: inline-block;
    background-color: var(--accent-blue);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    margin: 0.125rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.filter-chip:hover {
    background-color: var(--accent-blue);
    filter: brightness(0.9);
    transform: scale(1.02);
}

.filter-chip .remove {
    color: #ffffff !important;
    font-weight: bold;
    font-size: 1rem;
    margin-left: 0.5rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.filter-chip .remove:hover {
    opacity: 1;
    color: #ffffff !important;
}

/* Disabled state for configuration buttons */
.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-disabled:hover {
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}