/* ============================================================================
   SHARED COMPONENTS - Consolidated from multiple CSS files
   This file contains components used across multiple pages to reduce duplication
   ============================================================================ */

/* ============================================================================
   BUTTONS - Shared button styles
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary:disabled:active {
    transform: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-secondary:active {
    background: var(--bg-secondary);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Action Buttons - Used in order cards, picking, etc. */
.action-btn {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn:active {
    transform: scale(0.98);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================================================
   BADGES - Location badges used across multiple pages
   ============================================================================ */

.bin-badge {
    display: inline-block;
    padding: 0.3rem 0.5rem;
    background: var(--primary-light);
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 6px;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    line-height: 1.2;
}

/* ============================================================================
   SORT & FILTER CHIPS - Used in listing pages
   ============================================================================ */

.sort-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.4rem 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background: white;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
}

.sort-chip[data-active="true"] {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.sort-chip[data-active="true"] .sort-arrow {
    filter: brightness(0) invert(1);
    display: inline-block;
}

.sort-chip:not([data-active="true"]) .sort-arrow {
    display: none;
}

.sort-chip:active {
    transform: scale(0.95);
}

.sort-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.filter-chip {
    padding: 0.4rem 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    background: white;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
    white-space: nowrap;
}

.filter-chip[data-active="true"] {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filter-chip:active {
    transform: scale(0.95);
}

/* ============================================================================
   LOADING & STATE MESSAGES
   ============================================================================ */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.state-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-subtext {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.error-state {
    text-align: center;
    padding: 3rem 1rem;
}

.error-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.error-message {
    background: #fee;
    border-left: 4px solid var(--danger-color);
    padding: 1rem;
    border-radius: 6px;
    color: #991b1b;
    margin: 1rem 0;
    text-align: left;
}

/* ============================================================================
   STOCK DISPLAYS - Used in product details and search
   ============================================================================ */

.stock-quantities {
    margin-bottom: 1rem;
}

.stock-main-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stock-main-item {
    text-align: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.stock-main-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stock-main-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.stock-main-value.positive {
    color: var(--success-color);
}

.stock-main-value.warning {
    color: var(--warning-color);
}

.stock-main-value.negative {
    color: var(--danger-color);
}

.stock-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.stock-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: #f9fafb;
    border-radius: 4px;
}

.stock-detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.stock-detail-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================================================
   STATUS MESSAGES - Used across app for notifications
   ============================================================================ */

.status-message {
    padding: 0.875rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

.status-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ============================================================================
   ICON SIZING UTILITIES
   ============================================================================ */

.icon-sm {
    width: 14px;
    height: 14px;
}

.icon-md {
    width: 20px;
    height: 20px;
}

.icon-lg {
    width: 24px;
    height: 24px;
}

.icon-xl {
    width: 48px;
    height: 48px;
}

/* Icon Color Filters */
.icon-danger {
    filter: invert(42%) sepia(93%) saturate(2553%)
            hue-rotate(336deg) brightness(95%) contrast(91%);
}

.icon-warning {
    filter: invert(66%) sepia(94%) saturate(442%)
            hue-rotate(358deg) brightness(100%) contrast(95%);
}

.icon-success {
    filter: invert(64%) sepia(57%) saturate(450%)
            hue-rotate(94deg) brightness(92%) contrast(86%);
}

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

@media (max-width: 480px) {
    .sort-chip,
    .filter-chip {
        padding: 0.3rem 0.55rem;
        font-size: 0.75rem;
        min-height: 28px;
    }

    .stock-main-value {
        font-size: 2rem;
    }
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: 90%;
    width: 400px;
}

.toast {
    background: #1f2937;
    color: white;
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    font-size: 0.938rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: auto;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    background: #059669;
}

.toast-error {
    background: #dc2626;
}

.toast-warning {
    background: #d97706;
}

.toast-info {
    background: #2563eb;
}
