/* =============================================================
   Knox Wire Harnesses ERP — Unified Button System
   Single source of truth for all button styles app-wide.
   Do NOT redeclare these classes in per-page CSS files.
   ============================================================= */

/* --- Base shared traits --- */
.btn-primary-themed,
.btn-secondary-themed,
.btn-edit-themed,
.btn-danger-themed,
.btn-info-themed,
.btn-warning-themed,
.btn-success-themed {
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    height: 40px;
    box-sizing: border-box;
    white-space: nowrap;
    line-height: 1;
    user-select: none;
}

.btn-primary-themed:disabled,
.btn-secondary-themed:disabled,
.btn-edit-themed:disabled,
.btn-danger-themed:disabled,
.btn-info-themed:disabled,
.btn-warning-themed:disabled,
.btn-success-themed:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Primary — deep teal/brand action --- */
.btn-primary-themed {
    background-color: var(--primary-color-darker);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.btn-primary-themed:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.22);
    transform: translateY(-1px);
}

.btn-primary-themed:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

/* --- Secondary — ghost / neutral --- */
.btn-secondary-themed {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary-themed:hover:not(:disabled) {
    background-color: var(--hover-background-color);
    border-color: var(--text-color);
}

.btn-secondary-themed.disabled,
.btn-secondary-themed[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* --- Edit — primary-light, small table-row action --- */
.btn-edit-themed {
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.25rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 6px;
    height: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.14);
}

.btn-edit-themed:hover:not(:disabled) {
    filter: brightness(1.12);
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
    transform: translateY(-1px);
}

/* --- Danger — destructive action --- */
.btn-danger-themed {
    background-color: #dc3545;
    color: #fff;
    padding: 0.25rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 6px;
    height: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.14);
}

.btn-danger-themed:hover:not(:disabled) {
    background-color: #b91c2c;
    box-shadow: 0 2px 6px rgba(185,28,44,0.35);
    transform: translateY(-1px);
}

/* --- Info — teal accent, secondary actions --- */
.btn-info-themed {
    background-color: #0e8a9e;
    color: #fff;
    padding: 0.25rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 6px;
    height: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.14);
}

.btn-info-themed:hover:not(:disabled) {
    background-color: #0a6e7e;
    box-shadow: 0 2px 6px rgba(14,138,158,0.35);
    transform: translateY(-1px);
}

/* --- Warning — amber, caution actions --- */
.btn-warning-themed {
    background-color: #d97706;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.btn-warning-themed:hover:not(:disabled) {
    background-color: #b45309;
    box-shadow: 0 3px 8px rgba(217,119,6,0.30);
    transform: translateY(-1px);
}

