/* Unified components - search, modals, toasts, breadcrumbs, etc. */

/* Cart badge */
.cart-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* User menu dropdown in sidebar */
.user-menu {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-top: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.user-menu a {
    display: block;
    padding: 0.6rem 0.75rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.user-menu a:last-child { border-bottom: none; }
.user-menu a:hover {
    background: rgba(96, 165, 250, 0.15);
    color: white;
}


/* Global search dropdown */
.global-search-wrap { position: relative; }
.global-search {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #f1f5f9;
    font-size: 0.85rem;
}
.global-search::placeholder { color: #94a3b8; }
.global-search:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: #60a5fa;
}
.global-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 300;
    max-height: 360px;
    overflow-y: auto;
}
.search-result-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.65rem 0.75rem;
    text-decoration: none;
    color: #f1f5f9;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.search-result-item:hover { background: rgba(96, 165, 250, 0.15); }
.search-result-item:last-child { border-bottom: none; }
.result-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #60a5fa;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.result-title { font-size: 0.9rem; font-weight: 500; }
.result-subtitle { font-size: 0.75rem; color: #94a3b8; }
.search-result-empty {
    padding: 1rem 0.75rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* Toast notifications */
.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    min-width: 240px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }
.toast-warning { background: #d97706; }

/* Confirmation modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
}
.modal-dialog {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { margin: 0; color: #1e3a5f; font-size: 1.1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.modal-body { padding: 1.5rem; color: #374151; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}
.breadcrumbs a { color: #6b7280; text-decoration: none; }
.breadcrumbs a:hover { color: #1e3a5f; }
.breadcrumb-sep { color: #d1d5db; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #6b7280;
}
.empty-state-icon {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 0.5rem;
}
.empty-state-title { font-size: 1.1rem; color: #374151; margin: 0 0 0.25rem 0; }
.empty-state-msg { font-size: 0.9rem; margin-bottom: 1rem; }

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 6px;
}
.skeleton-line { height: 1rem; margin-bottom: 0.5rem; }
.skeleton-line.short { width: 60%; }
.skeleton-card { height: 80px; margin-bottom: 0.75rem; }
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary, #1e3a5f);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s, transform 0.2s;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { background: var(--accent, #2563eb); }

/* Tenant switcher */
.tenant-switcher {
    position: relative;
    margin: 0.5rem 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    cursor: pointer;
    color: #f1f5f9;
    font-size: 0.85rem;
    user-select: none;
}
.tenant-switcher:hover { background: rgba(255, 255, 255, 0.1); }
.tenant-switcher-menu {
    position: absolute;
    top: 100%;
    left: 0.75rem;
    right: 0.75rem;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin-top: 4px;
    z-index: 250;
    max-height: 280px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.tenant-switcher-item {
    display: block;
    padding: 0.6rem 0.75rem;
    color: #cbd5e1;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}
.tenant-switcher-item:hover { background: rgba(96, 165, 250, 0.15); color: white; }
.tenant-switcher-item.active { background: rgba(96, 165, 250, 0.25); color: white; }
.tenant-switcher-item:last-child { border-bottom: none; }

/* Standardized buttons */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #1e3a5f; color: white; }
.btn-primary:hover:not(:disabled) { background: #2d5a8e; }
.btn-secondary { background: #e5e7eb; color: #1f2937; }
.btn-secondary:hover:not(:disabled) { background: #d1d5db; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: #059669; color: white; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-ghost { background: transparent; color: #6b7280; border-color: #d1d5db; }
.btn-ghost:hover:not(:disabled) { background: #f3f4f6; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* Form input standardization */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group .help-text {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 0.25rem;
}
.form-group .error-text {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 0.25rem;
}

/* Standardized badge */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #e5e7eb;
    color: #374151;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: #e5e7eb; color: #374151; }