/* --- Success — green, confirm/complete --- */
.btn-success-themed {
    background-color: #16a34a;
    color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.btn-success-themed:hover:not(:disabled) {
    background-color: #15803d;
    box-shadow: 0 3px 8px rgba(22,163,74,0.30);
    transform: translateY(-1px);
}

/* =============================================================
   Size modifiers — add alongside any variant
   ============================================================= */

/* Small — modal footer, inline table actions */
.btn-sm-themed {
    padding: 0.25rem 0.75rem !important;
    font-size: 0.8rem !important;
    height: 32px !important;
    border-radius: 6px !important;
    gap: 0.35rem !important;
}

/* Extra-small — tight inline spots */
.btn-xs-themed {
    padding: 0.15rem 0.55rem !important;
    font-size: 0.75rem !important;
    height: 26px !important;
    border-radius: 5px !important;
    gap: 0.3rem !important;
}

/* Full-width modifier */
.btn-block-themed {
    width: 100%;
}

/* =============================================================
   Special-purpose aliases used in the codebase
   These keep existing razor class names working while drawing
   from the unified base above.
   ============================================================= */

/* btn-sm-modal = same as btn-sm-themed */
.btn-sm-modal {
    padding: 0.25rem 0.75rem !important;
    font-size: 0.8rem !important;
    height: 32px !important;
    border-radius: 6px !important;
}

/* ps-add-btn, ps-remove-btn — forecast panel inline actions */
.ps-add-btn {
    padding: 0.2rem 0.6rem !important;
    font-size: 0.78rem !important;
    height: 28px !important;
    border-radius: 5px !important;
}

.ps-remove-btn {
    padding: 0.2rem 0.5rem !important;
    font-size: 0.78rem !important;
    height: 26px !important;
    border-radius: 5px !important;
    line-height: 1 !important;
}

/* edit-btn-sm — EditPurchaseOrderModal small row actions */
.edit-btn-sm {
    padding: 0.2rem 0.6rem !important;
    font-size: 0.78rem !important;
    height: 28px !important;
    border-radius: 5px !important;
}

/* mpo-receive-btn — MaterialPurchaseOrderInfoModal receive button */
.mpo-receive-btn {
    min-width: 140px;
}

/* psl-mode-active — PrintPackingSlipModal active mode indicator */
.psl-mode-active {
    background-color: var(--primary-color-darker) !important;
    color: #fff !important;
    border-color: var(--primary-color-darker) !important;
}

/* =============================================================
   Bootstrap btn overrides inside modals/pages
   Catches any leftover plain Bootstrap btn classes and re-skins
   them to match the themed system.
   ============================================================= */
.btn.btn-primary,
.btn.btn-outline-primary {
    background-color: var(--primary-color-darker);
    border-color: var(--primary-color-darker);
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.btn.btn-primary:hover,
.btn.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.btn.btn-secondary,
.btn.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

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

.btn.btn-danger,
.btn.btn-outline-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.btn.btn-danger:hover,
.btn.btn-outline-danger:hover {
    background-color: #b91c2c;
    border-color: #b91c2c;
}

.btn.btn-warning {
    background-color: #d97706;
    border-color: #d97706;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

.btn.btn-warning:hover {
    background-color: #b45309;
    border-color: #b45309;
    color: #fff;
}

/* =============================================================
   Mobile overrides
   ============================================================= */
@media (max-width: 768px) {
    .btn-primary-themed,
    .btn-secondary-themed,
    .btn-warning-themed,
    .btn-success-themed {
        height: 44px;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .btn-edit-themed,
    .btn-danger-themed,
    .btn-info-themed {
        height: 36px;
        padding: 0.35rem 0.75rem;
    }

    /* Disable lift animation on touch */
    .btn-primary-themed:hover,
    .btn-secondary-themed:hover,
    .btn-edit-themed:hover {
        transform: none;
    }
}

/* =============================================================
   Inline action buttons — tiny table-row actions (edit ✎, undo ↩, release ▶)
   These are intentionally compact and icon-style.
   ============================================================= */
.btn-action-themed {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    font-size: 0.82rem;
    height: 26px;
    min-width: 26px;
    border-radius: 5px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease-in-out;
    user-select: none;
    white-space: nowrap;
    line-height: 1;
    /* default neutral tone */
    background-color: var(--hover-background-color, #2a3a4a);
    color: var(--text-color, #cdd6e3);
    border-color: var(--border-color, #3a4f62);
}

.btn-action-themed:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.22);
}

.btn-action-themed:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Release variant — green tint */
.btn-action-themed.btn-action-release {
    background-color: #16a34a;
    color: #fff;
    border-color: #16a34a;
}

.btn-action-themed.btn-action-release:hover:not(:disabled) {
    background-color: #15803d;
    border-color: #15803d;
}

/* Confirm variant — blue tint */
.btn-action-themed.btn-action-confirm {
    background-color: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.btn-action-themed.btn-action-confirm:hover:not(:disabled) {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

/* Undo variant — amber tint */
.btn-action-themed.btn-action-undo {
    background-color: #d97706;
    color: #fff;
    border-color: #d97706;
}

.btn-action-themed.btn-action-undo:hover:not(:disabled) {
    background-color: #b45309;
    border-color: #b45309;
}

/* Small variant — use alongside any btn-*-themed */
.btn-sm-themed {
    font-size: 0.75rem !important;
    padding: 3px 9px !important;
    gap: 4px;
}
